Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-uninstall.sh 2838 2020-06-21 22:15:26Z rexy $
|
2 |
# $Id: alcasar-uninstall.sh 2840 2020-06-27 22:35:40Z 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 94... |
Line 94... |
94 |
[ -e /lib/systemd/system/chilli.service ] && rm /lib/systemd/system/chilli.service && echo -n "4"
|
94 |
[ -e /lib/systemd/system/chilli.service ] && rm /lib/systemd/system/chilli.service && echo -n "4"
|
95 |
}
|
95 |
}
|
96 |
|
96 |
|
97 |
e2guardian ()
|
97 |
e2guardian ()
|
98 |
{
|
98 |
{
|
99 |
echo -en "(14) : "
|
99 |
echo -en "(15) : "
|
100 |
[ -d /var/e2guardian ] && rm -rf /var/e2guardian
|
100 |
[ -d /var/e2guardian ] && rm -rf /var/e2guardian
|
101 |
[ -d /var/dansguardian ] && rm -rf /var/dansguardian
|
101 |
[ -d /var/dansguardian ] && rm -rf /var/dansguardian
|
102 |
[ -e /lib/systemd/system/e2guardian.service.default ] && mv /lib/systemd/system/e2guardian.service.default /lib/systemd/system/e2guardian.service && echo -n "1, "
|
102 |
[ -e /lib/systemd/system/e2guardian.service.default ] && mv /lib/systemd/system/e2guardian.service.default /lib/systemd/system/e2guardian.service && echo -n "1, "
|
103 |
[ -e /etc/e2guardian/e2guardian.conf.default ] && mv /etc/e2guardian/e2guardian.conf.default /etc/e2guardian/e2guardian.conf && echo -n "2, "
|
103 |
[ -e /etc/e2guardian/e2guardian.conf.default ] && mv /etc/e2guardian/e2guardian.conf.default /etc/e2guardian/e2guardian.conf && echo -n "2, "
|
104 |
[ -e /etc/e2guardian/lists/bannedphraselist.default ] && mv /etc/e2guardian/lists/bannedphraselist.default /etc/e2guardian/lists/bannedphraselist && echo -n "3, "
|
104 |
[ -e /etc/e2guardian/lists/bannedphraselist.default ] && mv /etc/e2guardian/lists/bannedphraselist.default /etc/e2guardian/lists/bannedphraselist && echo -n "3, "
|
105 |
[ -e /etc/e2guardian/e2guardianf1.conf.default ] && mv /etc/e2guardian/e2guardianf1.conf.default /etc/e2guardian/e2guardianf1.conf && echo -n "4, "
|
105 |
[ -e /etc/e2guardian/e2guardianf1.conf.default ] && mv /etc/e2guardian/e2guardianf1.conf.default /etc/e2guardian/e2guardianf1.conf && echo -n "4, "
|
- |
|
106 |
[ -e /etc/e2guardian/e2guardianf2.conf ] && rm -f /etc/e2guardian/e2guardianf2.conf && echo -n "5, "
|
106 |
[ -e /usr/share/e2guardian/languages/french/template.html.default ] && mv /usr/share/e2guardian/languages/french/template.html.default /usr/share/e2guardian/languages/french/template.html && echo -n "5, "
|
107 |
[ -e /usr/share/e2guardian/languages/french/template.html.default ] && mv /usr/share/e2guardian/languages/french/template.html.default /usr/share/e2guardian/languages/french/template.html && echo -n "6, "
|
107 |
[ -e /usr/share/e2guardian/languages/ukenglish/template.html.default ] && mv /usr/share/e2guardian/languages/ukenglish/template.html.default /usr/share/e2guardian/languages/ukenglish/template.html && echo -n "6, "
|
108 |
[ -e /usr/share/e2guardian/languages/ukenglish/template.html.default ] && mv /usr/share/e2guardian/languages/ukenglish/template.html.default /usr/share/e2guardian/languages/ukenglish/template.html && echo -n "7, "
|
108 |
[ -e /etc/e2guardian/lists/bannedextensionlist.default ] && mv /etc/e2guardian/lists/bannedextensionlist.default /etc/e2guardian/lists/bannedextensionlist && echo -n "7, "
|
109 |
[ -e /etc/e2guardian/lists/bannedextensionlist.default ] && mv /etc/e2guardian/lists/bannedextensionlist.default /etc/e2guardian/lists/bannedextensionlist && echo -n "8, "
|
109 |
[ -e /etc/e2guardian/lists/bannedmimetypelist.default ] && mv /etc/e2guardian/lists/bannedmimetypelist.default /etc/e2guardian/lists/bannedmimetypelist && echo -n "8, "
|
110 |
[ -e /etc/e2guardian/lists/bannedmimetypelist.default ] && mv /etc/e2guardian/lists/bannedmimetypelist.default /etc/e2guardian/lists/bannedmimetypelist && echo -n "9, "
|
110 |
[ -e /etc/e2guardian/lists/exceptioniplist.default ] && mv /etc/e2guardian/lists/exceptioniplist.default /etc/e2guardian/lists/exceptioniplist && echo -n "9, "
|
111 |
[ -e /etc/e2guardian/lists/exceptioniplist.default ] && mv /etc/e2guardian/lists/exceptioniplist.default /etc/e2guardian/lists/exceptioniplist && echo -n "10, "
|
111 |
[ -e /etc/e2guardian/lists/bannedsitelist.default ] && mv /etc/e2guardian/lists/bannedsitelist.default /etc/e2guardian/lists/bannedsitelist && echo -n "10, "
|
112 |
[ -e /etc/e2guardian/lists/bannedsitelist.default ] && mv /etc/e2guardian/lists/bannedsitelist.default /etc/e2guardian/lists/bannedsitelist && echo -n "11, "
|
112 |
[ -e /etc/e2guardian/lists/bannedurllist.default ] && mv /etc/e2guardian/lists/bannedurllist.default /etc/e2guardian/lists/bannedurllist && echo -n "11, "
|
113 |
[ -e /etc/e2guardian/lists/bannedurllist.default ] && mv /etc/e2guardian/lists/bannedurllist.default /etc/e2guardian/lists/bannedurllist && echo -n "12, "
|
113 |
[ -e /etc/e2guardian/lists/exceptionsitelist.default ] && mv /etc/e2guardian/lists/exceptionsitelist.default /etc/e2guardian/lists/exceptionsitelist && echo -n "12, "
|
114 |
[ -e /etc/e2guardian/lists/exceptionsitelist.default ] && mv /etc/e2guardian/lists/exceptionsitelist.default /etc/e2guardian/lists/exceptionsitelist && echo -n "13, "
|
114 |
[ -e /etc/e2guardian/lists/exceptionurllist.default ] && mv /etc/e2guardian/lists/exceptionurllist.default /etc/e2guardian/lists/exceptionurllist && echo -n "13, "
|
115 |
[ -e /etc/e2guardian/lists/exceptionurllist.default ] && mv /etc/e2guardian/lists/exceptionurllist.default /etc/e2guardian/lists/exceptionurllist && echo -n "14, "
|
115 |
[ -e /etc/e2guardian/lists/urlregexplist.default ] && mv /etc/e2guardian/lists/urlregexplist.default /etc/e2guardian/lists/urlregexplist && echo -n "14"
|
116 |
[ -e /etc/e2guardian/lists/urlregexplist.default ] && mv /etc/e2guardian/lists/urlregexplist.default /etc/e2guardian/lists/urlregexplist && echo -n "15"
|
116 |
}
|
117 |
}
|
117 |
|
118 |
|
118 |
antivirus ()
|
119 |
antivirus ()
|
119 |
{
|
120 |
{
|
120 |
echo -en "(6) : "
|
121 |
echo -en "(2) : "
|
121 |
if [ -e /etc/init.d/havp ]
|
- |
|
122 |
then
|
- |
|
123 |
[ -e /etc/havp/havp.config.default ] && mv /etc/havp/havp.config.default /etc/havp/havp.config && echo -n "1, "
|
122 |
[ -e /etc/clamd.conf.default ] && mv /etc/clamd.conf.default /etc/clamd.conf && echo -n "1, "
|
124 |
[ -d /run/havp ] && rm -rf /run/havp && echo -n "2, "
|
- |
|
125 |
[ -e /etc/init.d/havp.default ] && mv /etc/init.d/havp.default /etc/init.d/havp && echo -n "3, "
|
- |
|
126 |
[ -e /lib/systemd/system/havp.service ] && rm /lib/systemd/system/havp.service && echo -n "4, "
|
- |
|
127 |
[ -e /etc/freshclam.conf.default ] && mv /etc/freshclam.conf.default /etc/freshclam.conf && echo -n "5, "
|
123 |
[ -e /etc/freshclam.conf.default ] && mv /etc/freshclam.conf.default /etc/freshclam.conf && echo -n "2"
|
128 |
userdel -r havp 2>/dev/null ; echo -n "6"
|
- |
|
129 |
else echo -n "already uninstalled"
|
- |
|
130 |
fi
|
- |
|
131 |
}
|
- |
|
132 |
|
- |
|
133 |
tinyproxy ()
|
- |
|
134 |
{
|
- |
|
135 |
echo -en "(3) : "
|
- |
|
136 |
if [ -e /etc/init.d/tinyproxy ]
|
- |
|
137 |
then
|
- |
|
138 |
[ -e /etc/tinyproxy/tinyproxy.conf.default ] && mv /etc/tinyproxy/tinyproxy.conf.default /etc/tinyproxy/tinyproxy.conf && echo -n "1, "
|
- |
|
139 |
[ -d /run/tinyproxy ] && rm -rf /run/tinyproxy && echo -n "2, "
|
- |
|
140 |
userdel -r tinyproxy 2>/dev/null && echo -n "3"
|
- |
|
141 |
else echo -n "already uninstalled"
|
- |
|
142 |
fi
|
- |
|
143 |
}
|
124 |
}
|
144 |
|
125 |
|
145 |
ulogd ()
|
126 |
ulogd ()
|
146 |
{
|
127 |
{
|
147 |
echo -en "(6) : "
|
128 |
echo -en "(6) : "
|
Line 292... |
Line 273... |
292 |
if [ $mode == "full" ]
|
273 |
if [ $mode == "full" ]
|
293 |
then
|
274 |
then
|
294 |
echo "----------------------------------------------------------------------------"
|
275 |
echo "----------------------------------------------------------------------------"
|
295 |
echo "** Uninstall/Désinstallation d'ALCASAR **"
|
276 |
echo "** Uninstall/Désinstallation d'ALCASAR **"
|
296 |
echo "----------------------------------------------------------------------------"
|
277 |
echo "----------------------------------------------------------------------------"
|
297 |
services="alcasar-load_balancing vnstat havp clamav-freshclam ntpd php-fpm lighttpd radiusd mysqld unbound unbound-blacklist unbound-whitelist dnsmasq-whitelist unbound-blackhole tinyproxy nfcapd fail2ban iptables ulogd-ext-access ulogd-ssh ulogd-traceability e2guardian sshd chilli"
|
278 |
services="alcasar-load_balancing vnstat clamav-daemon clamav-freshclam ntpd php-fpm lighttpd radiusd mysqld unbound unbound-blacklist unbound-whitelist dnsmasq-whitelist unbound-blackhole nfcapd fail2ban iptables ulogd-ext-access ulogd-ssh ulogd-traceability e2guardian sshd chilli"
|
298 |
/usr/local/bin/alcasar-logout.sh all # logout everybody
|
279 |
/usr/local/bin/alcasar-logout.sh all # logout everybody
|
299 |
else
|
280 |
else
|
300 |
echo "--------------------------------------------------------------------------"
|
281 |
echo "--------------------------------------------------------------------------"
|
301 |
echo "** update/mise à jour d'ALCASAR **"
|
282 |
echo "** update/mise à jour d'ALCASAR **"
|
302 |
echo "--------------------------------------------------------------------------"
|
283 |
echo "--------------------------------------------------------------------------"
|
303 |
# unbound, iptables & sshd should stay on to allow remote update
|
284 |
# unbound, iptables & sshd should stay on to allow remote update
|
304 |
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"
|
285 |
services="alcasar-load_balancing vnstat clamav-daemon clamav-freshclam ntpd php-fpm lighttpd radiusd mysqld unbound-blacklist unbound-whitelist dnsmasq-whitelist unbound-blackhole nfcapd fail2ban ulogd-ext-access ulogd-ssh ulogd-traceability e2guardian chilli"
|
305 |
/usr/local/bin/alcasar-bypass.sh -on # to allow remote update
|
286 |
/usr/local/bin/alcasar-bypass.sh -on # to allow remote update
|
306 |
fi
|
287 |
fi
|
307 |
|
288 |
|
308 |
echo "Stopping services : "
|
289 |
echo "Stopping services : "
|
309 |
# remove daemon watchdog in order to not restart alcasar daemons during the uninstall process
|
290 |
# remove daemon watchdog in order to not restart alcasar daemons during the uninstall process
|
Line 333... |
Line 314... |
333 |
if [ $mode == "update" ] # reload sshd in case of remote update
|
314 |
if [ $mode == "update" ] # reload sshd in case of remote update
|
334 |
then
|
315 |
then
|
335 |
/usr/bin/systemctl reload sshd
|
316 |
/usr/bin/systemctl reload sshd
|
336 |
fi
|
317 |
fi
|
337 |
echo "Reset ALCASAR main functions : "
|
318 |
echo "Reset ALCASAR main functions : "
|
338 |
for func in init ACC CA time_server init_db freeradius chilli e2guardian antivirus tinyproxy ulogd nfsen vnstat unbound dnsmasq dhcpd cron fail2ban gammu_smsd msec letsencrypt post_install
|
319 |
for func in init ACC CA time_server init_db freeradius chilli e2guardian antivirus ulogd nfsen vnstat unbound dnsmasq dhcpd cron fail2ban gammu_smsd msec letsencrypt post_install
|
339 |
do
|
320 |
do
|
340 |
echo -en "\n- $func "
|
321 |
echo -en "\n- $func "
|
341 |
$func
|
322 |
$func
|
342 |
if [ $DEBUG_ALCASAR == "on" ]
|
323 |
if [ $DEBUG_ALCASAR == "on" ]
|
343 |
then
|
324 |
then
|