By Seán Boran (sean at boran.com)
www.boran.com/security/sp/Solaris_bsm.html
This article first appeared as "Tip of the Week" in the Solaris Security Digest. Since then I've added a few updates, links and feedback. It's not by any means a complete reference on BSM.
Beware: I've had problems on many Solaris8 boxes- if BSM is switched on, root cron jobs fail.
|
|||
Sun deliver a "C2" level auditing system for both SunOS (Sunshield) and Solaris (Sunshield BSM). It is bundled with Solaris 2. BSM allows the actions of specific users to be recorded and written to an audit file. However, the auditing is at the system-call level, meaning huge logs may be generated by simple user actions. Performance is also affected. The standard analysis tools praudit and auditreduce offer no high level analysis of audit trails. Applications may also write to the audit trail.
Reference documentation: "SunShield Basic Security Module Guide" (Standard Solaris 2.x documentation). Man pages: audit(1m), audit_startup(1m), audit_warn(1m), auditconfig(1m), auditreduce(1m), bsmconv(1m).
Flags:
# lo - login/logout events
# ex - execution
# fd,fc,fw,fm - file deletion/creation/write/change of object attributes: chown, flock, etc.
# ad - administrative actions: mount, exportfs, etc.
# pc - process operations: fork, exec, exit, etc.
Another example: to audit a user's failed attempts at creating, writing,
reading file and successful file deletions & attribute modifications:
joe_bloggs:-fc,-fw,-fr,fd,fm:no
Install the audit2info scripts. Francisco Mancardi has published these scripts to make it easier to read the Sun's C2 (SunShield BSM) auditing logs. The scripts and files described here can be downloaded.
Try out audit2info:
First, produce an ASCII file on C2 auditing activity :
cd /opt/audit;
auditreduce | praudit > audit-data.txtWe can now analyse this output in different ways using the "audit2info" script, links are provided to sample results.
Let's make the output from auditreduce | praudit above more readable:
./audit2info audit-data.txt > outfileShow only activity concerning one username:
./audit2info -u bill audit-data.txt > outfileShow only login/logout activity:
./audit2info -l ok audit-data.txt > outfileShow only login failure activity:
./audit2info -l ko audit-data.txt > outfileShow the complete output from auditreduce |praudit, but filtering out records
that have fields with the string listed in the filter file default "filtro_audit"
./audit2info -f default audit-data.txt > outfileThe above example can be mixed as desired..
Notes using SunShield BSM:
#!/sbin/sh
#
# newauditlog.sh - Start a new audit file and expire the old logs
#
AUDIT_EXPIRE=30
AUDIT_DIR="/var/audit" /usr/sbin/audit -n cd $AUDIT_DIR # in case it is a link
/usr/bin/find . $AUDIT_DIR -type f -mtime +$AUDIT_EXPIRE \
-exec rm {} > /dev/null 2>&1 \;
Run the script nightly from cron:
0 0 * * * /etc/security/newauditlog.sh
List of Audit event classes
http://www.sysadminmag.com/supplement/913c2t1.shtmlImplementing C2 Auditing in the Solaris Environment, by Kevin Wenchel and Stephen Michaels
http://www.sysadminmag.com/supplement/913c2.shtmlC2 Security Frequently Asked Questions, Sunsolve Online
http://sunsolve.Sun.COM , infodoc id 14313.Solaris BSM Auditing, by Darren Moffat
http://www.securityfocus.com/focus/sun/articles/bsmaudit1.htmlSolaris Security Guide, Sabernet
http://www.sabernet.net/papers/Solaris.htmlSun Blueprints: Auditing in the Solaris 8 Operating Environment
http://www.sun.com/blueprints/
Seán Boran is an IT security consultant based in Switzerland and the author of the online IT Security Cookbook.
© Copyright 2002, Seán .Boran, All Rights Reserved, Last Update: 24 septembre, 2002 |