elpop / sipban Goto Github PK
View Code? Open in Web Editor NEWBlock unwanted registrations from SIP Scan attack using Asterisk AMI and iptables
License: GNU General Public License v3.0
Block unwanted registrations from SIP Scan attack using Asterisk AMI and iptables
License: GNU General Public License v3.0
Hi,
I've just installed an Asterisk 18, to test SIPBAN and after several registration failures no IP addresses are blocked:
[Jun 23 10:22:21] NOTICE[3606] res_pjsip/pjsip_distributor.c: Request 'REGISTER' from '<sip:XXXX@XXXXXXXX>' failed for 'YYYYYYYY:5062' (callid: [email protected]) - Failed to authenticate
After enabling AMI debug the events reported From Asterisk are ChallengeResponseFailed and I can't see this type of events on the code:
Event: ChallengeResponseFailed
Privilege: security,all
SequenceNumber: 67
File: manager.c
Line: 1864
Func: manager_default_msg_cb
EventTV: 2021-06-23T10:22:21.751+0200
Severity: Error
Service: PJSIP
EventVersion: 1
AccountID: XXXX
SessionID: [email protected]
LocalAddress: IPV4/UDP/XXXXXXXX/5060
RemoteAddress: IPV4/UDP/YYYYYYYY/5062
Challenge: 1624436541/3c34d6746cc5187774c60cd18cf793ce
Response: ffc167de33082dadd87a6479d9795c3f
ExpectedResponse:
I don't know if the Asterisk team ha changed anything but inside the Asterisk documentation, this type of event is defined since Asterisk 13:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+ManagerEvent_ChallengeResponseFailed
Could you please update the script?
Thank you
Hi, I'm doing tests and the service fails
sipban.service - SIP Ban Service
Loaded: loaded (/etc/systemd/system/sipban.service; enabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2023-05-08 11:24:58 CST; 162ms ago
Process: 30137 ExecStart=/usr/local/bin/sipban.pl (code=exited, status=2)
Main PID: 30137 (code=exited, status=2)
/etc/systemd/system/sipban.service:6: Failed to parse service type, ignoring: service
I made the change in this line:
Type=service
to
Type=notify
but without success
Hello,
I'm using fail2ban and sipban for asterisk on a server.
Fail2ban works fine, but sipban, when starting, does not put it's "$ipt -t filter -I INPUT -p udp --dport 5060 -j $Config{'iptables.chain'}" rule in INPUT chain.
So I have , when doing iptables -L -nv ๐
Chain INPUT (policy ACCEPT 805K packets, 149M bytes)
pkts bytes target prot opt in out source destination
20688 11M f2b-asterisk-udp udp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 5060
0 0 f2b-asterisk-tcp tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 5060
chain "sipban-udp" is correctly created :
Chain sipban-udp (0 references)
pkts bytes target prot opt in out source destination
0 0 REJECT all -- * * 54.36.166.196 0.0.0.0/0 reject-with icmp-port-unreachable
0 0 REJECT all -- * * 62.4.14.74 0.0.0.0/0 reject-with icmp-port-unreachable
0 0 REJECT all -- * * 80.94.93.3 0.0.0.0/0 reject-with icmp-port-unreachable
0 0 REJECT all -- * * 80.94.93.32 0.0.0.0/0 reject-with icmp-port-unreachable
0 0 REJECT all -- * * 37.120.155.138 0.0.0.0/0 reject-with icmp-port-unreachable
0 0 REJECT all -- * * 40.76.244.210 0.0.0.0/0 reject-with icmp-port-unreachable
0 0 RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
I'm going to do more tests in the morning.
Regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.