mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-01-25 10:12:13 +03:00
Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <robn@despairlabs.com> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
50 lines
1.5 KiB
Bash
50 lines
1.5 KiB
Bash
#!/bin/ksh -p
|
|
# SPDX-License-Identifier: CDDL-1.0
|
|
#
|
|
# CDDL HEADER START
|
|
#
|
|
# The contents of this file are subject to the terms of the
|
|
# Common Development and Distribution License (the "License").
|
|
# You may not use this file except in compliance with the License.
|
|
#
|
|
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
# or https://opensource.org/licenses/CDDL-1.0.
|
|
# See the License for the specific language governing permissions
|
|
# and limitations under the License.
|
|
#
|
|
# When distributing Covered Code, include this CDDL HEADER in each
|
|
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
# If applicable, add the following below this CDDL HEADER, with the
|
|
# fields enclosed by brackets "[]" replaced with your own identifying
|
|
# information: Portions Copyright [yyyy] [name of copyright owner]
|
|
#
|
|
# CDDL HEADER END
|
|
#
|
|
|
|
. $STF_SUITE/include/libtest.shlib
|
|
|
|
username="pamtestuser"
|
|
runstatedir="${TESTDIR}_run"
|
|
pammodule="@pammoduledir@/pam_zfs_key.so"
|
|
pamservice="pam_zfs_key_test"
|
|
pamconfig="/etc/pam.d/${pamservice}"
|
|
|
|
function keystatus {
|
|
log_must [ "$(get_prop keystatus "$TESTPOOL/pam/${username}")" = "$1" ]
|
|
}
|
|
|
|
function genconfig {
|
|
printf '%s\trequired\tpam_permit.so\n%s\toptional\t%s\t%s\n' \
|
|
password password "$pammodule" "$1" \
|
|
auth auth "$pammodule" "$1" \
|
|
session session "$pammodule" "$1" > "${pamconfig}"
|
|
}
|
|
|
|
function rmconfig {
|
|
log_must rm -f "${pamconfig}"
|
|
}
|
|
|
|
function references {
|
|
log_must [ "$(<"${runstatedir}/$(id -u ${username})")" = "$1" ]
|
|
}
|