Sun, 05 Aug 2012 22:52:01 +0200
Import package vendor original specs for necessary manipulations.
pam/pam.spec | file | annotate | diff | comparison | revisions | |
pam/pamtool | file | annotate | diff | comparison | revisions | |
pam/rc.pam | file | annotate | diff | comparison | revisions |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/pam/pam.spec Sun Aug 05 22:52:01 2012 +0200 1.3 @@ -0,0 +1,165 @@ 1.4 +## 1.5 +## pam.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/> 1.7 +## 1.8 +## Permission to use, copy, modify, and distribute this software for 1.9 +## any purpose with or without fee is hereby granted, provided that 1.10 +## the above copyright notice and this permission notice appear in all 1.11 +## copies. 1.12 +## 1.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.24 +## SUCH DAMAGE. 1.25 +## 1.26 + 1.27 +# package information 1.28 +Name: pam 1.29 +Summary: Information Resource for PAM 1.30 +URL: - 1.31 +Vendor: The OpenPKG Project 1.32 +Packager: OpenPKG Foundation e.V. 1.33 +Distribution: OpenPKG Community 1.34 +Class: BASE 1.35 +Group: Meta 1.36 +License: PD 1.37 +Version: 0 1.38 +Release: 20110219 1.39 + 1.40 +# list of sources 1.41 +Source0: pamtool 1.42 +Source1: rc.pam 1.43 + 1.44 +# build information 1.45 +BuildPreReq: OpenPKG, openpkg >= 20100101 1.46 +PreReq: OpenPKG, openpkg >= 20100101 1.47 +Provides: PAM 1.48 + 1.49 +%description 1.50 + This is the information resource package for PAM. 1.51 + 1.52 +%track 1.53 + 1.54 +%prep 1.55 + 1.56 +%build 1.57 + 1.58 +%install 1.59 + 1.60 + pam_cfgloc="" 1.61 + pam_modpfx="" 1.62 + pam_incdir="" 1.63 + pam_libdir="" 1.64 + 1.65 + # search for configuration location 1.66 + for cfgloc in \ 1.67 + /etc/pam.d \ 1.68 + /etc/pam.conf \ 1.69 + ; do 1.70 + if [ -f $cfgloc -o -d $cfgloc ]; then 1.71 + pam_cfgloc="$cfgloc" 1.72 + break 1.73 + fi 1.74 + done 1.75 + 1.76 + # search for module prefix 1.77 + if [ -d $pam_cfgloc ]; then 1.78 + mod=`cat $pam_cfgloc/* 2>/dev/null | grep -i '^#*[ ]*other' | head -1 | awk '{ print $3; }'` 1.79 + elif [ -f $pam_cfgloc ]; then 1.80 + mod=`cat $pam_cfgloc 2>/dev/null | grep -i '^#*[ ]*other' | head -1 | awk '{ print $4; }'` 1.81 + else 1.82 + mod="" 1.83 + fi 1.84 + case $mod in 1.85 + pam_* ) pam_modpfx="" ;; 1.86 + /*/pam_* ) pam_modpfx=`echo $mod | sed 's;^\(/.*/\)pam_[^/]*$;\1;'` ;; 1.87 + esac 1.88 + 1.89 + # search for include directory 1.90 + for incdir in \ 1.91 + /usr/include \ 1.92 + /usr/local/include \ 1.93 + /opt/include \ 1.94 + ; do 1.95 + if [ -f "$incdir/security/pam_appl.h" ]; then 1.96 + pam_incdir="$incdir" 1.97 + break 1.98 + fi 1.99 + done 1.100 + 1.101 + # search for library directory 1.102 + for libdir in \ 1.103 + /lib \ 1.104 + /usr/lib \ 1.105 + /usr/local/lib \ 1.106 + /opt/lib \ 1.107 + ; do 1.108 + for ext in a so sl so.0; do 1.109 + if [ -f "$libdir/libpam.$ext" ]; then 1.110 + pam_libdir="$libdir" 1.111 + break 1.112 + fi 1.113 + done 1.114 + if [ ".$pam_libdir" != . ]; then 1.115 + break 1.116 + fi 1.117 + done 1.118 + 1.119 + # make sure everything was found 1.120 + if [ ".$pam_cfgloc" = . ] ||\ 1.121 + [ ".$pam_incdir" = . ] ||\ 1.122 + [ ".$pam_libdir" = . ]; then 1.123 + set +x 1.124 + ( echo "************************************************************" 1.125 + echo "** ERROR: SOME PAM INFORMATION COULD NOT BE DETERMINED!!" 1.126 + echo "** ERROR: SOME PAM INFORMATION COULD NOT BE DETERMINED!!" 1.127 + echo "**" 1.128 + echo "** We found out:" 1.129 + echo "** PAM Config Location: \"${pam_cfgloc}\"" 1.130 + echo "** PAM Module Prefix: \"${pam_modpfx}\"" 1.131 + echo "** PAM Include Directory: \"${pam_incdir}\"" 1.132 + echo "** PAM Library Directory: \"${pam_libdir}\"" 1.133 + echo "**" 1.134 + echo "** Unfortunately, some information is missing here." 1.135 + echo "**" 1.136 + echo "** Be sure to have all system PAM components installed" 1.137 + echo "** in standard locations before building this package!" 1.138 + echo "**" 1.139 + echo "** ERROR: SOME PAM INFORMATION COULD NOT BE DETERMINED!!" 1.140 + echo "** ERROR: SOME PAM INFORMATION COULD NOT BE DETERMINED!!" 1.141 + echo "************************************************************" 1.142 + ) | %{l_rpmtool} msg -b -t error 1.143 + exit 1 1.144 + fi 1.145 + 1.146 + # install PAM tool 1.147 + %{l_shtool} mkdir -f -p -m 755 \ 1.148 + $RPM_BUILD_ROOT%{l_prefix}/sbin 1.149 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.150 + -e 's;@l_platform@;%{l_platform -t};g' \ 1.151 + %{SOURCE pamtool} $RPM_BUILD_ROOT%{l_prefix}/sbin/ 1.152 + 1.153 + # install rc file 1.154 + %{l_shtool} mkdir -f -p -m 755 \ 1.155 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 1.156 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.157 + -e "s;@pam_cfgloc@;${pam_cfgloc};g" \ 1.158 + -e "s;@pam_modpfx@;${pam_modpfx};g" \ 1.159 + -e "s;@pam_incdir@;${pam_incdir};g" \ 1.160 + -e "s;@pam_libdir@;${pam_libdir};g" \ 1.161 + %{SOURCE rc.pam} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.162 + 1.163 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} 1.164 + 1.165 +%files -f files 1.166 + 1.167 +%clean 1.168 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/pam/pamtool Sun Aug 05 22:52:01 2012 +0200 2.3 @@ -0,0 +1,201 @@ 2.4 +#!/bin/sh 2.5 +## 2.6 +## pamtool -- OpenPKG PAM Auxiliary Tool 2.7 +## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/> 2.8 +## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/> 2.9 +## 2.10 +## Permission to use, copy, modify, and distribute this software for 2.11 +## any purpose with or without fee is hereby granted, provided that 2.12 +## the above copyright notice and this permission notice appear in all 2.13 +## copies. 2.14 +## 2.15 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 2.16 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 2.17 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2.18 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 2.19 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2.20 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2.21 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 2.22 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 2.23 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2.24 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 2.25 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2.26 +## SUCH DAMAGE. 2.27 +## 2.28 + 2.29 +# program name, version and date 2.30 +progname="pamtool" 2.31 +progvers="0.9.0" 2.32 +progdate="11-Mar-2002" 2.33 + 2.34 +# the OpenPKG instance information 2.35 +l_prefix="@l_prefix@" 2.36 +l_platform="@l_platform@" 2.37 + 2.38 +# default parameters 2.39 +verbose=no 2.40 +help=no 2.41 +add=no 2.42 +remove=no 2.43 +smart=no 2.44 +name="" 2.45 +id="" 2.46 + 2.47 +# iterate over argument line 2.48 +while [ $# -gt 0 ]; do 2.49 + opt=$1 2.50 + case $opt in 2.51 + -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;; 2.52 + *) arg='' ;; 2.53 + esac 2.54 + case $opt in 2.55 + -v|--verbose ) verbose=yes ;; 2.56 + -h|--help ) help=yes ;; 2.57 + -a|--add ) add=yes ;; 2.58 + -r|--remove ) remove=yes ;; 2.59 + -s|--smart ) smart=yes ;; 2.60 + --name=* ) name=$arg ;; 2.61 + --id=* ) id=$arg ;; 2.62 + -* ) help="Invalid option \`$opt'"; break ;; 2.63 + * ) break ;; 2.64 + esac 2.65 + shift 2.66 +done 2.67 +if [ ".$help" = .yes ]; then 2.68 + echo "$progname --add|--remove --name=NAME [--smart] [--id=ID]"; 2.69 + exit 0 2.70 +fi 2.71 +if [ ".$add" = .no -a ".$remove" = .no ]; then 2.72 + echo "$progname:ERROR: either option -a/--add or -r/--remove have to be specified" 1>&2 2.73 + exit 1 2.74 +fi 2.75 +if [ ".$add" = .yes -a ".$remove" = .yes ]; then 2.76 + echo "$progname:ERROR: option -a/--add and -r/--remove cannot be specified in parallel" 1>&2 2.77 + exit 1 2.78 +fi 2.79 +if [ ".$name" = . ]; then 2.80 + echo "$progname:ERROR: option --name has to be specified" 1>&2 2.81 + exit 1 2.82 +fi 2.83 +if [ ".$id" = . ]; then 2.84 + id="$l_prefix:$name" 2.85 +fi 2.86 + 2.87 + 2.88 +# find a reasonable temporary location 2.89 +if [ ".$TMPDIR" != . ]; then 2.90 + tmpdir="$TMPDIR" 2.91 +elif [ ".$TEMPDIR" != . ]; then 2.92 + tmpdir="$TEMPDIR" 2.93 +else 2.94 + tmpdir="/tmp" 2.95 +fi 2.96 +tmpfile="$tmpdir/pamtool.$$.tmp" 2.97 + 2.98 +# determine PAM information from OpenPKG configuration 2.99 +if [ ! -f "$l_prefix/etc/rc" ]; then 2.100 + echo "$progname:$ERROR: OpenPKG run-command facility not found under $l_prefix" 1>&2 2.101 + exit 1 2.102 +fi 2.103 +pam_enable=`$l_prefix/bin/openpkg rc --query pam_enable` 2.104 +pam_cfgloc=`$l_prefix/bin/openpkg rc --query pam_cfgloc` 2.105 +pam_modpfx=`$l_prefix/bin/openpkg rc --query pam_modpfx` 2.106 + 2.107 +# perform operation 2.108 +if [ ! -f "$l_prefix/lib/openpkg/rpmtool" ]; then 2.109 + echo "$progname:$ERROR: OpenPKG rpmtool not found under $l_prefix/sbin/" 1>&2 2.110 + exit 1 2.111 +fi 2.112 +rpmtool_config="$l_prefix/lib/openpkg/rpmtool config" 2.113 +if [ ".$smart" = .yes ]; then 2.114 + rpmtool_config="$rpmtool_config -s" 2.115 +fi 2.116 +if [ ".$add" = .yes ]; then 2.117 + # 2.118 + # add a PAM entry 2.119 + # 2.120 + 2.121 + # determine platform specific PAM entries 2.122 + ( case "$l_platform" in 2.123 + *-freebsd* ) 2.124 + echo "auth sufficient ${pam_modpfx}pam_opie.so no_warn no_fake_prompts" 2.125 + echo "auth requisite ${pam_modpfx}pam_opieaccess.so no_warn allow_local" 2.126 + echo "auth required ${pam_modpfx}pam_unix.so try_first_pass" 2.127 + echo "account required ${pam_modpfx}pam_unix.so" 2.128 + echo "password required ${pam_modpfx}pam_permit.so" 2.129 + echo "session required ${pam_modpfx}pam_permit.so" 2.130 + ;; 2.131 + *-linux* ) 2.132 + echo "auth required ${pam_modpfx}pam_unix_auth.so shadow nodelay" 2.133 + echo "auth required ${pam_modpfx}pam_nologin.so" 2.134 + echo "account required ${pam_modpfx}pam_unix_acct.so" 2.135 + echo "password required ${pam_modpfx}pam_unix_passwd.so shadow nullok use_authtok" 2.136 + echo "session required ${pam_modpfx}pam_unix_session.so" 2.137 + echo "session required ${pam_modpfx}pam_limits.so" 2.138 + ;; 2.139 + *-sunos* ) 2.140 + echo "auth required ${pam_modpfx}pam_unix.so try_first_pass" 2.141 + echo "account required ${pam_modpfx}pam_unix.so" 2.142 + echo "password required ${pam_modpfx}pam_unix.so" 2.143 + echo "session required ${pam_modpfx}pam_unix.so" 2.144 + ;; 2.145 + *-aix* ) 2.146 + echo "auth required ${pam_modpfx}pam_aix try_first_pass" 2.147 + echo "account required ${pam_modpfx}pam_aix" 2.148 + echo "password required ${pam_modpfx}pam_aix" 2.149 + echo "session required ${pam_modpfx}pam_aix" 2.150 + ;; 2.151 + * ) 2.152 + echo "auth required ${pam_modpfx}pam_unix.so try_first_pass" 2.153 + echo "account required ${pam_modpfx}pam_unix.so" 2.154 + echo "password required ${pam_modpfx}pam_unix.so" 2.155 + echo "session required ${pam_modpfx}pam_unix.so" 2.156 + ;; 2.157 + esac 2.158 + ) >$tmpfile 2.159 + 2.160 + # add application name prefix if using combined configuration 2.161 + if [ -f $pam_cfgloc ]; then 2.162 + sed -e "s;^;$name ;" <$tmpfile >$tmpfile.n 2.163 + mv $tmpfile.n $tmpfile 2.164 + fi 2.165 + 2.166 + # create entry 2.167 + if [ -f $pam_cfgloc ]; then 2.168 + if [ ".$verbose" = .yes ]; then 2.169 + echo "++ adding entry to $pam_cfgloc" 2.170 + fi 2.171 + $rpmtool_config -a -i $id $pam_cfgloc <$tmpfile || exit $? 2.172 + elif [ -d $pam_cfgloc ]; then 2.173 + if [ ".$verbose" = .yes ]; then 2.174 + echo "++ adding entry to $pam_cfgloc/$name" 2.175 + fi 2.176 + $rpmtool_config -a -i $id $pam_cfgloc/$name <$tmpfile || exit $? 2.177 + fi 2.178 + 2.179 +elif [ ".$remove" = .yes ]; then 2.180 + # 2.181 + # remove a PAM entry 2.182 + # 2.183 + 2.184 + # remove entry 2.185 + if [ -f $pam_cfgloc ]; then 2.186 + if [ ".$verbose" = .yes ]; then 2.187 + echo "++ removing entry from $pam_cfgloc" 2.188 + fi 2.189 + $rpmtool_config -r -i $id $pam_cfgloc || exit $? 2.190 + elif [ -d $pam_cfgloc ]; then 2.191 + if [ ".$verbose" = .yes ]; then 2.192 + echo "++ removing entry from $pam_cfgloc/$name" 2.193 + fi 2.194 + $rpmtool_config -r -i $id $pam_cfgloc/$name || exit $? 2.195 + if [ ! -s $pam_cfgloc/$name ]; then 2.196 + rm -f $pam_cfgloc/$name >/dev/null 2>&1 || true 2.197 + fi 2.198 + fi 2.199 +fi 2.200 + 2.201 +# cleanup 2.202 +rm -f $tmpfile 2.203 +exit 0 2.204 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/pam/rc.pam Sun Aug 05 22:52:01 2012 +0200 3.3 @@ -0,0 +1,19 @@ 3.4 +#!@l_prefix@/bin/openpkg rc 3.5 +## 3.6 +## rc.pam -- Run-Commands 3.7 +## 3.8 + 3.9 +%config 3.10 + pam_enable="$openpkg_rc_def" 3.11 + pam_cfgloc='@pam_cfgloc@' 3.12 + pam_modpfx='@pam_modpfx@' 3.13 + pam_incdir='@pam_incdir@' 3.14 + pam_libdir='@pam_libdir@' 3.15 + 3.16 +%info -o 3.17 + echo "PAM Enabled: ${pam_enable}" 3.18 + echo "PAM Config Location: ${pam_cfgloc}" 3.19 + echo "PAM Module Prefix: ${pam_modpfx}" 3.20 + echo "PAM Include Directory: ${pam_incdir}" 3.21 + echo "PAM Library Directory: ${pam_libdir}" 3.22 +