mirror of
https://github.com/hardenedlinux/harbian-audit.git
synced 2025-07-31 01:24:58 +02:00
Modify the check_audit_path method to pass check when audited record path does not exist in OS.
This commit is contained in:
parent
93031e98fe
commit
da61977969
@ -31,7 +31,7 @@ audit () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
@ -54,7 +54,7 @@ apply () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
|
@ -35,7 +35,7 @@ audit () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
@ -58,7 +58,7 @@ apply () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
|
@ -39,7 +39,7 @@ audit () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
@ -62,7 +62,7 @@ apply () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
|
@ -31,7 +31,7 @@ audit () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
@ -54,7 +54,7 @@ apply () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
|
@ -28,7 +28,7 @@ audit () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
@ -51,7 +51,7 @@ apply () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
|
@ -28,7 +28,7 @@ audit () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
@ -51,7 +51,7 @@ apply () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
|
@ -31,7 +31,7 @@ audit () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
@ -59,7 +59,7 @@ apply () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
|
@ -26,7 +26,7 @@ audit () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist! Rule: $AUDIT_VALUE"
|
warn "path is not exsit! Please check file path is exist! Rule: $AUDIT_VALUE"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
@ -49,7 +49,7 @@ apply () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "Path is not exsit when apply a rule: $AUDIT_VALUE ! Please check file path is exist!"
|
warn "Path is not exsit when apply a rule: $AUDIT_VALUE ! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
|
@ -28,7 +28,7 @@ audit () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
@ -51,7 +51,7 @@ apply () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
|
@ -28,7 +28,7 @@ audit () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
@ -51,7 +51,7 @@ apply () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
|
@ -26,7 +26,7 @@ audit () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
@ -49,7 +49,7 @@ apply () {
|
|||||||
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
for AUDIT_VALUE in $AUDIT_PARAMS; do
|
||||||
check_audit_path $AUDIT_VALUE
|
check_audit_path $AUDIT_VALUE
|
||||||
if [ $FNRET -eq 1 ];then
|
if [ $FNRET -eq 1 ];then
|
||||||
crit "path is not exsit! Please check file path is exist!"
|
warn "path is not exsit! Please check file path is exist!"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
debug "$AUDIT_VALUE should be in file $FILE"
|
debug "$AUDIT_VALUE should be in file $FILE"
|
||||||
|
@ -1094,15 +1094,19 @@ yum_check_updates()
|
|||||||
# Example:
|
# Example:
|
||||||
# Process only the following format:
|
# Process only the following format:
|
||||||
# AUDITRULE="-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=4294967295 -k privileged-passwd"
|
# AUDITRULE="-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=4294967295 -k privileged-passwd"
|
||||||
|
# Please manually execute apt-file (Debian) / yum Provides (redhat) to ensure that the path already exists in the repository.
|
||||||
|
# example: apt-file search /usr/bin/passwd
|
||||||
|
# freedom-maker: /usr/bin/passwd-in-image
|
||||||
|
# passwd: /usr/bin/passwd
|
||||||
check_audit_path ()
|
check_audit_path ()
|
||||||
{
|
{
|
||||||
AUDITRULE=$1
|
AUDITRULE=$1
|
||||||
RESULT=$(echo $AUDITRULE | awk -F"-F" '{print $2}' | awk -F"=" '{print $2}')
|
RESULT=$(echo $AUDITRULE | awk -F"-F" '{print $2}' | awk -F"=" '{print $2}')
|
||||||
if [ -f $(eval echo $RESULT) -o -d $(eval echo $RESULT) ]; then
|
if [ -f $(eval echo $RESULT) -o -d $(eval echo $RESULT) ]; then
|
||||||
debug "Result is not NULL"
|
debug "file $RESULT is exist!"
|
||||||
FNRET=0
|
FNRET=0
|
||||||
else
|
else
|
||||||
debug "Result is NULL"
|
warn "file $RESULT is not exist!"
|
||||||
FNRET=1
|
FNRET=1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user