Fw: [FreeBSD-rc] mktemp patch
Mike Makonnen
mtm at identd.net
Sun Jun 22 22:19:22 PDT 2003
Hello folks,
I don't see any problems with this patch, but I thought I would pass it by this
list, since it affects the periodic security scripts. Is there any reason we
should specify the template manually instead of using the -t argument to
mktemp(1) ?
Begin forwarded message:
Date: Sat, 21 Jun 2003 10:34:16 -0700
From: Lars Eggert <larse at isi.edu>
To: FreeBSD-rc at yahoogroups.com
Subject: [FreeBSD-rc] mktemp patch
Hi,
the attached patch replaces explicit templates with mktemp's -t switch.
Lars
--
Lars Eggert <larse at isi.edu> USC Information Sciences Institute
--
Mike Makonnen | GPG-KEY: http://www.identd.net/~mtm/mtm.asc
mtm at identd.net | D228 1A6F C64E 120A A1C9 A3AA DAE1 E2AF DBCC 68B9
mtm at FreeBSD.Org| FreeBSD - The Power To Serve
-------------- next part --------------
Hi,
the attached patch replaces explicit templates with mktemp's -t switch.
Lars
--
Lars Eggert <larse at isi.edu> USC Information Sciences Institute
-------------- next part --------------
Index: periodic/security/500.ipfwdenied
===================================================================
RCS file: /home/xbone/CVSROOT/FreeBSD-CURRENT-etc/periodic/security/500.ipfwdenied,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 500.ipfwdenied
--- periodic/security/500.ipfwdenied 26 Oct 2002 20:49:08 -0000 1.1.1.3
+++ periodic/security/500.ipfwdenied 21 Jun 2003 16:20:51 -0000
@@ -41,7 +41,7 @@
case "$daily_status_security_ipfwdenied_enable" in
[Yy][Ee][Ss])
- TMP=`mktemp ${TMPDIR:-/tmp}/security.XXXXXXXXXX`
+ TMP=`mktemp -t security`
if ipfw -a l 2>/dev/null | egrep "deny|reset|unreach" > ${TMP}; then
check_diff new_only ipfw ${TMP} "${host} ipfw denied packets:"
fi
Index: periodic/security/510.ipfdenied
===================================================================
RCS file: /home/xbone/CVSROOT/FreeBSD-CURRENT-etc/periodic/security/510.ipfdenied,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 510.ipfdenied
--- periodic/security/510.ipfdenied 26 Oct 2002 20:49:08 -0000 1.1.1.1
+++ periodic/security/510.ipfdenied 21 Jun 2003 16:21:10 -0000
@@ -41,7 +41,7 @@
case "$daily_status_security_ipfdenied_enable" in
[Yy][Ee][Ss])
- TMP=`mktemp ${TMPDIR:-/tmp}/security.XXXXXXXXXX`
+ TMP=`mktemp -t security`
if ipfstat -nhio 2>/dev/null | grep block > ${TMP}; then
check_diff new_only ipf ${TMP} "${host} ipf denied packets:"
fi
Index: periodic/security/550.ipfwlimit
===================================================================
RCS file: /home/xbone/CVSROOT/FreeBSD-CURRENT-etc/periodic/security/550.ipfwlimit,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 550.ipfwlimit
--- periodic/security/550.ipfwlimit 9 Dec 2002 18:02:54 -0000 1.1.1.3
+++ periodic/security/550.ipfwlimit 21 Jun 2003 16:19:56 -0000
@@ -42,7 +42,7 @@
case "$daily_status_security_ipfwlimit_enable" in
[Yy][Ee][Ss])
- TMP=`mktemp ${TMPDIR:-/tmp}/security.XXXXXXXXXX`
+ TMP=`mktemp -t security`
IPFW_LOG_LIMIT=`sysctl -n net.inet.ip.fw.verbose_limit 2> /dev/null`
if [ $? -eq 0 ] && [ "${IPFW_LOG_LIMIT}" -ne 0 ]; then
ipfw -a l | grep " log " | \
Index: periodic/security/600.ip6fwdenied
===================================================================
RCS file: /home/xbone/CVSROOT/FreeBSD-CURRENT-etc/periodic/security/600.ip6fwdenied,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 600.ip6fwdenied
--- periodic/security/600.ip6fwdenied 26 Oct 2002 20:49:10 -0000 1.1.1.3
+++ periodic/security/600.ip6fwdenied 21 Jun 2003 16:21:29 -0000
@@ -41,7 +41,7 @@
case "$daily_status_security_ip6fwdenied_enable" in
[Yy][Ee][Ss])
- TMP=`mktemp ${TMPDIR:-/tmp}/security.XXXXXXXXXX`
+ TMP=`mktemp -t security`
if ip6fw -a l 2>/dev/null | egrep "deny|reset|unreach" > ${TMP}; then
check_diff new_only ip6fw ${TMP} "${host} ip6fw denied packets:"
fi
Index: periodic/security/650.ip6fwlimit
===================================================================
RCS file: /home/xbone/CVSROOT/FreeBSD-CURRENT-etc/periodic/security/650.ip6fwlimit,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 650.ip6fwlimit
--- periodic/security/650.ip6fwlimit 9 Dec 2002 18:02:55 -0000 1.1.1.3
+++ periodic/security/650.ip6fwlimit 21 Jun 2003 16:20:14 -0000
@@ -42,7 +42,7 @@
case "$daily_status_security_ip6fwlimit_enable" in
[Yy][Ee][Ss])
- TMP=`mktemp ${TMPDIR:-/tmp}/security.XXXXXXXXXX`
+ TMP=`mktemp -t security`
IP6FW_LOG_LIMIT=`sysctl -n net.inet6.ip6.fw.verbose_limit 2> /dev/null`
if [ $? -eq 0 ] && [ "${IP6FW_LOG_LIMIT}" -ne 0 ]; then
ip6fw -a l | grep " log " | \
Index: periodic/security/security.functions
===================================================================
RCS file: /home/xbone/CVSROOT/FreeBSD-CURRENT-etc/periodic/security/security.functions,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 security.functions
--- periodic/security/security.functions 25 Nov 2002 16:50:15 -0000 1.1.1.2
+++ periodic/security/security.functions 21 Jun 2003 16:20:33 -0000
@@ -52,7 +52,7 @@
msg="$1"; shift
if [ "${tmpf}" = "-" ]; then
- tmpf=`mktemp ${TMPDIR:-/tmp}/security.XXXXXXXXXX`
+ tmpf=`mktemp -t security`
cat > ${tmpf}
fi
Index: rc.d/motd
===================================================================
RCS file: /home/xbone/CVSROOT/FreeBSD-CURRENT-etc/rc.d/motd,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 motd
--- rc.d/motd 29 Apr 2003 23:34:44 -0000 1.1.1.2
+++ rc.d/motd 21 Jun 2003 16:17:46 -0000
@@ -38,7 +38,7 @@
case ${OSTYPE} in
FreeBSD)
- T=`mktemp /tmp/_motd.XXXXXX`
+ T=`mktemp -t motd`
uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T}
;;
More information about the freebsd-audit
mailing list