diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2002-07-15 20:49:20 +0200 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2002-07-15 20:49:20 +0200 |
commit | 104c3feb6999556db85283a8ba7ac1f8c38b5609 (patch) | |
tree | 42a2b2d0d3e516c595f74b742ece297a1d63a9c6 /contrib/solaris/buildpkg.sh | |
parent | - (bal) Remove unused tty defined in do_setusercontext() pointed out by (diff) | |
download | openssh-104c3feb6999556db85283a8ba7ac1f8c38b5609.tar.xz openssh-104c3feb6999556db85283a8ba7ac1f8c38b5609.zip |
- (bal) Privsep user creation support in Solaris buildpkg.sh by
dtucker@zip.com.au
Diffstat (limited to '')
-rwxr-xr-x | contrib/solaris/buildpkg.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/solaris/buildpkg.sh b/contrib/solaris/buildpkg.sh index 426db1f6a..def325b87 100755 --- a/contrib/solaris/buildpkg.sh +++ b/contrib/solaris/buildpkg.sh @@ -98,6 +98,19 @@ do eval $confvar=`grep "^$confvar=" Makefile | cut -d = -f 2` done + +## Collect value of privsep user +for confvar in SSH_PRIVSEP_USER +do + eval $confvar=`awk '/#define[ \t]'$confvar'/{print $3}' config.h` +done + +## Set privsep defaults if not defined +if [ -z "$SSH_PRIVSEP_USER" ] +then + SSH_PRIVSEP_USER=sshd +fi + ## Extract common info requires for the 'info' part of the package. VERSION=`./ssh -V 2>&1 | sed -e 's/,.*//'` @@ -214,6 +227,33 @@ fi installf -f ${PKGNAME} +if egrep '^[ \t]*UsePrivilegeSeparation[ \t]+no' $sysconfdir/sshd_config >/dev/null +then + echo "UsePrivilegeSeparation disabled in config, not creating PrivSep user" + echo "or group." +else + echo "UsePrivilegeSeparation enabled in config (or defaulting to on)." + + # create group if required + if cut -f1 -d: /etc/group | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null + then + echo "PrivSep group $SSH_PRIVSEP_USER already exists." + else + echo "Creating PrivSep group $SSH_PRIVSEP_USER." + groupadd $SSH_PRIVSEP_USER + fi + + # Create user if required + if cut -f1 -d: /etc/passwd | egrep '^'$SSH_PRIVSEP_USER'\$' >/dev/null + then + echo "PrivSep user $SSH_PRIVSEP_USER already exists." + else + echo "Creating PrivSep user $SSH_PRIVSEP_USER." + useradd -c 'SSHD PrivSep User' -s /bin/false -g $SSH_PRIVSEP_USER $SSH_PRIVSEP_USER + passwd -l $SSH_PRIVSEP_USER + fi +fi + [ "\${POST_INS_START}" = "yes" ] && ${TEST_DIR}/etc/init.d/${SYSVINIT_NAME} start exit 0 _EOF |