A friend of mine convinced me to learn more about security in Solaris 10. I thought i would start with auditing, commonly known as bsm auditing. Audits are written to binary files and originate from logins and the kernel. Levels of logging need to be determined wisely as disk space can be used up very quickly.
First step to enabling auditing is to run the /etc/security/bsmconv script. This creates a config file /etc/security/audit_startup and moves /etc/vold.conf to /etc/security/spool/vold.state with the intention to block users from inserting insecure files or binaries. For more information do a man on bsmconv.
An entry is added to /etc/system:
set c2audit:audit_load = 1 which enables auditing on the kernel and on the system.
At this stage a reboot is required. After reboot perform a ps -ef on auditd to confirm this daemon is running:
amsterdam:/ # ps -ef | grep auditd
root 443 1 0 11:19:45 ? 0:00 /usr/sbin/auditd
All configuration files reside in /etc/security
amsterdam:/ # cd /etc/security/
amsterdam:/etc/security # ls
audit audit_record_attr bsmconv device_maps lib
audit_class audit_startup bsmunconv device_policy policy.conf
audit_control audit_user crypt.conf exec_attr priv_names
audit_data audit_warn dev extra_privs prof_attr
audit_event auth_attr device_allocate kmfpolicy.xml spool
There are man pages for all these config files. For now i am only interested in the audit_user and audit_class files. The audit_class file lists the events that can be audited.
amsterdam:/etc/security # cat audit_class
…. snip
0×00000000:no:invalid class
0×00000001:fr:file read
0×00000002:fw:file write
0×00000004:fa:file attribute access
0×00000008:fm:file attribute modify
0×00000010:fc:file create
0×00000020:fd:file delete
0×00000040:cl:file close
0×00000100:nt:network
0×00000200:ip:ipc
0×00000400:na:non-attribute
0×00001000:lo:login or logout
0×00004000:ap:application
0×00010000:ss:change system state
0×00020000:as:system-wide administration
0×00040000:ua:user administration
0×00070000:am:administrative (meta-class)
0×00080000:aa:audit utilization
0×000f0000:ad:old administrative (meta-class)
0×00100000:ps:process start/stop
0×00200000:pm:process modify
0×00300000:pc:process (meta-class)
0×00400000:xp:X - privileged/administrative operations
0×00800000:xc:X - object create/destroy
0×01000000:xs:X - operations that always silently fail, if bad
0×01c00000:xx:X - all X events (meta-class)
0×20000000:io:ioctl
0×40000000:ex:exec
0×80000000:ot:other
0xffffffff:all:all classes (meta-class)
amsterdam:/etc/security # cat audit_user
… snip
root:lo:no
So at this stage only root logins/logouts are logged. I will amend this file to include all users with the lo flag to record when my users log in. Then i will setup accounting to receive daily reports. If i see any irregular behavior i may then increase the level of logging to determine if something fishy is going on.
To view the binary log files two commands are used. praudit and auditreduce - in conjunction with various flags of course. Logs are stored in /var/audit.
amsterdam:/var/audit # ls
20071213004722.not_terminated.amsterdam
The numbers represent the date. So this file was last accessed on 13/12/2007 12:47:22. We will first have to stop writing to this file:
amsterdam:/var/audit # audit -n
amsterdam:/var/audit # ls
20071213004722.20071213040133.amsterdam 20071213040133.not_terminated.amsterdam
The previous session is closed and can be read using the praudit command.
amsterdam:/var/audit # praudit 20071213004722.20071213040133.amsterdam
And the contents of the file appear.
If you want to see every command issued by your users a line in the /etc/security/audit_user would look like:
username:lo,ex
But this will result in large log files. A balanced approach needs to be found to logging and trawling thru log files. Next i will look at setting up accounting so a daily/weekly/monthly report will be emailed to assist with the trawling thru these log files. I also will take a closer look at the viewing of audit log files with auditreduce command.
EDIT: This post details using praudit and auditreduce to view binary audit log files.