Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-uninstall.sh 2608 2018-08-20 00:30:27Z tom.houdayer $
|
2 |
# $Id: alcasar-uninstall.sh 2688 2019-01-18 23:15:49Z lucas.echard $
|
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 153... |
Line 153... |
153 |
[ -e /etc/vnstat.conf.default ] && mv /etc/vnstat.conf.default /etc/vnstat.conf && echo -n "1"
|
153 |
[ -e /etc/vnstat.conf.default ] && mv /etc/vnstat.conf.default /etc/vnstat.conf && echo -n "1"
|
154 |
}
|
154 |
}
|
155 |
|
155 |
|
156 |
dnsmasq ()
|
156 |
dnsmasq ()
|
157 |
{
|
157 |
{
|
158 |
echo -en "(6 if update ; 8 if uninstall) : "
|
158 |
echo -en "(2 if update ; 4 if uninstall) : "
|
159 |
i=0
|
- |
|
160 |
for list in blacklist whitelist blackhole
|
- |
|
161 |
do
|
- |
|
162 |
i=`expr $i + 1`
|
- |
|
163 |
[ -e /etc/dnsmasq-$list.conf ] && rm /etc/dnsmasq-$list.conf && echo -n "$i, "
|
159 |
[ -e /etc/dnsmasq-whitelist.conf ] && rm /etc/dnsmasq-whitelist.conf && echo -n "1, "
|
164 |
i=`expr $i + 1`
|
- |
|
165 |
[ -e /lib/systemd/system/dnsmasq-$list.service ] && rm /lib/systemd/system/dnsmasq-$list.service && echo -n "$i, "
|
160 |
[ -e /lib/systemd/system/dnsmasq-whitelist.service ] && rm /lib/systemd/system/dnsmasq-whitelist.service && echo -n "2, "
|
166 |
done
|
- |
|
167 |
if [ $mode == "full" ] # don't remove dnsmasq in update mode (DHCP + DNS !)
|
161 |
if [ $mode == "full" ] # don't remove dnsmasq in update mode (DHCP + DNS !)
|
168 |
then
|
162 |
then
|
169 |
if [ -e /lib/systemd/system/dnsmasq.service ]
|
- |
|
170 |
then
|
- |
|
171 |
[ -e /etc/dnsmasq.conf.default ] && mv /etc/dnsmasq.conf.default /etc/dnsmasq.conf && echo -n "7, "
|
163 |
[ -e /etc/dnsmasq.conf.default ] && mv /etc/dnsmasq.conf.default /etc/dnsmasq.conf && echo -n "3, "
|
172 |
[ -e /lib/systemd/system/dnsmasq.service.default ] && mv /lib/systemd/system/dnsmasq.service.default /lib/systemd/system/dnsmasq.service && echo -n "8"
|
164 |
[ -e /lib/systemd/system/dnsmasq.service.default ] && mv /lib/systemd/system/dnsmasq.service.default /lib/systemd/system/dnsmasq.service && echo -n "4"
|
173 |
fi
|
- |
|
174 |
fi
|
165 |
fi
|
175 |
}
|
166 |
}
|
176 |
|
167 |
|
- |
|
168 |
unbound ()
|
- |
|
169 |
{
|
- |
|
170 |
echo -en "(5) : "
|
- |
|
171 |
[ -e /etc/unbound/unbound.conf.default ] && mv /etc/unbound/unbound.conf.default /etc/unbound/unbound.conf && echo -n "1, "
|
- |
|
172 |
[ -e /etc/unbound/unbound-blacklist.conf ] && rm -f /etc/unbound/unbound-blacklist.conf && echo -n "2, "
|
- |
|
173 |
[ -e /etc/unbound/unbound-whitelist.conf ] && rm -f /etc/unbound/unbound-whitelist.conf && echo -n "3, "
|
- |
|
174 |
[ -e /etc/unbound/unbound-blackhole.conf ] && rm -f /etc/unbound/unbound-blackhole.conf && echo -n "4, "
|
- |
|
175 |
[ -e /etc/unbound/conf.d ] && rm -rf /etc/unbound/conf.d && echo -n "5"
|
- |
|
176 |
}
|
- |
|
177 |
|
177 |
cron ()
|
178 |
cron ()
|
178 |
{
|
179 |
{
|
179 |
echo -en "(11) : "
|
180 |
echo -en "(11) : "
|
180 |
i=1
|
181 |
i=1
|
181 |
for cron in `ls /etc/cron.d/alcasar-* 2>/dev/null`
|
182 |
for cron in `ls /etc/cron.d/alcasar-* 2>/dev/null`
|
Line 273... |
Line 274... |
273 |
if [ $mode == "full" ]
|
274 |
if [ $mode == "full" ]
|
274 |
then
|
275 |
then
|
275 |
echo "----------------------------------------------------------------------------"
|
276 |
echo "----------------------------------------------------------------------------"
|
276 |
echo "** Uninstall/Désinstallation d'ALCASAR **"
|
277 |
echo "** Uninstall/Désinstallation d'ALCASAR **"
|
277 |
echo "----------------------------------------------------------------------------"
|
278 |
echo "----------------------------------------------------------------------------"
|
278 |
services="alcasar-load_balancing vnstat havp freshclam ntpd lighttpd radiusd mysqld dnsmasq-blacklist dnsmasq-whitelist dnsmasq-blackhole tinyproxy nfsen fail2ban iptables ulogd-ext-access ulogd-ssh ulogd-traceability e2guardian dnsmasq sshd chilli"
|
279 |
services="alcasar-load_balancing vnstat havp freshclam ntpd lighttpd radiusd mysqld unbound unbound-blacklist unbound-whitelist dnsmasq-whitelist unbound-blackhole tinyproxy nfsen fail2ban iptables ulogd-ext-access ulogd-ssh ulogd-traceability e2guardian dnsmasq sshd chilli"
|
279 |
/usr/local/bin/alcasar-logout.sh all # logout everybody
|
280 |
/usr/local/bin/alcasar-logout.sh all # logout everybody
|
280 |
else
|
281 |
else
|
281 |
echo "--------------------------------------------------------------------------"
|
282 |
echo "--------------------------------------------------------------------------"
|
282 |
echo "** update/mise à jour d'ALCASAR **"
|
283 |
echo "** update/mise à jour d'ALCASAR **"
|
283 |
echo "--------------------------------------------------------------------------"
|
284 |
echo "--------------------------------------------------------------------------"
|
284 |
# dnsmasq & sshd should stay on to allow remote update
|
285 |
# dnsmasq & sshd should stay on to allow remote update
|
285 |
services="alcasar-load_balancing vnstat havp freshclam ntpd lighttpd radiusd mysqld dnsmasq-blacklist dnsmasq-whitelist dnsmasq-blackhole tinyproxy nfsen fail2ban ulogd-ext-access ulogd-ssh ulogd-traceability e2guardian chilli"
|
286 |
services="alcasar-load_balancing vnstat havp freshclam ntpd lighttpd radiusd mysqld unbound unbound-blacklist unbound-whitelist dnsmasq-whitelist unbound-blackhole tinyproxy nfsen fail2ban ulogd-ext-access ulogd-ssh ulogd-traceability e2guardian chilli"
|
286 |
/usr/local/bin/alcasar-bypass.sh -on # to allow remote update
|
287 |
/usr/local/bin/alcasar-bypass.sh -on # to allow remote update
|
287 |
fi
|
288 |
fi
|
288 |
|
289 |
|
289 |
[ -e /lib/systemd/system/httpd.service ] && services+=" httpd"
|
290 |
[ -e /lib/systemd/system/httpd.service ] && services+=" httpd"
|
290 |
|
291 |
|
Line 314... |
Line 315... |
314 |
if [ $mode == "update" ] # reload sshd in case of remote update
|
315 |
if [ $mode == "update" ] # reload sshd in case of remote update
|
315 |
then
|
316 |
then
|
316 |
/usr/bin/systemctl reload sshd
|
317 |
/usr/bin/systemctl reload sshd
|
317 |
fi
|
318 |
fi
|
318 |
echo "Reset ALCASAR main functions : "
|
319 |
echo "Reset ALCASAR main functions : "
|
319 |
for func in init ACC CA time_server init_db freeradius chilli e2guardian antivirus tinyproxy ulogd nfsen vnstat dnsmasq cron fail2ban gammu_smsd msec letsencrypt post_install
|
320 |
for func in init ACC CA time_server init_db freeradius chilli e2guardian antivirus tinyproxy ulogd nfsen vnstat unbound dnsmasq cron fail2ban gammu_smsd msec letsencrypt post_install
|
320 |
do
|
321 |
do
|
321 |
echo -en "\n- $func "
|
322 |
echo -en "\n- $func "
|
322 |
$func
|
323 |
$func
|
323 |
sleep 1
|
324 |
sleep 1
|
324 |
if [ $DEBUG_ALCASAR == "on" ]
|
325 |
if [ $DEBUG_ALCASAR == "on" ]
|
Line 374... |
Line 375... |
374 |
i=`expr $i + 1`
|
375 |
i=`expr $i + 1`
|
375 |
sleep 1
|
376 |
sleep 1
|
376 |
done
|
377 |
done
|
377 |
fi
|
378 |
fi
|
378 |
echo
|
379 |
echo
|
379 |
|
- |
|