-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
78 lines (59 loc) · 1.76 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
# apt -y install mmdb-bin ->
# 1ère exécution du script d'installation ?
if [ ! -d /var/lib/simpleban ] ; then
mkdir /var/lib/simpleban
chown root:root /var/lib/simpleban
chmod 750 /var/lib/simpleban
# Installation dépendances
apt-get -y install task-spooler sipcalc iptables ebtables sqlite3 host whois mmdb-bin
# Configuration syslog
sed -i 's/\(^\)\($RepeatedMsgReduction\)\(.*\)/#\2\3\n$RepeatedMsgReduction off/g' /etc/rsyslog.conf
cat<<EOF>/etc/rsyslog.d/99-sban.conf
if \$syslogtag == 'sban:' then -/var/log/sban.log
EOF
service rsyslog restart
# Configuration logrotate
cat<<EOF>/etc/logrotate.d/sban
/var/log/sban.log
{
rotate 30
daily
dateext
missingok
notifempty
compress
delaycompress
postrotate
# Debian 11
/usr/lib/rsyslog/rsyslog-rotate
# Ubuntu 16.04
# invoke-rc.d rsyslog rotate >/dev/null 2>&1 || true
# Ubuntu 14.04
# reload rsyslog >/dev/null 2>&1 || true
endscript
}
EOF
fi
# Programme
[ -d /opt/simpleban ] || mkdir /opt/simpleban
cp bin/* /opt/simpleban
chmod 750 /opt/simpleban
chmod 750 /opt/simpleban/*
ln -fs /opt/simpleban/sban /usr/local/sbin/sban
# Configuration
[ -d /etc/simpleban ] || mkdir /etc/simpleban
cp -r etc/* /etc/simpleban
[ -f /etc/simpleban/sban.cf ] || cp /etc/simpleban/sban.cf.dist /etc/simpleban/sban.cf
chown -R root:root /etc/simpleban
find /etc/simpleban/ -type f -exec chmod 640 {} \;
find /etc/simpleban/ -type d -exec chmod 750 {} \;
# Démarrage
cat<<EOF
* Pour automatiser le démarrage de "Simpleban":
cp /opt/simpleban/sban /etc/init.d
update-rc.d -f sban defaults
* Pour automatiser la purge automatique de la base de données:
ln -s /opt/simpleban/sban-vacuum /etc/cron.daily
Editer la variable 'PRUNE_DB' dans '/etc/sban/sban.cf' pour ajuster la durée de rétention.
EOF