Blob Blame History Raw
diff -Naur libreswan-3.15-orig/programs/barf/barf.in libreswan-3.15/programs/barf/barf.in
--- libreswan-3.15-orig/programs/barf/barf.in	2015-08-24 22:28:32.000000000 -0400
+++ libreswan-3.15/programs/barf/barf.in	2016-09-04 23:25:03.457442558 -0400
@@ -97,22 +97,25 @@
 	findlog_startline=1		# arbitrary
 }
 
-# try to guess where logs are
-findlog "$fstart" "klips" messages syslog auth.log daemon.log
-if test " $findlog_file" = " /dev/null"
+if test ! -x /usr/bin/journalctl
 then
-echo "Unable to find KLIPS messages, typically found in /var/log/messages or equivalent. You may need to run Libreswan for the first time; alternatively, your log files have been emptied (ie, logwatch) or we do not understand your logging configuration."
-fi
-klog=$findlog_file
-kline=$findlog_startline
+	# no systemd, need to figure out log file location
+	findlog "$fstart" "klips" messages syslog auth.log daemon.log
+	if test " $findlog_file" = " /dev/null"
+	then
+	echo "Unable to find KLIPS messages, typically found in /var/log/messages or equivalent. You may need to run Libreswan for the first time; alternatively, your log files have been emptied (ie, logwatch) or we do not understand your logging configuration."
+	fi
+	klog=$findlog_file
+	kline=$findlog_startline
 
-findlog "$pstart" "Pluto" secure auth.log daemon.log debug
-if test " $findlog_file" = " /dev/null"
-then
-echo "Unable to find Pluto messages, typically found in /var/log/secure or equivalent. You may need to run Libreswan for the first time; alternatively, your log files have been emptied (ie, logwatch) or we do not understand your logging configuration."
+	findlog "$pstart" "Pluto" secure auth.log daemon.log debug
+	if test " $findlog_file" = " /dev/null"
+	then
+	echo "Unable to find Pluto messages, typically found in /var/log/secure or equivalent. You may need to run Libreswan for the first time; alternatively, your log files have been emptied (ie, logwatch) or we do not understand your logging configuration."
+	fi
+	plog=$findlog_file
+	pline=$findlog_startline
 fi
-plog=$findlog_file
-pline=$findlog_startline
 
 # /lib/modules examiner
 modulegoo() {
@@ -394,18 +397,22 @@
 	tail -100 $LOGS/kern.debug
 fi
 _________________________ klog
-sed -n $kline,'$'p $klog |
-	egrep -i 'ipsec|klips|pluto' |
-	case "$1" in
-	--short)	tail -500	;;
-	*)		cat		;;
-	esac
+dmesg | egrep -i "klips|ipsec"
 _________________________ plog
-sed -n $pline,'$'p $plog |
-	egrep -i 'pluto' |
-	case "$1" in
-	--short)	tail -500	;;
-	*)		cat		;;
-	esac
+if test -x /usr/bin/journalctl
+then
+	journalctl -u ipsec.service --no-pager --since "1 hour ago" |
+		case "$1" in
+		--short)	tail -500	;;
+		*)		cat		;;
+		esac
+else
+	sed -n $pline,'$'p $plog |
+		egrep -i 'pluto' |
+		case "$1" in
+		--short)	tail -500	;;
+		*)		cat		;;
+		esac
+fi
 _________________________ date
 date
diff -Naur libreswan-3.15-orig/programs/barf/ipsec_barf.8.xml libreswan-3.15/programs/barf/ipsec_barf.8.xml
--- libreswan-3.15-orig/programs/barf/ipsec_barf.8.xml	2015-08-24 22:28:32.000000000 -0400
+++ libreswan-3.15/programs/barf/ipsec_barf.8.xml	2016-09-04 23:22:39.743238821 -0400
@@ -9,7 +9,7 @@
 <refmeta>
 <refentrytitle>IPSEC_BARF</refentrytitle>
 <manvolnum>8</manvolnum>
-<refmiscinfo class='date'>17 March 2002</refmiscinfo>
+<refmiscinfo class='date'>4 September 2016</refmiscinfo>
 <refmiscinfo class="source">libreswan</refmiscinfo>
 <refmiscinfo class="manual">Executable programs</refmiscinfo>
 </refmeta>
@@ -50,6 +50,12 @@
 currently netstat -rn.  Useful on boxes where the routing
 table is thousands of lines long.  Default is 100.</para>
 
+<para>On systems with systemd, ipsec barf will look for logs
+using the journalctl command.</para>
+
+<para>If the logfile= option is used, logs will also not be found
+by the ipsec barf command.</para>
+
 <para><emphasis remap='I'>Barf</emphasis>
 censors its output,
 replacing keys