File: smtpd-setup-chroot

package info (click to toggle)
smtpd 2.0-8.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 432 kB
  • ctags: 298
  • sloc: ansic: 4,164; makefile: 121; sh: 90
file content (35 lines) | stat: -rw-r--r-- 805 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

# smtpd-setup-chroot	version 1.0
# Copyright John Lines <john@paladin.demon.co.uk> 2004-08-31
# License: Gnu Public License

#
# Sets up the chroot jail for smtpd
#

CHROOTDIR=/var/spool/smtpd

if [ -r /etc/resolv.conf ] ; then
    /bin/cp -f /etc/resolv.conf $CHROOTDIR/etc/resolv.conf
      else
    echo "# No /etc/resolv.conf to copy - set up resolvers here" >/var/spool/smtpd/etc/resolv.conf
 fi

/bin/cp -f /etc/localtime $CHROOTDIR/etc/localtime

# Find the files used by smtpd, and copy them into the chroot under lib

for libfile in $(ldd /usr/sbin/smtpd | cut -d ' ' -f 3); do
  /bin/cp -f -L $libfile $CHROOTDIR/lib
 done

#  We also need some dynamically loaded files

/bin/cp -f -L /lib/libnss_files.so.2 $CHROOTDIR/lib
/bin/cp -f -L /lib/libnss_dns.so.2 $CHROOTDIR/lib

exit 0