diff options
author | Mario Preksavec <mario at slackware dot hr> | 2016-10-14 13:46:35 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2016-10-14 22:20:05 +0700 |
commit | 0642251adaff342231ea8c8c7bbde22c09a33afe (patch) | |
tree | a9d70b7fa8b05ac0900be5c13a6020a30fedf2e0 /system/ossec-agent/doinst.sh | |
parent | 5e6a573b5acb43f5f6f8432b6f49ec9e08463fe8 (diff) |
system/ossec-agent: Added (Open Source Host-based IDS).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/ossec-agent/doinst.sh')
-rw-r--r-- | system/ossec-agent/doinst.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/system/ossec-agent/doinst.sh b/system/ossec-agent/doinst.sh new file mode 100644 index 000000000000..1f5ea03367bb --- /dev/null +++ b/system/ossec-agent/doinst.sh @@ -0,0 +1,29 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.ossec.new +config etc/ossec-init.conf.new +config etc/logrotate.d/ossec.new +find var/ossec/etc -type f -name '*.new' \ + | while read new ; do config $new ; done |