[PC-BSD Commits] r4583 - pcbsd/trunk/system-overlay/usr/PCBSD/portjail

svn at pcbsd.org svn at pcbsd.org
Fri Oct 2 02:44:39 PDT 2009


Author: kris
Date: 2009-10-02 09:44:39 +0000 (Fri, 02 Oct 2009)
New Revision: 4583

Modified:
   pcbsd/trunk/system-overlay/usr/PCBSD/portjail/portjail.sh
Log:

Updated portjail start / stop script, to fix some warnings on the console from jail's sendmail hostingname
not being set



Modified: pcbsd/trunk/system-overlay/usr/PCBSD/portjail/portjail.sh
===================================================================
--- pcbsd/trunk/system-overlay/usr/PCBSD/portjail/portjail.sh	2009-10-02 08:39:18 UTC (rev 4582)
+++ pcbsd/trunk/system-overlay/usr/PCBSD/portjail/portjail.sh	2009-10-02 09:44:39 UTC (rev 4583)
@@ -30,8 +30,10 @@
   
 
   # Configure NAT with PF
-  cat /etc/pf.conf | grep -v "from lo1:network to any" > /etc/.pftmp.conf
-  mv /etc/.pftmp.conf /etc/pf.conf
+  TMPFILE=`mktemp /tmp/.pf-tmp.XXXXXX`
+  cat /etc/pf.conf | grep -v "from lo1:network to any" > ${TMPFILE}
+  mv ${TMPFILE} /etc/pf.conf
+  chmod 644 /etc/pf.conf
 
   echo "scrub in all" >/etc/.pflo1tmp
   TMPIF=`ifconfig -l`
@@ -54,10 +56,19 @@
     rm ${PJDIR}/etc/rc.d/cleartmp
   fi
 
+  # Add the hostname to the portjails /etc/hosts file, to prevent sendmail warnings
+  TMPFILE=`mktemp /tmp/.hosts-tmp.XXXXXX`
+  cat ${PJDIR}/etc/hosts | grep -v "127.0.0.1" > ${TMPFILE}
+  echo "127.0.0.1               localhost localhost.my.domain ${PJHOST}" >> ${TMPFILE}
+  mv ${TMPFILE} ${PJDIR}/etc/hosts
+  chmod 644 ${PJDIR}/etc/hosts
+
   # Make sure the /etc/rc.conf HOSTNAME values match
-  cat ${PJDIR}/etc/rc.conf | grep -v "hostname=" > ${PJDIR}/etc/.rc.conf.tmp
-  echo "hostname=\"$PJHOST\"" >> ${PJDIR}/etc/.rc.conf.tmp
-  mv ${PJDIR}/etc/.rc.conf.tmp ${PJDIR}/etc/rc.conf
+  TMPFILE=`mktemp /tmp/.rc-tmp.XXXXXX`
+  cat ${PJDIR}/etc/rc.conf | grep -v "hostname=" > ${TMPFILE}
+  echo "hostname=\"$PJHOST\"" >> ${TMPFILE}
+  mv ${TMPFILE} ${PJDIR}/etc/rc.conf
+  chmod 644 ${PJDIR}/etc/rc.conf
 
   mount_nullfs /tmp ${PJDIR}/tmp
   mount_nullfs /usr/home ${PJDIR}/usr/home
@@ -77,6 +88,12 @@
   umount ${PJDIR}/usr/home
   ifconfig lo1 destroy
 
+  # Cleanup /etc/pf.conf
+  TMPFILE=`mktemp /tmp/.pf-tmp.XXXXXX`
+  cat /etc/pf.conf | grep -v "from lo1:network to any" > $TMPFILE
+  mv $TMPFILE /etc/pf.conf
+  chmod 644 /etc/pf.conf
+
 elif [ "$1" = "console" ]
 then
   DBUS_SESSION_BUS_ADDRESS="" ; export DBUS_SESSION_BUS_ADDRESS



More information about the Commits mailing list