linux下的audit服務


audit   ['ɔːdɪt]  審計

auditd是linux的一個審計服務。

這是man下的解釋

auditd is the userspace component to the Linux Auditing System. It’s
responsible for writing audit records to the disk. Viewing the logs is
done with the ausearch or aureport utilities. Configuring the audit
rules is done with the auditctl utility. During startup, the rules in
/etc/audit/audit.rules are read by auditctl. The audit daemon itself
has some configuration options that the admin may wish to customize.
They are found in the auditd.conf file.

 

安全審計包含了兩個部分,其一是:audit審計服務,其二是:syslog日志系統。

他們的關系如下:

audit服務專門用來記錄安全信息,用於對系統安全事件的追溯;

syslog日志系統用來記錄系統中的各種信息,如安全、調試、運行信息等;

如果audit服務沒有運行,linux內核就會將安全審計信息傳遞給syslog日志系統。

syslog會記錄系統狀態、如硬件的警告和應用軟件的記錄等。但是syslog屬於應用層,且僅止於此一應用而已,沒辦法記錄太多的資訊。因此,audit誕生以取代syslog的責任,來記錄核心層的時間:檔案的讀寫,系統呼叫,權限的狀態等。

 

audit daemon運作和一般的deamon一樣,運行后會引入selinux的系統。

 

audit有三個操作的工具

audit可用的三個指令:

=》auditctl  控制kernel audit system,能取得狀態,增加或者刪除rules、設定某個檔案的[檢視]watch.

=》ausearch 用來查詢audit logs 的工具。

=》aureport 產生audit系統簡報的工具。

配置文件

audit的配置文件為/etc/audit/audit.rules主要分為三種類別:

·basic audit system parameters

·file and directory watches

·system call audits

 

 #basic audit system parameters

這個是一些audit的整體全局參數設置

#file and directory watches

這個是目錄權限的設置以及是否可以查看某個目錄或者文件

#system call audits

這個是用來系統調用的規則配置

 

對於配置文件有幾點要說明一下:

1.目錄觀察的詳細度要比文件觀察低。

2.無法使用任何的pathname globbing,如?或者*

3.只能配置已經存在的文件,若配置觀察目錄而又新增了文件,則新文件只會在下次audit重啟后才會加入。

 

利用-k產生key string 以供ausearch直接索引

-w /etc/var/log/audit/ -k LOG_audit

 

操作命令

重啟audit

#service auditd restart

更新auditd

#yum update audit

檢查文件和系統的更改狀態

#aureport --start today --event --summary -i

查詢單一文件

#ausearch -f filename

利用-ts指定日期-k指定key string,其中password-file使用auditctl -k來產生。

#ausearch -ts today -k password-file

#ausearch -ts 3/12/07 -k password-file

-ui來指定user name(UID),例如找出(uid 516)的操作

#ausearch -ts today -k password-file -x rm -ui 516

#ausearch -k passwork-file -ui 516

 

 

 

轉自:http://note.tc.edu.tw/601.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM