There's a fail2ban-client set unabnip <IP> command but you also need to provide 
the JAIL in which it was banned, so it gets a little complicated, so for each 
IP you should issue this command for all the jails you have. For example :  

root@messagerie[10.10.10.19] ~ # fail2ban-client set ssh unbanip 49.80.42.240
ERROR  NOK: ('IP 49.80.42.240 is not banned',)
IP 49.80.42.240 is not banned
root@messagerie[10.10.10.19] ~ #

root@messagerie[10.10.10.19] ~ # fail2ban-client set postfix-sasl unbanip 
49.80.42.240
49.80.42.240
root@messagerie[10.10.10.19] ~ #


The IP was banned in postfix-sasl but not in ssh.

You can probably go from there :
(while read IP; do for jail in ssh postfix-sasl dovecot roundcube-auth (...); 
do fail2ban-client set "$jail" unabnip "$IP"; done; done) < 
/etc/fail2ban/test.txt.
I haven't tested it but you get the idea.
Yassine.



 

    On Thursday, March 29, 2018, 12:15:14 PM GMT+1, Jaydeep Zala 
<[email protected]> wrote:  
 
 Hello Yassine,

I'd create MySQL query  mysql -uuser -ppassword -Ddatabase -s -N -e 'SELECT 
GROUP_CONCAT(fw_ip) FROM (fail2ban_whitelist);' > /etc/fail2ban/test.txt

This query in crontab thus it will continue updating the test.txt file  

in test.txt I have a list of My Ip's which comes from my database and I've to 
whitelist all the IP's which are in my database.

I tried lot's of stuff but I didn't get success to whitelist my IP's. 

Can you Please guide me how can I do this or any alternative to this?

thanks & regards,
Jaydeep

On Thu, Mar 29, 2018 at 4:32 PM, chaouche yacine via Fail2ban-users 
<[email protected]> wrote:

 Hello Jaydeep,
I was wondering what you mean by dynamically ? can you give a scenario or use 
case ? 
Yassine
    On Thursday, March 29, 2018, 11:01:49 AM GMT+1, Jaydeep Zala 
<[email protected]> wrote:  
 
 Hello guys,
How can I whitelist my IP's dynamically, means from SQL query..?
anyone have an idea about this? 

-- 
Thanks & RegardsJaydeep Zala
------------------------------ ------------------------------ ------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot______ 
______________________________ ___________
Fail2ban-users mailing list
Fail2ban-users@lists. sourceforge.net
https://lists.sourceforge.net/ lists/listinfo/fail2ban-users
  
------------------------------ ------------------------------ ------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
______________________________ _________________
Fail2ban-users mailing list
Fail2ban-users@lists. sourceforge.net
https://lists.sourceforge.net/ lists/listinfo/fail2ban-users





-- 
Thanks & RegardsJaydeep Zala


Ecosmob Technologies Pvt. Ltd. 
https://www.ecosmob.com
  
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fail2ban-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fail2ban-users

Reply via email to