summaryrefslogtreecommitdiff
path: root/gnu/dist/postfix/examples/chroot-setup
diff options
context:
space:
mode:
authoritojun <itojun@NetBSD.org>2001-03-13 17:45:02 +0000
committeritojun <itojun@NetBSD.org>2001-03-13 17:45:02 +0000
commit173b2f6655e38657f15bb57fe26dc23e8d054d4e (patch)
tree04af30df8438e7c54ceb4e5f4bf0dff83788ce54 /gnu/dist/postfix/examples/chroot-setup
parentc7871f80bf97592f2ca4dd16d6d7708bec2c33a2 (diff)
postfix release-20010228
Diffstat (limited to 'gnu/dist/postfix/examples/chroot-setup')
-rw-r--r--gnu/dist/postfix/examples/chroot-setup/AIX421
-rw-r--r--gnu/dist/postfix/examples/chroot-setup/BSDI21
-rw-r--r--gnu/dist/postfix/examples/chroot-setup/BSDI31
-rw-r--r--gnu/dist/postfix/examples/chroot-setup/FREEBSD31
-rw-r--r--gnu/dist/postfix/examples/chroot-setup/FreeBSD21
-rw-r--r--gnu/dist/postfix/examples/chroot-setup/LINUX286
-rw-r--r--gnu/dist/postfix/examples/chroot-setup/NETBSD11
-rw-r--r--gnu/dist/postfix/examples/chroot-setup/Solaris21
8 files changed, 83 insertions, 10 deletions
diff --git a/gnu/dist/postfix/examples/chroot-setup/AIX42 b/gnu/dist/postfix/examples/chroot-setup/AIX42
index 4562d4809a9..41f15b5361d 100644
--- a/gnu/dist/postfix/examples/chroot-setup/AIX42
+++ b/gnu/dist/postfix/examples/chroot-setup/AIX42
@@ -1,3 +1,4 @@
+umask 022
mkdir /var/spool/postfix/etc
chmod 755 /var/spool/postfix/etc
for i in /etc/environment /etc/netsvc.conf /etc/localtime
diff --git a/gnu/dist/postfix/examples/chroot-setup/BSDI2 b/gnu/dist/postfix/examples/chroot-setup/BSDI2
index c3be0213211..9d7f020db8d 100644
--- a/gnu/dist/postfix/examples/chroot-setup/BSDI2
+++ b/gnu/dist/postfix/examples/chroot-setup/BSDI2
@@ -1,3 +1,4 @@
+umask 022
mkdir /var/spool/postfix/etc
chmod 755 /var/spool/postfix/etc
cp /etc/localtime /etc/services /etc/resolv.conf /var/spool/postfix/etc
diff --git a/gnu/dist/postfix/examples/chroot-setup/BSDI3 b/gnu/dist/postfix/examples/chroot-setup/BSDI3
index c3be0213211..9d7f020db8d 100644
--- a/gnu/dist/postfix/examples/chroot-setup/BSDI3
+++ b/gnu/dist/postfix/examples/chroot-setup/BSDI3
@@ -1,3 +1,4 @@
+umask 022
mkdir /var/spool/postfix/etc
chmod 755 /var/spool/postfix/etc
cp /etc/localtime /etc/services /etc/resolv.conf /var/spool/postfix/etc
diff --git a/gnu/dist/postfix/examples/chroot-setup/FREEBSD3 b/gnu/dist/postfix/examples/chroot-setup/FREEBSD3
index 5c81341ac5b..4afb0eb63f5 100644
--- a/gnu/dist/postfix/examples/chroot-setup/FREEBSD3
+++ b/gnu/dist/postfix/examples/chroot-setup/FREEBSD3
@@ -1,3 +1,4 @@
+umask 022
mkdir /var/spool/postfix/etc
chmod 755 /var/spool/postfix/etc
cd /etc ; cp host.conf localtime services resolv.conf /var/spool/postfix/etc
diff --git a/gnu/dist/postfix/examples/chroot-setup/FreeBSD2 b/gnu/dist/postfix/examples/chroot-setup/FreeBSD2
index 5c81341ac5b..4afb0eb63f5 100644
--- a/gnu/dist/postfix/examples/chroot-setup/FreeBSD2
+++ b/gnu/dist/postfix/examples/chroot-setup/FreeBSD2
@@ -1,3 +1,4 @@
+umask 022
mkdir /var/spool/postfix/etc
chmod 755 /var/spool/postfix/etc
cd /etc ; cp host.conf localtime services resolv.conf /var/spool/postfix/etc
diff --git a/gnu/dist/postfix/examples/chroot-setup/LINUX2 b/gnu/dist/postfix/examples/chroot-setup/LINUX2
index e6b18024641..f65f12d9010 100644
--- a/gnu/dist/postfix/examples/chroot-setup/LINUX2
+++ b/gnu/dist/postfix/examples/chroot-setup/LINUX2
@@ -1,18 +1,84 @@
-# Setup chroot jail for Linux
+#! /bin/sh
+
+# LINUX2 - shell script to set up a Postfix chroot jail for Linux
+# Tested on SuSE Linux 5.3 (libc5) and 7.0 (glibc2.1)
+
+# Other testers reported as working:
+#
+# 2001-01-15 Debian sid (unstable)
+# Christian Kurz <shorty@getuid.de>
+
+# Copyright (c) 2000 - 2001 by Matthias Andree
+# Redistributable unter the MIT-style license that follows:
+# Abstract: "do whatever you want except hold somebody liable or change
+# the copyright information".
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+# 2000-09-29
+# v0.1: initial release
+
+# 2000-12-05
+# v0.2: copy libdb.* for libnss_db.so
+# remove /etc/localtime in case it's a broken symlink
+# restrict find to maxdepth 1 (faster)
+
+# Log: LINUX2,v
+# Revision 1.4 2001/01/15 09:36:35 emma
+# add note it was successfully tested on Debian sid
+#
+
+CP="cp -p"
+
+cond_copy() {
+ # find files as per pattern in $1
+ # if any, copy to directory $2
+ dir=`dirname "$1"`
+ pat=`basename "$1"`
+ lr=`find "$dir" -maxdepth 1 -name "$pat"`
+ if test ! -d "$2" ; then exit 1 ; fi
+ if test "x$lr" != "x" ; then $CP $1 "$2" ; fi
+}
set -e
umask 022
POSTFIX_DIR=${POSTFIX_DIR-/var/spool/postfix}
-
cd ${POSTFIX_DIR}
-mkdir etc
-cp /etc/localtime /etc/services /etc/resolv.conf etc
-mkdir -p usr/lib/zoneinfo
-ln -s /etc/localtime usr/lib/zoneinfo
+mkdir -p etc lib usr/lib/zoneinfo
+
+# find localtime (SuSE 5.3 does not have /etc/localtime)
+lt=/etc/localtime
+if test ! -f $lt ; then lt=/usr/lib/zoneinfo/localtime ; fi
+if test ! -f $lt ; then lt=/usr/share/zoneinfo/localtime ; fi
+if test ! -f $lt ; then echo "cannot find localtime" ; exit 1 ; fi
+rm -f etc/localtime
+
+# copy localtime and some other system files into the chroot's etc
+$CP -f $lt /etc/services /etc/resolv.conf /etc/nsswitch.conf etc
+$CP -f /etc/host.conf /etc/hosts /etc/passwd etc
+ln -s -f /etc/localtime usr/lib/zoneinfo
+
+# copy required libraries into the chroot
+cond_copy '/lib/libnss_*.so*' lib
+cond_copy '/lib/libresolv.so*' lib
+cond_copy '/lib/libdb.so*' lib
-if [ -e /lib/libnss_dns.so.1 ]; then
- mkdir lib
- cp /lib/libnss_dns.so.1 lib
-fi
+postfix reload
diff --git a/gnu/dist/postfix/examples/chroot-setup/NETBSD1 b/gnu/dist/postfix/examples/chroot-setup/NETBSD1
index 53407678764..53a23611643 100644
--- a/gnu/dist/postfix/examples/chroot-setup/NETBSD1
+++ b/gnu/dist/postfix/examples/chroot-setup/NETBSD1
@@ -1,3 +1,4 @@
+umask 022
mkdir /var/spool/postfix/etc
chmod 755 /var/spool/postfix/etc
cd /etc ; cp localtime services resolv.conf /var/spool/postfix/etc
diff --git a/gnu/dist/postfix/examples/chroot-setup/Solaris2 b/gnu/dist/postfix/examples/chroot-setup/Solaris2
index 9aca6d1f781..2508f73abcf 100644
--- a/gnu/dist/postfix/examples/chroot-setup/Solaris2
+++ b/gnu/dist/postfix/examples/chroot-setup/Solaris2
@@ -1,5 +1,6 @@
#!/bin/sh
+umask 022
PATH=/usr/bin:/sbin:/usr/sbin
# Create chroot'd area under Solaris 2.5.1 for postfix.