-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpostfix-autoBlacklisting-UNINSTALL.sh
executable file
·74 lines (58 loc) · 2.16 KB
/
postfix-autoBlacklisting-UNINSTALL.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
#
# Author/Developer: Terrence Houlahan Linux Engineer F1Linux.com
# Linkedin: https://www.linkedin.com/in/terrencehoulahan
# License: GPL 3.0
# Source: https://github.com/f1linux/postfix-autoBlacklisting.git
# Version: 03.20.00
cat<<'EOF'> /etc/postfix/postfix-autoBlacklisting-UNINSTALL.sh
#!/bin/bash
#
# Author/Developer: Terrence Houlahan Linux Engineer F1Linux.com
# Linkedin: https://www.linkedin.com/in/terrencehoulahan
# License: GPL 3.0
# Source: https://github.com/f1linux/postfix-autoBlacklisting.git
# Version: 03.20.00
systemctl stop Postfix-AutoBlacklisting.service
systemctl stop Postfix-AutoBlacklisting.timer
systemctl disable Postfix-AutoBlacklisting.service
systemctl disable Postfix-AutoBlacklisting.timer
systemctl daemon-reload
rm /etc/systemd/system/Postfix-AutoBlacklisting.service
rm /etc/systemd/system/Postfix-AutoBlacklisting.timer
rm /etc/postfix/access-autoBlacklisting.sh
rm /etc/postfix/postfix-autoBlacklisting-UNINSTALL.sh
rm -r /root/postfix-autoBlacklisting
unset arrayIPblacklist
echo
echo 'Delete any scratch files used to build the block list:'
if [ -f /etc/postfix/access-blacklist ]; then
rm /etc/postfix/access-blacklist
echo 'Deleted /etc/postfix/access-blacklist'
fi
# Below are left for legacy purposes- to be removed at some point in future
# The way blacklist builds materially changed and below files now obsolete:
if [ -f /etc/postfix/access-AutoBlackList.txt ]; then
rm /etc/postfix/access-AutoBlackList.txt
echo 'Deleted/etc/postfix/access-AutoBlackList.txt'
fi
if [ -f /etc/postfix/active-IP-block-list.txt ]; then
rm /etc/postfix/active-IP-block-list.txt
echo 'Deleted /etc/postfix/active-IP-block-list.txt'
fi
if [ -f /etc/postfix/updated-IP-block-list.txt ]; then
rm /etc/postfix/updated-IP-block-list.txt
echo 'Deleted /etc/postfix/updated-IP-block-list.txt'
fi
echo
echo 'Current IPs being blocked in /etc/postfix/access'
echo 'Have NOT been cleared. If you wish to clear them'
echo 'execute below command to clear them en masse:'
echo
echo "sed -i '/.*REJECT/d' /etc/postfix/access"
echo
echo
echo 'postfix-autoBlacklisting-UNINSTALL.sh Completed'
echo
EOF
chmod 744 /etc/postfix/postfix-autoBlacklisting-UNINSTALL.sh