| 3 |
liveuser |
1 |
#!/bin/bash
|
|
|
2 |
|
|
|
3 |
#
|
|
|
4 |
# QBPWCF, Quick Build PHP website Component base on Fedora Linux.
|
|
|
5 |
# Copyright (C) 2015~2024 Min-Jhin,Chen
|
|
|
6 |
#
|
|
|
7 |
# This file is part of QBPWCF.
|
|
|
8 |
#
|
|
|
9 |
# QBPWCF is free software: you can redistribute it and/or modify
|
|
|
10 |
# it under the terms of the GNU General Public License as published by
|
|
|
11 |
# the Free Software Foundation, either version 3 of the License, or
|
|
|
12 |
# (at your option) any later version.
|
|
|
13 |
#
|
|
|
14 |
# QBPWCF is distributed in the hope that it will be useful,
|
|
|
15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
17 |
# GNU General Public License for more details.
|
|
|
18 |
#
|
|
|
19 |
# You should have received a copy of the GNU General Public License
|
|
|
20 |
# along with QBPWCF. If not, see <http://www.gnu.org/licenses/>.
|
|
|
21 |
#
|
|
|
22 |
|
|
|
23 |
#get ip to unblock
|
|
|
24 |
read -p 'Please run in root, then enter IP which should be Blocked:' ip;
|
|
|
25 |
|
|
|
26 |
#check ip repeated
|
|
|
27 |
ip_repeated=`firewall-cmd --list-all | grep ${ip} | wc -l`;
|
|
|
28 |
|
|
|
29 |
if [ ${ip_repeated} == 1 ];then
|
|
|
30 |
|
|
|
31 |
#unblock ip & reload firewall
|
|
|
32 |
firewall-cmd --remove-rich-rule="rule family=ipv4 source address=${ip} reject";
|
|
|
33 |
|
|
|
34 |
#comment is unblocked
|
|
|
35 |
echo "${ip} is unblocked.";
|
|
|
36 |
else
|
|
|
37 |
|
|
|
38 |
#comment is unblocked
|
|
|
39 |
echo "${ip} is unblocked.";
|
|
|
40 |
fi
|