File pam_sessionrun.spec of Package pam_sessionrun

#
# spec file for package pam_sessionrun
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

#norootforbuild

Name:           pam_sessionrun
Version:        0.1
Release:        1
License:        GPL
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  pam-devel
Group:          Security
Source0: pam_sessionrun-0.1.tar.gz
Source1: login_script
Source2: logout_script
Summary:        pam_sessionrun package

%description
This module is aimed at environments wanting to enforce a script being ran at
start and/or end of a session.  This can be used for setting permissions,
mounting volumes, or anything else that you can think of.  Some general
features:

  o A stop and/or a start script can be provided.

  o The script is provided the password and the username of the person logging
    in.  This could be used for caching the person's password for mounting
    volumes, etc.

  o Completely transparent to the user.

%prep

%build
cd $RPM_BUILD_ROOT
tar xvfz %{SOURCE0}
cd pam_sessionrun-0.1
./configure
make

%install
mkdir -p $RPM_BUILD_ROOT/lib/security
cd $RPM_BUILD_ROOT/pam_sessionrun-0.1
cp pam_sessionrun.so ../lib/security
mkdir -p $RPM_BUILD_ROOT/usr/share/doc/packages/pam_sessionrun
cp README $RPM_BUILD_ROOT/usr/share/doc/packages/pam_sessionrun/
cp NEWS $RPM_BUILD_ROOT/usr/share/doc/packages/pam_sessionrun/
cp INSTALL $RPM_BUILD_ROOT/usr/share/doc/packages/pam_sessionrun/
cp AUTHORS $RPM_BUILD_ROOT/usr/share/doc/packages/pam_sessionrun/
cp ChangeLog $RPM_BUILD_ROOT/usr/share/doc/packages/pam_sessionrun/
cp COPYING $RPM_BUILD_ROOT/usr/share/doc/packages/pam_sessionrun/
mkdir -p $RPM_BUILD_ROOT/etc/security
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/security/
cp %{SOURCE2} $RPM_BUILD_ROOT/etc/security/
cd $RPM_BUILD_ROOT

rm -rf pam_sessionrun-0.1
echo << EOF
To use, simply open the PAM file for the service you are interested in using
(/etc/pam.d/SERVICENAME):

And insert something like:

auth optional pam_sessionrun.so use_first_pass

at the end of the auth section, and at the end of the session section:

session optional pam_sessionrun.so start=/etc/security/login_script stop=/etc/security/logout_script
EOF
ls -l

%clean
rm -rf "$RPM_BUILD_ROOT"

%files
%defattr(-,root,root)

/lib/security/pam_sessionrun.so
/usr/share/doc/packages/pam_sessionrun
%config /etc/security/login_script
%config /etc/security/logout_script

%post
cat <<EOF

################################################################################
To use, simply open the PAM file for the service you are interested in using
(/etc/pam.d/SERVICENAME):

And insert something like:

auth optional pam_sessionrun.so use_first_pass

at the end of the auth section, and at the end of the session section:

session optional pam_sessionrun.so start=/etc/security/login_script stop=/etc/security/logout_script

################################################################################
EOF

openSUSE Build Service is sponsored by