CSF Firewall to ban failed logins?

Status
Not open for further replies.

netizen

Joined
Mar 14, 2009
Messages
40
Reaction score
0
Hello,

Is someone here using Elastix with CSF firewall for system protection?
I would like to know how you ban the failed SIP/IAX logins.
I saw an old post from Dicko but it doesn't work as it is probably an old version.

Your help is much appreciated! :(
N
 
are your SIP/IAX logins coming from internal LAN or outside?
I would be interested to hear more ways to secure this option too.

I am using CSF but will be switching to ip tables with Fail2ban for future builds as I get better at using iptables, as CSF with LFD has too many additional functions going on that I dont really need or want or know what it is doing.

I currently have csf.allow populated with just the phone LAN and my VoIP provider ip networks. I may restrict this further to specific ip ranges on the Phone LAN.
in csf.conf I block all inbound traffic completely on udp and tcp.(that way only items in csf.allow can come through)
and ports are restricted on outbound too with essentials only, like port 53 for DNS, 123 for NTP etc...
I have set csf.conf so it emails me if anyone logs in using ssh, though I dont know if there are ways for an experienced hacker to bypass this yet. I have heard of people getting in and then setting up ssh logins and using .call hidden files to 'borrow' a PBX.
at which point even SIP/IAX blocking might be ineffectual.
there is also a lot of processes in lfd you have to disable from reporting if you dont want email floods once you get the email working.

I am also restricting SIP extensions to particular ip addresses on the PBX so only the phone I want can access it, theoretically.

expanding on the topic a little but here is a good thread on PBX security that may help you make the choices on action to take with csf & lfd. This comes from people who got hacked and they advised me of the above settings with csf, what better way to learn I guess...

http://forums.whirlpool.net.au/archive/1516379

I would also add that I am considering adding ACL restrictions on the switch to restrict traffic coming into the PBX from the LAN, and the router is locked down as much as possible to the VoIP provider with NO SSH inbound allowed from public side, not even on a different port as this is the way I have heard most people get hacked.
 
netizen said:
Hello,

Is someone here using Elastix with CSF firewall for system protection?
I would like to know how you ban the failed SIP/IAX logins.
I saw an old post from Dicko but it doesn't work as it is probably an old version.

Your help is much appreciated! :(
N

If you configure the firewall in CSF correctly ,you will not need to worry about SIP/IAx login attempts.
The ports will be closed to unwanted connections and will only be open to what you allow through the firewall.
http://elastixconnection.com/index.php? ... Itemid=120
 
DaveD said:
If you configure the firewall in CSF correctly ,you will not need to worry about SIP/IAx login attempts.
The ports will be closed to unwanted connections and will only be open to what you allow through the firewall.
http://elastixconnection.com/index.php? ... Itemid=120

Thank you for the response.
Configuring the CSF *correctly* does not mean configuring it according to your requirements (which in this case is LAN, or known IPs only).

My setup requires the port 5060 to be open on all IPs (except known blacklists).
Considering the requirement, what it the best method to ban IPs that brute force the 5060 port, having in mind that CSF IS a necessity on the system?

Blocking all IPs except whitelisted is only *the easy way* which in my case is not appropriate.

So?
 
soborno said:

Thank you for the reply.
Not only I tried searching but if you see link No2 has a very recent post of mine asking the same question as here (almost).

Link No1 is not appropriate to my requirements, which is to have 5060 open to all IPs as I have extensions which connenct from dynamic external IPs that can be everywhere.

Link No3 is not in english and Google Translation is not good :(

In any case, the requirement here is how to block brute force attacks on asterisk that comes bundled with the Elastix, latest stable version, having in mind that CSF/LFD firewall is installed.


Does anybody have an answer to this?
 
Csf has the ability to do dyndns for external phones.

Also you can run fail2ban with CSF and have CSF look at the fail2ban logs.But fail2ban only looks at logs to decide what to do anyway,so just have CSF look at connection attempts to specific ports.
 
I believe csf has its own version of fail2ban and it is not recommended to install both on the same server.
This would need confirming but I went with that recommendation since if you look at the csf ip table structure adding in fail2ban on top of that might get messy.
 
I have run fail2ban and CSF on the same machine with no issues.

In saying that ,you are correct CSF will detect the SIP/IAX scan attempts and ban the ip.
So really no need to double up.

The difference is CSF will deny connection to start with based on your rules where fail2ban kicks in after it has checked the logs
 
I think we are going around in circles here...
What I am interested in is the correct REGEX that CSF/LFD can use to read the asterisk log and perform the ban.

Does someone have that?
 
To make it easy you do not need the regex, CSF picks up the SIP/ attacks.

I tested this today out of curiosity and it read the asterisk logs perfect
 
So you're saying that the latest version of CSF will read the /var/log/asterisk/full, identify failed login attemtps and subsequently ban those IPs?

Are you sure that you haven't done any minor mods on either Elastix/Asterisk or CSF/LFD?
 
I have not modified any of the log routes in LFD at all
 
Hi trkostas,

It doesn't seem to be working with me :(
Do I need to replace "myasteriskmatch" with "my elastix IP" ????
 
This is notice I get when someone is using wrong password however the regext does not work:

NOTICE[2846] chan_sip.c: Registration from '"123123" <sip:[email protected]>' failed for '2.2.2.2:53490' - Wrong password


where 1.1.1.1 is my Elastix IP &
2.2.2.2 is the ip of the client that tries to login.

Any suggestions?
 
Status
Not open for further replies.

Latest Posts

Members Online Now

Forum statistics

Threads
111,861
Messages
589,439
Members
164,701
Latest member
yarusemiKK