Coder Social home page Coder Social logo

elpop / sipban Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 10.0 105 KB

Block unwanted registrations from SIP Scan attack using Asterisk AMI and iptables

License: GNU General Public License v3.0

Shell 6.42% Mathematica 0.02% Perl 89.81% Dockerfile 2.91% Makefile 0.84%
asterisk asterisk-ami asterisk-pbx docker iptables security sip sip-scanning-attacks

sipban's People

Contributors

elpop avatar lordbasex avatar rico29 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sipban's Issues

Incompatibility on Asterisk 18?

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

Almalinux 8 test

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

fail2ban AND sipban incompatibility ?

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.