Score:0

Monitor Openvpn log and if it get specific alert.......then execute iptable command to ban IP

in flag

I am looking to secure my openvpn server and to automatically ban unauthorized login attempts. I am looking for a script that will do the following:

-Monitor /var/log/openvpnas.log

-Look for the following in the log...."Non-OpenVPN client protocol detected"

-This text is preceded by the IP and Port # of the connection attempt

xxx.xxx.xxx.xxx:zzzzz Non-OpenVPN client protocol detected'

xxx.xxx.xxx.xxx = IP

zzzzz = Port #

-If the text "Non-OpenVPN client protocol detected" is detected in log, then issue the following iptable command to ban the IP:

iptables -I INPUT -s xxx.xxx.xxx.xxx -j DROP

service iptables save

Thanx!

Doug Smythies avatar
gn flag
I don't use it, but I think fail2ban can do what you want.
in flag
Fail2ban works with SSH....I've not scene any examples for Openvpn access attempts.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.