Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-uninstall.sh 2771 2020-02-22 09:50:24Z rexy $
|
2 |
# $Id: alcasar-uninstall.sh 2772 2020-03-01 18:04:45Z rexy $
|
3 |
|
3 |
|
4 |
# alcasar-uninstall.sh
|
4 |
# alcasar-uninstall.sh
|
5 |
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
|
5 |
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
7 |
|
7 |
|
Line 60... |
Line 60... |
60 |
rm -rf /var/lib/mysql
|
60 |
rm -rf /var/lib/mysql
|
61 |
}
|
61 |
}
|
62 |
|
62 |
|
63 |
freeradius ()
|
63 |
freeradius ()
|
64 |
{
|
64 |
{
|
65 |
echo -en "(24) : "
|
65 |
echo -en "(22) : "
|
66 |
[ -e /etc/raddb/empty-radiusd-db.sql ] && rm -f /etc/raddb/empty-radiusd-db.sql && echo -n "1, "
|
66 |
[ -e /etc/raddb/empty-radiusd-db.sql ] && rm -f /etc/raddb/empty-radiusd-db.sql && echo -n "1, "
|
67 |
[ -e /etc/raddb/radiusd.conf.default ] && mv /etc/raddb/radiusd.conf.default /etc/raddb/radiusd.conf && echo -n "2, "
|
67 |
[ -e /etc/raddb/radiusd.conf.default ] && mv /etc/raddb/radiusd.conf.default /etc/raddb/radiusd.conf && echo -n "2, "
|
68 |
[ -e /etc/raddb/dictionary.default ] && mv /etc/raddb/dictionary.default /etc/raddb/dictionary && echo -n "3, "
|
68 |
[ -e /etc/raddb/dictionary.default ] && mv /etc/raddb/dictionary.default /etc/raddb/dictionary && echo -n "3, "
|
- |
|
69 |
[ -e /etc/raddb/dictionary.alcasar ] && rm /etc/raddb/dictionary.alcasar && echo -n "4, "
|
- |
|
70 |
[ -e /etc/raddb/dictionary.coovachilli ] && rm /etc/raddb/dictionary.coovachilli && echo -n "5, "
|
- |
|
71 |
[ -e /etc/raddb/clients.conf.default ] && mv /etc/raddb/clients.conf.default /etc/raddb/clients.conf && echo -n "6, "
|
69 |
[ -e /etc/raddb/sites-enabled/alcasar ] && rm /etc/raddb/sites-enabled/alcasar && echo -n "4, "
|
72 |
[ -e /etc/raddb/sites-enabled/alcasar ] && rm /etc/raddb/sites-enabled/alcasar && echo -n "7, "
|
70 |
[ -e /etc/raddb/sites-available/alcasar ] && rm /etc/raddb/sites-available/alcasar && echo -n "5, "
|
73 |
[ -e /etc/raddb/sites-available/alcasar ] && rm /etc/raddb/sites-available/alcasar && echo -n "8, "
|
71 |
[ -e /etc/raddb/sites-available/alcasar-with-ldap ] && rm /etc/raddb/sites-available/alcasar-with-ldap && echo -n "6, "
|
74 |
[ -e /etc/raddb/sites-available/alcasar-with-ldap ] && rm /etc/raddb/sites-available/alcasar-with-ldap && echo -n "9, "
|
72 |
[ -e /etc/raddb/clients.conf.default ] && mv /etc/raddb/clients.conf.default /etc/raddb/clients.conf && echo -n "7, "
|
75 |
[ -e /etc/raddb/mods-available/ldap-alcasar ] && rm -f /etc/raddb/mods-enabled/ldap-alcasar && rm -f /etc/raddb/mods-available/ldap-alcasar && echo -n "10, "
|
73 |
i=7
|
76 |
i=10
|
74 |
for mods in sql sqlcounter attr_filter expiration logintime pap expr always
|
77 |
for mods in sql sqlcounter attr_filter expiration logintime pap expr always
|
75 |
do
|
78 |
do
|
76 |
i=`expr $i + 1`
|
79 |
i=`expr $i + 1`
|
77 |
rm /etc/raddb/mods-enabled/$mods && echo -n "$i, "
|
80 |
rm /etc/raddb/mods-enabled/$mods && echo -n "$i, "
|
78 |
done
|
81 |
done
|
79 |
[ -e /etc/raddb/mods-available/ldap-alcasar ] && rm -f /etc/raddb/mods-enabled/ldap-alcasar && rm -f /etc/raddb/mods-available/ldap-alcasar && echo -n "16, "
|
82 |
[ -e /etc/raddb/mods-available/sql.default ] && mv /etc/raddb/mods-available/sql.default /etc/raddb/mods-available/sql && echo -n "19, "
|
80 |
[ -e /etc/raddb/mods-config/sql/main/mysql/queries.conf.default ] && mv /etc/raddb/mods-config/sql/main/mysql/queries.conf.default /etc/raddb/mods-config/sql/main/mysql/queries.conf && echo -n "17, "
|
83 |
[ -e /etc/raddb/mods-config/sql/main/mysql/queries.conf.default ] && mv /etc/raddb/mods-config/sql/main/mysql/queries.conf.default /etc/raddb/mods-config/sql/main/mysql/queries.conf && echo -n "20, "
|
81 |
[ -e /lib/systemd/system/radiusd.service.default ] && mv /lib/systemd/system/radiusd.service.default /lib/systemd/system/radiusd.service && echo -n "18, "
|
- |
|
82 |
[ -e /etc/raddb/mods-available/sqlcounter.default ] && mv /etc/raddb/mods-available/sqlcounter.default /etc/raddb/mods-available/sqlcounter && echo -n "19, "
|
84 |
[ -e /etc/raddb/mods-available/sqlcounter.default ] && mv /etc/raddb/mods-available/sqlcounter.default /etc/raddb/mods-available/sqlcounter && echo -n "21, "
|
83 |
[ -e /etc/raddb/mods-available/sql.default ] && mv /etc/raddb/mods-available/sql.default /etc/raddb/mods-available/sql && echo -n "20"
|
85 |
[ -e /lib/systemd/system/radiusd.service.default ] && mv /lib/systemd/system/radiusd.service.default /lib/systemd/system/radiusd.service && echo -n "22"
|
84 |
[ -e /etc/raddb/mods-config/sql/counter/mysql/dailycounter.conf.default ] && mv /etc/raddb/mods-config/sql/counter/mysql/dailycounter.conf.default /etc/raddb/mods-config/sql/counter/mysql/dailycounter.conf && echo -n ", 21"
|
- |
|
85 |
[ -e /etc/raddb/mods-config/sql/counter/mysql/monthlycounter.conf.default ] && mv /etc/raddb/mods-config/sql/counter/mysql/monthlycounter.conf.default /etc/raddb/mods-config/sql/counter/mysql/monthlycounter.conf && echo -n ", 22"
|
- |
|
86 |
[ -e /etc/raddb/mods-config/sql/counter/mysql/noresetcounter.conf.default ] && mv /etc/raddb/mods-config/sql/counter/mysql/noresetcounter.conf.default /etc/raddb/mods-config/sql/counter/mysql/noresetcounter.conf && echo -n ", 23"
|
- |
|
87 |
[ -e /etc/raddb/mods-config/sql/counter/mysql/expire_on_login.conf.default ] && mv /etc/raddb/mods-config/sql/counter/mysql/expire_on_login.conf.default /etc/raddb/mods-config/sql/counter/mysql/expire_on_login.conf && echo -n ", 24"
|
- |
|
88 |
}
|
86 |
}
|
89 |
|
87 |
|
90 |
chilli ()
|
88 |
chilli ()
|
91 |
{
|
89 |
{
|
92 |
echo -en "(4) : "
|
90 |
echo -en "(4) : "
|
Line 124... |
Line 122... |
124 |
[ -e /etc/havp/havp.config.default ] && mv /etc/havp/havp.config.default /etc/havp/havp.config && echo -n "1, "
|
122 |
[ -e /etc/havp/havp.config.default ] && mv /etc/havp/havp.config.default /etc/havp/havp.config && echo -n "1, "
|
125 |
[ -d /var/run/havp ] && rm -rf /var/run/havp && echo -n "2, "
|
123 |
[ -d /var/run/havp ] && rm -rf /var/run/havp && echo -n "2, "
|
126 |
[ -e /etc/init.d/havp.default ] && mv /etc/init.d/havp.default /etc/init.d/havp && echo -n "3, "
|
124 |
[ -e /etc/init.d/havp.default ] && mv /etc/init.d/havp.default /etc/init.d/havp && echo -n "3, "
|
127 |
[ -e /lib/systemd/system/havp.service ] && rm /lib/systemd/system/havp.service && echo -n "4, "
|
125 |
[ -e /lib/systemd/system/havp.service ] && rm /lib/systemd/system/havp.service && echo -n "4, "
|
128 |
[ -e /etc/freshclam.conf.default ] && mv /etc/freshclam.conf.default /etc/freshclam.conf && echo -n "5, "
|
126 |
[ -e /etc/freshclam.conf.default ] && mv /etc/freshclam.conf.default /etc/freshclam.conf && echo -n "5, "
|
129 |
userdel -r havp 2>/dev/null && echo -n "6"
|
127 |
userdel -r havp 2>/dev/null ; echo -n "6"
|
130 |
|
- |
|
131 |
else echo -n "already uninstalled"
|
128 |
else echo -n "already uninstalled"
|
132 |
fi
|
129 |
fi
|
133 |
}
|
130 |
}
|
134 |
|
131 |
|
135 |
tinyproxy ()
|
132 |
tinyproxy ()
|
Line 195... |
Line 192... |
195 |
[ -e /etc/dhcpd.conf.default ] && mv /etc/dhcpd.conf.default /etc/dhcpd.conf && echo -n "1"
|
192 |
[ -e /etc/dhcpd.conf.default ] && mv /etc/dhcpd.conf.default /etc/dhcpd.conf && echo -n "1"
|
196 |
}
|
193 |
}
|
197 |
|
194 |
|
198 |
cron ()
|
195 |
cron ()
|
199 |
{
|
196 |
{
|
- |
|
197 |
# /etc/cron.d/alcasar-daemon-watchdog is removed at the beginning of this script
|
200 |
echo -en "(11) : "
|
198 |
echo -en "(11) : "
|
201 |
i=1
|
199 |
i=1
|
202 |
for cron in `ls /etc/cron.d/alcasar-* 2>/dev/null`
|
200 |
for cron in `ls /etc/cron.d/alcasar-* 2>/dev/null`
|
203 |
do
|
201 |
do
|
204 |
rm $cron && echo -n "$i, "
|
202 |
rm $cron && echo -n "$i, "
|
205 |
i=`expr $i + 1`
|
203 |
i=`expr $i + 1`
|
Line 222... |
Line 220... |
222 |
[ -e /lib/systemd/system/fail2ban.service.default ] && mv /lib/systemd/system/fail2ban.service.default /lib/systemd/system/fail2ban.service && echo -n "7"
|
220 |
[ -e /lib/systemd/system/fail2ban.service.default ] && mv /lib/systemd/system/fail2ban.service.default /lib/systemd/system/fail2ban.service && echo -n "7"
|
223 |
}
|
221 |
}
|
224 |
|
222 |
|
225 |
gammu_smsd ()
|
223 |
gammu_smsd ()
|
226 |
{
|
224 |
{
|
227 |
echo -en "(4) : "
|
225 |
echo -en "(3) : "
|
228 |
[ -e /etc/gammu_smsd_conf ] && rm -f /etc/gammu_smsd_conf && echo -n "1, "
|
226 |
[ -e /etc/gammu_smsd_conf ] && rm -f /etc/gammu_smsd_conf && echo -n "1, "
|
229 |
[ -e /lib/udev/rules.d/66-huawei.rules ] && rm -f /lib/udev/rules.d/66-huawei.rules && echo -n "2, "
|
- |
|
230 |
[ -e /var/log/gammu-smsd ] && rm -rf /var/log/gammu-smsd && echo -n "3, "
|
227 |
[ -e /var/log/gammu-smsd ] && rm -rf /var/log/gammu-smsd && echo -n "2, "
|
231 |
userdel -r gammu_smsd 2>/dev/null && echo -n "4"
|
228 |
userdel -r gammu_smsd 2>/dev/null && echo -n "3"
|
- |
|
229 |
#[ -e /lib/udev/rules.d/66-huawei.rules ] && rm -f /lib/udev/rules.d/66-huawei.rules && echo -n "4"
|
232 |
}
|
230 |
}
|
233 |
|
231 |
|
234 |
msec ()
|
232 |
msec ()
|
235 |
{
|
233 |
{
|
236 |
echo -en "(2) : "
|
234 |
echo -en "(2) : "
|
Line 305... |
Line 303... |
305 |
services="alcasar-load_balancing vnstat havp clamav-freshclam ntpd php-fpm lighttpd radiusd mysqld unbound-blacklist unbound-whitelist dnsmasq-whitelist unbound-blackhole tinyproxy nfcapd fail2ban ulogd-ext-access ulogd-ssh ulogd-traceability e2guardian chilli"
|
303 |
services="alcasar-load_balancing vnstat havp clamav-freshclam ntpd php-fpm lighttpd radiusd mysqld unbound-blacklist unbound-whitelist dnsmasq-whitelist unbound-blackhole tinyproxy nfcapd fail2ban ulogd-ext-access ulogd-ssh ulogd-traceability e2guardian chilli"
|
306 |
/usr/local/bin/alcasar-bypass.sh -on # to allow remote update
|
304 |
/usr/local/bin/alcasar-bypass.sh -on # to allow remote update
|
307 |
fi
|
305 |
fi
|
308 |
|
306 |
|
309 |
echo "Stopping services : "
|
307 |
echo "Stopping services : "
|
- |
|
308 |
# remove daemon watchdog in order to not restart alcasar daemons during the uninstall process
|
- |
|
309 |
[ -e /etc/cron.d/alcasar-daemon-watchdog ] && rm -f /etc/cron.d/alcasar-daemon-watchdog
|
310 |
/usr/local/bin/alcasar-sms.sh --stop
|
310 |
/usr/local/bin/alcasar-sms.sh --stop
|
311 |
for i in $services
|
311 |
for i in $services
|
312 |
do
|
312 |
do
|
313 |
if [ -e /lib/systemd/system/$i.service ]
|
313 |
if [ -e /lib/systemd/system/$i.service ]
|
314 |
then
|
314 |
then
|