ports/129453: jailaudit does not work since jail supporting multiple address.

KOIE Hidetaka hide at koie.org
Sat Dec 6 05:10:02 UTC 2008


>Number:         129453
>Category:       ports
>Synopsis:       jailaudit does not work since jail supporting multiple address.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 06 05:10:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     KOIE Hidetaka
>Release:        8.0-CURRENT
>Organization:
surigiken
>Environment:
FreeBSD guriandgura 8.0-CURRENT FreeBSD 8.0-CURRENT #2: Thu Dec  4 19:51:12 JST 2008     koie at guriandgura:/usr/obj/usr/src/sys/GURIANDGURA  amd64
>Description:
jailaudit fails.
daily security run output:

cat: /usr/local/jailaudit/tmp/_jailaudit_allports: No such file or directory
jexec: Unable to parse jail ID.: Invalid argument
jexec: Could not uniquely identify the jail.


>How-To-Repeat:

>Fix:
jls should be able to output one jail per line for script friendliness.


Patch attached with submission follows:

diff -pu jailaudit-1.2/jailaudit jailaudit-1.2-koie/jailaudit
--- jailaudit-1.2/jailaudit	2006-05-04 22:30:44.000000000 +0900
+++ jailaudit-1.2-koie/jailaudit	2008-12-06 13:58:08.200948487 +0900
@@ -2,6 +2,23 @@
 # copyright Philipp Wuensche
 # License: beer ware (http://en.wikipedia.org/wiki/Beerware)
 
+JLS() {
+	/usr/sbin/jls | awk '
+$1 == "JID" { next }
+$1 == "IP" { next }
+$1 ~ /[1-9][0-9]*/ && $3 ~ /^\// {
+    report = $1 " " $2 " " $3
+    next
+}
+{
+    sub(/^  */, "")
+    report = report " " $0
+    print report
+    next
+}
+'
+}
+
 if [ ! -f /usr/local/sbin/portaudit ]; then
     echo "Error: `basename $0 ` depends on portaudit"
     exit
@@ -52,7 +69,7 @@ if [ "X${action}" = "Xgenerate" ]; then
     rm -rf ${audit_path}/*
     rm -f ${tmp_path}/_jailaudit_allports
 
-    for jpath in `/usr/sbin/jls |grep -v JID|awk '{print $4}'`; do
+    for jpath in `JLS|awk '{print $4}'`; do
         ls -1 $jpath/var/db/pkg/ >> ${tmp_path}/_jailaudit_allports 2> /dev/null
     done
 
@@ -60,7 +77,7 @@ if [ "X${action}" = "Xgenerate" ]; then
         /usr/local/sbin/portaudit $portname > ${tmp_path}/_$portname 2> /dev/null
     done
 
-    for jid in `/usr/sbin/jls |grep -v JID|awk '{print $1}'`; do
+    for jid in `JLS|awk '{print $1}'`; do
         pcount=0
         for portname in `jexec $jid ls -1 /var/db/pkg/`; do
             if [ -f ${tmp_path}/_${portname} ]; then
@@ -74,7 +91,7 @@ if [ "X${action}" = "Xgenerate" ]; then
     done
 
     cd $audit_path
-    /usr/sbin/jls | grep -v JID | awk '{print $1" "$3"_"$1}' | xargs -n2 mv
+    JLS | awk '{print $1" "$3"_"$1}' | xargs -n2 mv
     rm -rf ${tmp_path}/*
     exit
 fi


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list