Subversion Repositories ALCASAR

Rev

Rev 2941 | Rev 3005 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2941 Rev 2956
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-uninstall.sh 2941 2021-04-12 17:21:42Z rexy $
2
# $Id: alcasar-uninstall.sh 2956 2021-05-24 19:57:17Z 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 287... Line 287...
287
	[ -e /opt/acme.sh ] && rm -rf /opt/acme.sh && echo -n "3"
287
	[ -e /opt/acme.sh ] && rm -rf /opt/acme.sh && echo -n "3"
288
}
288
}
289
 
289
 
290
post_install ()
290
post_install ()
291
{
291
{
292
echo -en "(8) : "
292
echo -en "(7) : "
293
	[ -e /etc/mageia-release.default ] && mv -f /etc/mageia-release.default /etc/mageia-release && echo -n "1, "
293
	[ -e /etc/mageia-release.default ] && mv -f /etc/mageia-release.default /etc/mageia-release && echo -n "1, "
294
	[ -e /etc/ssh/alcasar-banner-ssh ] && rm -f /etc/ssh/alcasar-banner-ssh && echo -n "2, "
294
	[ -e /etc/ssh/alcasar-banner-ssh ] && rm -f /etc/ssh/alcasar-banner-ssh && echo -n "2, "
295
	[ -e /etc/ssh/sshd_config.default ] && mv -f /etc/ssh/sshd_config.default /etc/ssh/sshd_config && echo -n "3, "
295
	[ -e /etc/ssh/sshd_config.default ] && mv -f /etc/ssh/sshd_config.default /etc/ssh/sshd_config && echo -n "3, "
296
	[ -e /etc/bashrc.default ] && mv -f /etc/bashrc.default /etc/bashrc && echo -n "4, "
296
	[ -e /etc/bashrc.default ] && mv -f /etc/bashrc.default /etc/bashrc && echo -n "4, "
297
	[ -e /etc/sudoers.default ] && mv -f /etc/sudoers.default /etc/sudoers && echo -n "5, "
297
	[ -e /etc/sudoers.default ] && mv -f /etc/sudoers.default /etc/sudoers && echo -n "5, "
298
	if [ -e /etc/systemd/system/alcasar-load_balancing.service ]
-
 
299
	then
-
 
300
		rm -f /etc/systemd/system/alcasar-load_balancing.service
-
 
301
		echo -n "6, "
-
 
302
	fi
-
 
303
	[ -e /etc/security/limits.conf.default ] && mv -f /etc/security/limits.conf.default /etc/security/limits.conf && echo -n "7, "
298
	[ -e /etc/security/limits.conf.default ] && mv -f /etc/security/limits.conf.default /etc/security/limits.conf && echo -n "6, "
304
	[ -e /etc/default/grub.default ] && mv -f /etc/default/grub.default /etc/default/grub && echo -n "8"
299
	[ -e /etc/default/grub.default ] && mv -f /etc/default/grub.default /etc/default/grub && echo -n "7"
305
}
300
}
306
 
301
 
307
 
302
 
308
usage="Usage: alcasar-uninstall.sh {-update or --update} | {-full or --full}"
303
usage="Usage: alcasar-uninstall.sh {-update or --update} | {-full or --full}"
309
 
304
 
Line 335... Line 330...
335
if [ $mode == "full" ]
330
if [ $mode == "full" ]
336
then
331
then
337
	echo "----------------------------------------------------------------------------"
332
	echo "----------------------------------------------------------------------------"
338
	echo "**                     Uninstall/Désinstallation d'ALCASAR		**"
333
	echo "**                     Uninstall/Désinstallation d'ALCASAR		**"
339
	echo "----------------------------------------------------------------------------"
334
	echo "----------------------------------------------------------------------------"
340
	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"
335
	services="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"
341
	/usr/local/bin/alcasar-logout.sh all # logout everybody
336
	/usr/local/bin/alcasar-logout.sh all # logout everybody
342
else
337
else
343
	echo "--------------------------------------------------------------------------"
338
	echo "--------------------------------------------------------------------------"
344
	echo "**                     update/mise à jour d'ALCASAR			**"
339
	echo "**                     update/mise à jour d'ALCASAR			**"
345
	echo "--------------------------------------------------------------------------"
340
	echo "--------------------------------------------------------------------------"
346
	# unbound, iptables & sshd should stay on to allow remote update
341
	# unbound, iptables & sshd should stay on to allow remote update
347
	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"
342
	services="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"
348
	/usr/local/bin/alcasar-bypass.sh -on # to allow remote update + users stay connected during the update
343
	/usr/local/bin/alcasar-bypass.sh -on # to allow remote update + users stay connected during the update
349
fi
344
fi
350
 
345
 
351
echo "Stopping services : "
346
echo "Stopping services : "
352
# remove daemon watchdog in order to not restart alcasar daemons during the uninstall process
347
# remove daemon watchdog in order to not restart alcasar daemons during the uninstall process
Line 389... Line 384...
389
		read a
384
		read a
390
	fi
385
	fi
391
done
386
done
392
if [ $mode == "full" ]
387
if [ $mode == "full" ]
393
then
388
then
394
	echo -en "\n- network(9) : "
389
	echo -en "\n- network(10) : "
395
	hostnamectl set-hostname localhost.localdomain
390
	hostnamectl set-hostname localhost.localdomain
396
	chmod a-x /etc/sysconfig/network-scripts/default-*
391
	chmod a-x /etc/sysconfig/network-scripts/default-*
397
	i=0
392
	i=0
398
	for nic in `ls /etc/sysconfig/network-scripts/default-*|cut -d'-' -f4`
393
	for nic in `ls /etc/sysconfig/network-scripts/default-*|cut -d'-' -f4`
399
	do
394
	do
Line 404... Line 399...
404
	[ -e /etc/sysconfig/network.default ] && mv -f /etc/sysconfig/network.default /etc/sysconfig/network && echo -n "3, "
399
	[ -e /etc/sysconfig/network.default ] && mv -f /etc/sysconfig/network.default /etc/sysconfig/network && echo -n "3, "
405
	[ -e /etc/hosts.default ] && mv -f /etc/hosts.default /etc/hosts && echo -n "4, "
400
	[ -e /etc/hosts.default ] && mv -f /etc/hosts.default /etc/hosts && echo -n "4, "
406
	[ -e /etc/hosts.allow.default ] && mv -f /etc/hosts.allow.default /etc/hosts.allow && echo -n "5, "
401
	[ -e /etc/hosts.allow.default ] && mv -f /etc/hosts.allow.default /etc/hosts.allow && echo -n "5, "
407
	[ -e /etc/hosts.deny.default ] && mv -f /etc/hosts.deny.default /etc/hosts.deny && echo -n "6, "
402
	[ -e /etc/hosts.deny.default ] && mv -f /etc/hosts.deny.default /etc/hosts.deny && echo -n "6, "
408
	[ -e /etc/modprobe.preload.default ] && mv -f /etc/modprobe.preload.default /etc/modprobe.preload && echo -n "7, "
403
	[ -e /etc/modprobe.preload.default ] && mv -f /etc/modprobe.preload.default /etc/modprobe.preload && echo -n "7, "
-
 
404
	if [ -e /etc/systemd/system/alcasar-network.service ]
-
 
405
-	then
-
 
406
-		rm -f /etc/systemd/system/alcasar-network.service
-
 
407
-		echo -n "8, "
-
 
408
-	fi
409
	if [ -e /etc/systemd/system/iptables.service ]
409
	if [ -e /etc/systemd/system/iptables.service ]
410
	then
410
	then
411
		rm -f /etc/systemd/system/iptables.service
411
		rm -f /etc/systemd/system/iptables.service
412
		echo -n "8, "
412
		echo -n "9, "
413
	fi
413
	fi
414
	[ -e /usr/libexec/iptables.init.default ] && mv -f /usr/libexec/iptables.init.default /usr/libexec/iptables.init && echo -n "9"
414
	[ -e /usr/libexec/iptables.init.default ] && mv -f /usr/libexec/iptables.init.default /usr/libexec/iptables.init && echo -n "10"
415
	/usr/bin/systemctl restart network
415
	/usr/bin/systemctl restart network
416
	sleep 1
416
	sleep 1
417
fi
417
fi
418
 
418
 
419
# Reset "skip.list" (we keep "kernel" in order not to download kernel we don't want to have)
419
# Reset "skip.list" (we keep "kernel" in order not to download kernel we don't want to have)