[Bug 456182] Review Request: rssh - Restricted shell for use with OpenSSH, allowing only scp and/or sftp

bugzilla at redhat.com bugzilla at redhat.com
Thu Aug 7 05:07:43 UTC 2008


Please do not reply directly to this email. All additional
comments should be made in the comments box of this bug.


https://bugzilla.redhat.com/show_bug.cgi?id=456182





--- Comment #5 from Debarshi Ray <debarshi.ray at gmail.com>  2008-08-07 01:07:42 EDT ---
(In reply to comment #4)

+ You are not removing rssh from /etc/shell on removal of the package. It
should be removed in %postun.

Here is how bash does it:

%post

HASBASH=""
HASSH=""

if [ ! -f /etc/shells ]; then
  > /etc/shells
fi

(while read line ; do
  if [ "$line" = "/bin/bash" ]; then
    HASBASH=1
  elif [ "$line" = "/bin/sh" ]; then
    HASSH=1
  fi
 done

 if [ -z "$HASBASH" ]; then
  echo "/bin/bash" >> /etc/shells
 fi
 if [ -z "$HASSH" ]; then
  echo "/bin/sh" >> /etc/shells
fi) < /etc/shells

%postun
if [ "$1" = 0 ]; then
    /bin/grep -v '^/bin/bash$' < /etc/shells | \
      /bin/grep -v '^/bin/sh$' > /etc/shells.new
    /bin/mv /etc/shells.new /etc/shells
fi

Here is how tcsh does it:

%post
if [ ! -f /etc/shells ]; then
 echo "%{_bindir}/tcsh" >> /etc/shells
 echo "%{_bindir}/csh"  >> /etc/shells
else
 grep -q '^%{_bindir}/tcsh$' /etc/shells || \
 echo "%{_bindir}/tcsh" >> /etc/shells
 grep -q '^%{_bindir}/csh$'  /etc/shells || \
 echo "%{_bindir}/csh"  >> /etc/shells
fi

%postun
if [ ! -x %{_bindir}/tcsh ]; then
 grep -v '^%{_bindir}/tcsh$'  /etc/shells | \
 grep -v '^%{_bindir}/csh$' > /etc/shells.rpm
 cat /etc/shells.rpm > /etc/shells && rm /etc/shells.rpm
fi

Use whichever one you like. Personally, I like the latter. Looks more readable.
:-)

-- 
Configure bugmail: https://bugzilla.redhat.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.




More information about the Fedora-package-review mailing list