Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-uninstall.sh 2426 2017-10-11 22:01:59Z richard $
|
2 |
# $Id: alcasar-uninstall.sh 2432 2017-10-22 20:56:33Z richard $
|
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 83... |
Line 83... |
83 |
echo -en "\n- init (1) : "
|
83 |
echo -en "\n- init (1) : "
|
84 |
# The files in /usr/local/ will be removed at the end (usefull here)
|
84 |
# The files in /usr/local/ will be removed at the end (usefull here)
|
85 |
rm -f /root/ALCASAR* && echo -n "1"
|
85 |
rm -f /root/ALCASAR* && echo -n "1"
|
86 |
sleep 1
|
86 |
sleep 1
|
87 |
|
87 |
|
- |
|
88 |
echo -en "\n- init (2) : "
|
- |
|
89 |
[ -e /boot/grub2/user.cfg ] && rm -f /boot/grub2/user.cfg && echo -n "1, "
|
- |
|
90 |
[ -e /etc/grub.d/default-10_linux ] || mv -f /etc/grub.d/default-10_linux /etc/grub.d/10_linux && echo -n "2"
|
- |
|
91 |
/usr/bin/update-grub2
|
- |
|
92 |
sleep 1
|
- |
|
93 |
|
88 |
echo -en "\n- ACC (11) : "
|
94 |
echo -en "\n- ACC (11) : "
|
89 |
[ -d /var/www/html ] && rm -rf /var/www/html && echo -n "1, "
|
95 |
[ -d /var/www/html ] && rm -rf /var/www/html && echo -n "1, "
|
90 |
[ -d /etc/freeradius-web ] && rm -rf /etc/freeradius-webl && echo -n "2, "
|
96 |
[ -d /etc/freeradius-web ] && rm -rf /etc/freeradius-webl && echo -n "2, "
|
91 |
[ -e /etc/php.ini.default ] && mv /etc/php.ini.default /etc/php.ini && echo -n "3, "
|
97 |
[ -e /etc/php.ini.default ] && mv -f /etc/php.ini.default /etc/php.ini && echo -n "3, "
|
92 |
[ -e /etc/httpd/conf/httpd.conf.default ] && mv /etc/httpd/conf/httpd.conf.default /etc/httpd/conf/httpd.conf && echo -n "4, "
|
98 |
[ -e /etc/httpd/conf/httpd.conf.default ] && mv /etc/httpd/conf/httpd.conf.default /etc/httpd/conf/httpd.conf && echo -n "4, "
|
93 |
[ -e /etc/httpd/conf/modules.d/00_base.conf.default ] && mv /etc/httpd/conf/modules.d/00_base.conf.default /etc/httpd/conf/modules.d/00_base.conf && echo -n "5, "
|
99 |
[ -e /etc/httpd/conf/modules.d/00_base.conf.default ] && mv /etc/httpd/conf/modules.d/00_base.conf.default /etc/httpd/conf/modules.d/00_base.conf && echo -n "5, "
|
94 |
[ -e /etc/httpd/conf/conf.d/ssl.conf.default ] && mv /etc/httpd/conf/conf.d/ssl.conf.default /etc/httpd/conf/conf.d/ssl.conf && echo -n "6, "
|
100 |
[ -e /etc/httpd/conf/conf.d/ssl.conf.default ] && mv /etc/httpd/conf/conf.d/ssl.conf.default /etc/httpd/conf/conf.d/ssl.conf && echo -n "6, "
|
95 |
[ -e /etc/httpd/conf/conf.d/multilang-errordoc.conf.default ] && mv /etc/httpd/conf/conf.d/multilang-errordoc.conf.default /etc/httpd/conf/conf.d/multilang-errordoc.conf && echo -n "7, "
|
101 |
[ -e /etc/httpd/conf/conf.d/multilang-errordoc.conf.default ] && mv /etc/httpd/conf/conf.d/multilang-errordoc.conf.default /etc/httpd/conf/conf.d/multilang-errordoc.conf && echo -n "7, "
|
96 |
[ -e /usr/share/httpd/error/include/top.html.default ] && mv /usr/share/httpd/error/include/top.html.default /usr/share/httpd/error/include/top.html && echo -n "8, "
|
102 |
[ -e /usr/share/httpd/error/include/top.html.default ] && mv /usr/share/httpd/error/include/top.html.default /usr/share/httpd/error/include/top.html && echo -n "8, "
|
Line 212... |
Line 218... |
212 |
|
218 |
|
213 |
echo -en "\n- fail2ban (8) : "
|
219 |
echo -en "\n- fail2ban (8) : "
|
214 |
[ -e /etc/fail2ban/fail2ban.conf.default ] && mv /etc/fail2ban/fail2ban.conf.default /etc/fail2ban/fail2ban.conf && echo -n "1, "
|
220 |
[ -e /etc/fail2ban/fail2ban.conf.default ] && mv /etc/fail2ban/fail2ban.conf.default /etc/fail2ban/fail2ban.conf && echo -n "1, "
|
215 |
[ -e /etc/fail2ban/jail.conf.default ] && mv /etc/fail2ban/jail.conf.default /etc/fail2ban/jail.conf && echo -n "2, "
|
221 |
[ -e /etc/fail2ban/jail.conf.default ] && mv /etc/fail2ban/jail.conf.default /etc/fail2ban/jail.conf && echo -n "2, "
|
216 |
[ -e /etc/fail2ban/action.d/iptables-allports.conf.default ] && mv /etc/fail2ban/action.d/iptables-allports.conf.default /etc/fail2ban/action.d/iptables-allports.conf && echo -n "3, "
|
222 |
[ -e /etc/fail2ban/action.d/iptables-allports.conf.default ] && mv /etc/fail2ban/action.d/iptables-allports.conf.default /etc/fail2ban/action.d/iptables-allports.conf && echo -n "3, "
|
- |
|
223 |
i=3
|
217 |
[ -e /etc/fail2ban/filter.d/alcasar_mod-evasive.conf ] && rm /etc/fail2ban/filter.d/alcasar_mod-evasive.conf && echo -n "4, "
|
224 |
for filter in `ls /etc/fail2ban/filter.d/alcasar_*`
|
218 |
[ -e /etc/fail2ban/filter.d/alcasar_acc-htdigest.conf ] && rm /etc/fail2ban/filter.d/alcasar_acc-htdigest.conf && echo -n "5, "
|
- |
|
- |
|
225 |
do
|
219 |
[ -e /etc/fail2ban/filter.d/alcasar_intercept.conf ] && rm /etc/fail2ban/filter.d/alcasar_intercept.conf && echo -n "6, "
|
226 |
i=`expr $i + 1`
|
220 |
[ -e /etc/fail2ban/filter.d/alcasar_change-pwd.conf ] && rm /etc/fail2ban/filter.d/alcasar_change-pwd.conf && echo -n "7, "
|
227 |
rm $filter && echo -n "$i, "
|
- |
|
228 |
done
|
221 |
[ -e /lib/systemd/system/fail2ban.service.default ] && mv /lib/systemd/system/fail2ban.service.default /lib/systemd/system/fail2ban.service && echo -n "8"
|
229 |
[ -e /lib/systemd/system/fail2ban.service.default ] && mv /lib/systemd/system/fail2ban.service.default /lib/systemd/system/fail2ban.service && echo -n "8"
|
222 |
sleep 1
|
230 |
sleep 1
|
223 |
|
231 |
|
224 |
echo -en "\n- cron (10) : "
|
232 |
echo -en "\n- cron (11) : "
|
- |
|
233 |
i=0
|
225 |
[ -e /etc/crontab.default ] && mv /etc/crontab.default /etc/crontab && echo -n "1, "
|
234 |
for cron in `ls /etc/cron.d/alcasar-*`
|
226 |
[ -e /etc/anacrontab.default ] && mv /etc/anacrontab.default /etc/anacrontab && echo -n "2, "
|
- |
|
- |
|
235 |
do
|
227 |
[ -e /etc/cron.d/alcasar-mysql ] && rm -f /etc/cron.d/alcasar-mysql && echo -n "3, "
|
236 |
i=`expr $i + 1`
|
228 |
[ -e /etc/cron.d/alcasar-archive ] && rm -f /etc/cron.d/alcasar-archive && echo -n "4, "
|
237 |
rm $cron && echo -n "$i, "
|
229 |
[ -e /etc/cron.d/alcasar-ticket-clean ] && rm -f /etc/cron.d/alcasar-ticket-clean && echo -n "5, "
|
- |
|
230 |
[ -e /etc/cron.d/alcasar-distrib-updates ] && rm -f /etc/cron.d/alcasar-distrib-updates && echo -n "6, "
|
- |
|
231 |
[ -e /etc/cron.d/alcasar-connections-stats ] && rm -f /etc/cron.d/alcasar-connections-stats && echo -n "7, "
|
- |
|
- |
|
238 |
done
|
232 |
[ -e /etc/cron.d/alcasar-watchdog ] && rm -f /etc/cron.d/alcasar-watchdog && echo -n "8, "
|
239 |
[ -e /etc/crontab.default ] && mv /etc/crontab.default /etc/crontab && echo -n "10, "
|
233 |
[ -e /etc/cron.d/alcasar-daemon-watchdog ] && rm -f /etc/cron.d/alcasar-daemon-watchdog && echo -n "9, "
|
- |
|
234 |
[ -e /etc/cron.d/alcasar-rsync-bl ] && rm -f /etc/cron.d/alcasar-rsync-bl && echo -n "10,"
|
240 |
[ -e /etc/anacrontab.default ] && mv /etc/anacrontab.default /etc/anacrontab && echo -n "11"
|
235 |
sleep 1
|
241 |
sleep 1
|
236 |
|
242 |
|
237 |
echo -en "\n- gammu-smsd (3) : "
|
243 |
echo -en "\n- gammu-smsd (3) : "
|
238 |
[ -e /etc/gammu_smsd_conf ] && rm -f /etc/gammu_smsd_conf && echo -n "1, "
|
244 |
[ -e /etc/gammu_smsd_conf ] && rm -f /etc/gammu_smsd_conf && echo -n "1, "
|
239 |
[ -e /lib/udev/rules.d/66-huawei.rules ] && rm -f /lib/udev/rules.d/66-huawei.rules && echo -n "2, "
|
245 |
[ -e /lib/udev/rules.d/66-huawei.rules ] && rm -f /lib/udev/rules.d/66-huawei.rules && echo -n "2, "
|
Line 266... |
Line 272... |
266 |
do
|
272 |
do
|
267 |
i=`expr $i + 1`
|
273 |
i=`expr $i + 1`
|
268 |
/sbin/ifdown $nic
|
274 |
/sbin/ifdown $nic
|
269 |
[ -e /etc/sysconfig/network-scripts/default-ifcfg-$nic ] && mv -f /etc/sysconfig/network-scripts/default-ifcfg-$nic /etc/sysconfig/network-scripts/ifcfg-$nic && echo -n "$i, "
|
275 |
[ -e /etc/sysconfig/network-scripts/default-ifcfg-$nic ] && mv -f /etc/sysconfig/network-scripts/default-ifcfg-$nic /etc/sysconfig/network-scripts/ifcfg-$nic && echo -n "$i, "
|
270 |
done
|
276 |
done
|
271 |
[ -e /etc/sysconfig/network.default ] && mv /etc/sysconfig/network.default /etc/sysconfig/network && echo -n "3, "
|
277 |
[ -e /etc/sysconfig/network.default ] && mv -f /etc/sysconfig/network.default /etc/sysconfig/network && echo -n "3, "
|
272 |
[ -e /etc/hosts.default ] && mv /etc/hosts.default /etc/hosts && echo -n "4, "
|
278 |
[ -e /etc/hosts.default ] && mv -f /etc/hosts.default /etc/hosts && echo -n "4, "
|
273 |
[ -e /etc/hosts.allow.default ] && mv /etc/hosts.allow.default /etc/hosts.allow && echo -n "5, "
|
279 |
[ -e /etc/hosts.allow.default ] && mv -f /etc/hosts.allow.default /etc/hosts.allow && echo -n "5, "
|
274 |
[ -e /etc/hosts.deny.default ] && mv /etc/hosts.deny.default /etc/hosts.deny && echo -n "6, "
|
280 |
[ -e /etc/hosts.deny.default ] && mv -f /etc/hosts.deny.default /etc/hosts.deny && echo -n "6, "
|
275 |
[ -e /etc/modprobe.preload.default ] && mv /etc/modprobe.preload.default /etc/modprobe.preload && echo -n "7, "
|
281 |
[ -e /etc/modprobe.preload.default ] && mv -f /etc/modprobe.preload.default /etc/modprobe.preload && echo -n "7, "
|
276 |
[ -e /lib/systemd/system/iptables.service.default ] && mv /lib/systemd/system/iptables.service.default /lib/systemd/system/iptables.service && echo -n "8, "
|
282 |
[ -e /lib/systemd/system/iptables.service.default ] && mv -f /lib/systemd/system/iptables.service.default /lib/systemd/system/iptables.service && echo -n "8, "
|
277 |
[ -e /usr/libexec/iptables.init.default ] && mv /usr/libexec/iptables.init.default /usr/libexec/iptables.init && echo -n "9"
|
283 |
[ -e /usr/libexec/iptables.init.default ] && mv -f /usr/libexec/iptables.init.default /usr/libexec/iptables.init && echo -n "9"
|
278 |
/sbin/ifup $EXTIF
|
284 |
/sbin/ifup $EXTIF
|
279 |
sleep 1
|
285 |
sleep 1
|
280 |
fi
|
286 |
fi
|
281 |
|
287 |
|
282 |
#post_install
|
288 |
#post_install
|
283 |
echo -en "\n- post_install (6) : "
|
289 |
echo -en "\n- post_install (7) : "
|
284 |
[ -e /etc/mageia-release.default ] && mv /etc/mageia-release.default /etc/mageia-release && echo -n "1, "
|
290 |
[ -e /etc/mageia-release.default ] && mv -f /etc/mageia-release.default /etc/mageia-release && echo -n "1, "
|
285 |
[ -e /etc/ssh/alcasar-banner-ssh ] && rm -f /etc/ssh/alcasar-banner-ssh && echo -n "2, "
|
291 |
[ -e /etc/ssh/alcasar-banner-ssh ] && rm -f /etc/ssh/alcasar-banner-ssh && echo -n "2, "
|
286 |
[ -e /etc/ssh/sshd_config.default ] && mv /etc/ssh/sshd_config.default /etc/ssh/sshd_config && echo -n "3, "
|
292 |
[ -e /etc/ssh/sshd_config.default ] && mv -f /etc/ssh/sshd_config.default /etc/ssh/sshd_config && echo -n "3, "
|
287 |
[ -e /etc/bashrc.default ] && mv /etc/bashrc.default /etc/bashrc && echo -n "4, "
|
293 |
[ -e /etc/bashrc.default ] && mv -f /etc/bashrc.default /etc/bashrc && echo -n "4, "
|
288 |
[ -e /etc/sudoers.default ] && mv /etc/sudoers.default /etc/sudoers && echo -n "5, "
|
294 |
[ -e /etc/sudoers.default ] && mv -f /etc/sudoers.default /etc/sudoers && echo -n "5, "
|
289 |
[ -e /lib/systemd/system/alcasar-load_balancing.service ] && rm -f /lib/systemd/system/alcasar-load_balancing.service && echo -n "6"
|
295 |
[ -e /lib/systemd/system/alcasar-load_balancing.service ] && rm -f /lib/systemd/system/alcasar-load_balancing.service && echo -n "6, "
|
- |
|
296 |
[ -e /etc/default/grub.default ] && mv -f /etc/default/grub.default /etc/default/grub && echo -n "7"
|
290 |
sleep 1
|
297 |
sleep 1
|
291 |
|
298 |
|
292 |
# Cleaning (remove all "old" alcasar scripts)
|
299 |
# Cleaning (remove all "old" alcasar scripts)
|
293 |
echo -en "\n- End of cleaning ...\n"
|
300 |
echo -en "\n- End of cleaning ...\n"
|
294 |
for rm_fic in /usr/local/bin /usr/local/etc /usr/local/sbin
|
301 |
for rm_fic in /usr/local/bin /usr/local/etc /usr/local/sbin
|