diff --git a/bkctld b/bkctld index ed486d0..362315e 100755 --- a/bkctld +++ b/bkctld @@ -157,9 +157,11 @@ mk_jail() { passwd="${TPLDIR}/passwd" shadow="${TPLDIR}/shadow" group="${TPLDIR}/group" + sshrc="${TPLDIR}/sshrc" [ -f "${LOCALTPLDIR}/passwd" ] && passwd="${LOCALTPLDIR}/passwd" [ -f "${LOCALTPLDIR}/shadow" ] && shadow="${LOCALTPLDIR}/shadow" [ -f "${LOCALTPLDIR}/group" ] && group="${LOCALTPLDIR}/group" + [ -f "${LOCALTPLDIR}/sshrc" ] && group="${LOCALTPLDIR}/sshrc" umask 077 echo "1 - Creating the chroot" @@ -181,12 +183,13 @@ mk_jail() { cp "$passwd" etc cp "$shadow" etc cp "$group" etc + cp "$sshrc" etc/ssh echo "3 - Copying binaries" cp -f /lib/ld-linux.so.2 lib 2>/dev/null || cp -f /lib64/ld-linux-x86-64.so.2 lib64 cp /lib/x86_64-linux-gnu/libnss* lib/x86_64-linux-gnu - for dbin in /bin/sh /bin/ls /bin/mkdir /bin/cat /bin/rm /bin/sed /usr/bin/rsync /usr/sbin/sshd /usr/lib/openssh/sftp-server; do + for dbin in /bin/sh /bin/ls /bin/mkdir /bin/cat /bin/rm /bin/sed /usr/bin/rsync /usr/bin/lastlog /usr/sbin/sshd /usr/lib/openssh/sftp-server; do cp -f $dbin ${JAILDIR}/${jail}/$dbin; for lib in $(ldd $dbin | grep -Eo "/.*so.[0-9\.]+"); do cp -p $lib ${JAILDIR}/${jail}/$lib diff --git a/tpl/sshrc b/tpl/sshrc new file mode 100644 index 0000000..1fea72d --- /dev/null +++ b/tpl/sshrc @@ -0,0 +1,2 @@ +#!/bin/sh +/usr/bin/lastlog -Su root