summaryrefslogtreecommitdiffstats
path: root/examples/chroot-setup/Solaris8
blob: 973e7310e54fd8dcf0074cc0726c0c4c344541b2 (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh

# Solaris 8 version by Matthew X. Economou. Caution: this copies
# too many files. There is no need to copy libc.so and other files
# that are already linked in before a Postfix daemon chroots itself.

COMMAND_DIRECTORY="/usr/sbin"
DAEMON_DIRECTORY="/usr/libexec/postfix"
QUEUE_DIRECTORY="/var/spool/postfix"

## Copy any shared libraries, device entries, or configuration files
## needed by Postfix into the jail.
binlist="
$DAEMON_DIRECTORY/virtual
$DAEMON_DIRECTORY/trivial-rewrite
$DAEMON_DIRECTORY/spawn
$DAEMON_DIRECTORY/smtpd
$DAEMON_DIRECTORY/smtp
$DAEMON_DIRECTORY/showq
$DAEMON_DIRECTORY/qmqpd
$DAEMON_DIRECTORY/qmgr
$DAEMON_DIRECTORY/proxymap
$DAEMON_DIRECTORY/pipe
$DAEMON_DIRECTORY/pickup
$DAEMON_DIRECTORY/nqmgr
$DAEMON_DIRECTORY/master
$DAEMON_DIRECTORY/local
$DAEMON_DIRECTORY/lmtp
$DAEMON_DIRECTORY/flush
$DAEMON_DIRECTORY/error
$DAEMON_DIRECTORY/cleanup
$DAEMON_DIRECTORY/bounce
/usr/lib/sendmail
$COMMAND_DIRECTORY/postsuper
$COMMAND_DIRECTORY/postqueue
$COMMAND_DIRECTORY/postmap
$COMMAND_DIRECTORY/postlog
$COMMAND_DIRECTORY/postlock
$COMMAND_DIRECTORY/postkick
$COMMAND_DIRECTORY/postfix
$COMMAND_DIRECTORY/postdrop
$COMMAND_DIRECTORY/postconf
$COMMAND_DIRECTORY/postcat
$COMMAND_DIRECTORY/postalias
"
ldd $binlist | awk '/[=]>/ { print $3 }' | sort -u | while read i
do
    mkdir -p $QUEUE_DIRECTORY`dirname $i`
    ## Sun's version of tar sucks.  We'll have to remove the leading
    ## slashes from file names ourself, otherwise the copy doesn't
    ## work.
    (cd / && tar cphf - `echo $i | sed -e 's/^\///'`) | (cd $QUEUE_DIRECTORY && tar xpf -)
done

## More stuff for the jail, mostly discovered by inspection
## (e.g. strings, lsof).
more="
/dev/zero
/dev/null
/dev/udp6
/dev/tcp6
/dev/udp
/dev/tcp
/dev/poll
/dev/rawip
/dev/ticlts
/dev/ticotsord
/dev/ticots
/devices/pseudo/mm@0:zero
/devices/pseudo/mm@0:null
/devices/pseudo/udp6@0:udp6
/devices/pseudo/tcp6@0:tcp6
/devices/pseudo/udp@0:udp
/devices/pseudo/tcp@0:tcp
/devices/pseudo/poll@0:poll
/devices/pseudo/icmp@0:icmp
/devices/pseudo/tl@0:ticlts
/devices/pseudo/tl@0:ticotsord
/devices/pseudo/tl@0:ticots
/etc/nsswitch.conf
/etc/netconfig
/etc/default/init
/etc/inet/services
/etc/resolv.conf
/etc/services
/usr/lib/ld.so
/usr/lib/ld.so.1
/usr/lib/sparcv9/straddr.so
/usr/lib/straddr.so
/usr/lib/libintl.so
/usr/lib/libintl.so.1
/usr/lib/libw.so
/usr/lib/libw.so.1
/usr/lib/nss_nis.so.1
/usr/lib/nss_nisplus.so.1
/usr/lib/nss_dns.so.1
/usr/lib/nss_files.so.1
/usr/share/lib/zoneinfo
/var/ld/ld.config
"
for i in $more; do
    mkdir -p $QUEUE_DIRECTORY`dirname $i`
    (cd / && tar cpf - `echo $i | sed -e 's/^\///'`) | (cd $QUEUE_DIRECTORY && tar xpf -)
done

exit 0