@@ -1358,10 +1358,12 @@ iplimit_main() {
1358
1358
echo -e " ${green} \t2.${plain} Change Ban Duration"
1359
1359
echo -e " ${green} \t3.${plain} Unban Everyone"
1360
1360
echo -e " ${green} \t4.${plain} Ban Logs"
1361
- echo -e " ${green} \t5.${plain} Real-Time Logs"
1362
- echo -e " ${green} \t6.${plain} Service Status"
1363
- echo -e " ${green} \t7.${plain} Service Restart"
1364
- echo -e " ${green} \t8.${plain} Uninstall Fail2ban and IP Limit"
1361
+ echo -e " ${green} \t5.${plain} Unban an IP Address"
1362
+ echo -e " ${green} \t6.${plain} Ban an IP Address"
1363
+ echo -e " ${green} \t7.${plain} Real-Time Logs"
1364
+ echo -e " ${green} \t8.${plain} Service Status"
1365
+ echo -e " ${green} \t9.${plain} Service Restart"
1366
+ echo -e " ${green} \t10.${plain} Uninstall Fail2ban and IP Limit"
1365
1367
echo -e " ${green} \t0.${plain} Back to Main Menu"
1366
1368
read -p " Choose an option: " choice
1367
1369
case " $choice " in
@@ -1389,7 +1391,7 @@ iplimit_main() {
1389
1391
3)
1390
1392
confirm " Proceed with Unbanning everyone from IP Limit jail?" " y"
1391
1393
if [[ $? == 0 ]]; then
1392
- fail2ban-client set 3x-ipl unban --all
1394
+ systemctl restart fail2ban
1393
1395
truncate -s 0 " ${iplimit_banned_log_path} "
1394
1396
echo -e " ${green} All users Unbanned successfully.${plain} "
1395
1397
iplimit_main
@@ -1403,18 +1405,38 @@ iplimit_main() {
1403
1405
iplimit_main
1404
1406
;;
1405
1407
5)
1406
- tail -f /var/log/fail2ban.log
1408
+ read -rp " Enter the IP address you want to ban: " ban_ip
1409
+ if [[ $ban_ip =~ ^[0-9]+\. [0-9]+\. [0-9]+\. [0-9]+$ ]]; then
1410
+ fail2ban-client set 3x-ipl banip " $ban_ip "
1411
+ echo -e " ${green} IP Address ${ban_ip} has been banned successfully.${plain} "
1412
+ else
1413
+ echo -e " ${red} Invalid IP address format! Please try again.${plain} "
1414
+ fi
1407
1415
iplimit_main
1408
1416
;;
1409
1417
6)
1410
- service fail2ban status
1418
+ read -rp " Enter the IP address you want to unban: " unban_ip
1419
+ if [[ $unban_ip =~ ^[0-9]+\. [0-9]+\. [0-9]+\. [0-9]+$ ]]; then
1420
+ fail2ban-client set 3x-ipl unbanip " $unban_ip "
1421
+ echo -e " ${green} IP Address ${unban_ip} has been unbanned successfully.${plain} "
1422
+ else
1423
+ echo -e " ${red} Invalid IP address format! Please try again.${plain} "
1424
+ fi
1411
1425
iplimit_main
1412
1426
;;
1413
1427
7)
1414
- systemctl restart fail2ban
1428
+ tail -f /var/log/ fail2ban.log
1415
1429
iplimit_main
1416
1430
;;
1417
1431
8)
1432
+ service fail2ban status
1433
+ iplimit_main
1434
+ ;;
1435
+ 9)
1436
+ systemctl restart fail2ban
1437
+ iplimit_main
1438
+ ;;
1439
+ 10)
1418
1440
remove_iplimit
1419
1441
iplimit_main
1420
1442
;;
0 commit comments