Results 1 to 1 of 1
Scripting gurus
I'm on a site that is using tripwire for security checks, and has flagged insufficent logging in xinetd scripts (this isn't a question of the pros and cons ...
- 06-04-2010 #1Linux Enthusiast
- Join Date
- Aug 2006
- Location
- Portsmouth, UK
- Posts
- 539
Something Smarter
Scripting gurus

I'm on a site that is using tripwire for security checks, and has flagged insufficent logging in xinetd scripts (this isn't a question of the pros and cons of using xinetd).
I cobbled together the script below to comment out "log_on" rules insert a comment and new values.
With xinetd "stuff" needs to be between { and }, does anyone have any suggestions to make the script smarter?
Cheers!
Code:#!/bin/bash XINETD_PATH="/etc/xinetd.d/" PERL=$(which perl) AWK=$(which awk) for f in $(ls -1 $XINETD_PATH); do F=$XINETD_PATH$f $PERL -i -pe "s/(\s*log_on_(success|failure)\s.*)/#\1/g" $F $AWK 'begin {done=0;} { print $0; if (!done && $1=="{") { print "#"; printf "# %s TripWire 10.2.0.13 Added additional logging\n", d; print "#"; print "log_on_success = HOST PID USERID EXIT"; print "log_on_failure = HOST USERID"; done=1; } }' "d=$(date +%d-%b-%Y)" $F > $F.tmp mv $F.tmp $F doneRHCE #100-015-395
Please don't PM me with questions as no reply may offend, that's what the forums are for.


Reply With Quote