1 | #!/bin/sh |
---|
2 | # postinst script for lliurex-statistics |
---|
3 | # |
---|
4 | # see: dh_installdeb(1) |
---|
5 | |
---|
6 | set -e |
---|
7 | |
---|
8 | . /usr/share/debconf/confmodule |
---|
9 | |
---|
10 | # summary of how this script can be called: |
---|
11 | # * <postinst> `configure' <most-recently-configured-version> |
---|
12 | # * <old-postinst> `abort-upgrade' <new version> |
---|
13 | # * <conflictor's-postinst> `abort-remove' `in-favour' <package> |
---|
14 | # <new-version> |
---|
15 | # * <postinst> `abort-remove' |
---|
16 | # * <deconfigured's-postinst> `abort-deconfigure' `in-favour' |
---|
17 | # <failed-install-package> <version> `removing' |
---|
18 | # <conflicting-package> <version> |
---|
19 | # for details, see http://www.debian.org/doc/debian-policy/ or |
---|
20 | # the debian-policy package |
---|
21 | |
---|
22 | |
---|
23 | case "$1" in |
---|
24 | configure) |
---|
25 | if [ -f /etc/audit/auditd.conf ]; then |
---|
26 | dpkg-divert --package lliurex-statistics --divert /etc/audit/auditd.conf.auditd-orig --rename /etc/audit/auditd.conf |
---|
27 | [ \! -e /etc/audit/auditd.conf -o -L /etc/audit/auditd.conf ] && ln -f /etc/audit/auditd.analytics /etc/audit/auditd.conf |
---|
28 | fi |
---|
29 | |
---|
30 | if [ -f /lib/systemd/system/auditd.service ]; then |
---|
31 | sed -i.orig -e 's/#ExecStartPost=-\/sbin\/augenrules --load/ExecStartPost=-\/sbin\/augenrules --load/' /lib/systemd/system/auditd.service |
---|
32 | fi |
---|
33 | |
---|
34 | if [ -f /etc/default/auditd ]; then |
---|
35 | cp /etc/default/auditd /etc/audit/default.analytics |
---|
36 | sed -i -e 's/USE_AUGENRULES="no"/USE_AUGENRULES="yes"/g' /etc/audit/default.analytics |
---|
37 | |
---|
38 | dpkg-divert --package lliurex-statistics --divert /etc/default/auditd.auditd-orig --rename /etc/default/auditd |
---|
39 | [ \! -e /etc/default/auditd -o -L /etc/default/auditd ] && ln -f /etc/audit/default.analytics /etc/default/auditd |
---|
40 | fi |
---|
41 | |
---|
42 | update-rc.d auditd defaults 98 |
---|
43 | update-rc.d analytics defaults 99 |
---|
44 | |
---|
45 | if [ "$(arch)" = "x86_64" ];then |
---|
46 | echo -e "-a exit,always -F arch=b64 -F euid>999 -S execve\n" >> /etc/audit/rules.d/analytics.rules |
---|
47 | fi |
---|
48 | echo -e "-a exit,always -F arch=b32 -F euid>999 -S execve\n" >> /etc/audit/rules.d/analytics.rules |
---|
49 | touch /etc/lliurex-analytics/status |
---|
50 | setfacl -m g:teachers:rw /etc/lliurex-analytics/status |
---|
51 | setfacl -m g:adm:rw /etc/lliurex-analytics/status |
---|
52 | service auditd restart |
---|
53 | ;; |
---|
54 | |
---|
55 | abort-upgrade|abort-remove|abort-deconfigure) |
---|
56 | ;; |
---|
57 | |
---|
58 | *) |
---|
59 | echo "postinst called with unknown argument \`$1'" >&2 |
---|
60 | exit 1 |
---|
61 | ;; |
---|
62 | esac |
---|
63 | |
---|
64 | # dh_installdeb will replace this with shell code automatically |
---|
65 | # generated by other debhelper scripts. |
---|
66 | |
---|
67 | #DEBHELPER# |
---|
68 | |
---|
69 | exit 0 |
---|