Call for configs
Armin Wolfermann
aw at osn.de
Tue Aug 28 13:00:28 CEST 2012
Hi Andreas,
this is a diff to make it work with POSIX tools (tested on OpenBSD) and
adding more anonymization (notes_url and comments):
--- nagios-anonymizer.sh Tue Aug 28 12:03:11 2012
+++ nagios-anonymizer-portable.sh Tue Aug 28 12:33:09 2012
@@ -32,11 +32,11 @@
sed -n "s/^Processing object config file '\([^']*\)'.*/\1/p" vs-output > oconf-files
echo "Concatenating and minimizing object config"
-sed 's/^[\t ]*//' $(cat oconf-files) > objects.cfg
+sed 's/^[[:space:]]*//' $(cat oconf-files) > temp.cfg
echo "Anonymizing..."
-sed -i \
- -e 's/^address[\t ].*/address ANON/' \
+sed \
+ -e 's/^address[[:space:]].*/address ANON/' \
-e 's/^email.*/email ANON/' \
-e 's/^pager.*/pager ANON/' \
-e 's/address[1-7].*/address ANON/' \
@@ -45,7 +45,9 @@
-e 's/^\(host_notification_commands\).*/\1 host-notifyANONYMIZED/' \
-e 's/^\(service_notification_commands\).*/\1 service-notifyANONYMIZED/' \
-e 's/^\(command_line\).*/command_line ANONYMIZED/' \
- objects.cfg
+ -e 's/^notes_url.*/notes_url ANON/' \
+ -e 's/^#.*//' \
+ temp.cfg > objects.cfg
c=$(grep -c ANON objects.cfg)
echo "Anonymized $c strings"
@@ -58,7 +60,7 @@
fi
echo "Done :)"
-size=$(stat $anon_cfg_file | sed -n 2p | awk '{ print $2 }')
+size=$(wc -c $anon_cfg_file | awk '{ print $1 }')
echo "Successfully created $workdir/$anon_cfg_file"
if test $size -gt 10000000; then
echo "The file is larger than 10MB, so please attach it to a dropbox"
Regards,
Armin Wolfermann
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
More information about the Developers
mailing list