[OpenSIPS-Users] OpenSIPs w/ Fail2Ban - Config ERROR cannot restart OpenSIPS after changes to OpenSIPs.cfg

Rick McGill - ₪ rick at netrovoip.com
Thu Feb 11 07:16:19 EST 2021


Dear OpenSIPs Community,

My goal for this topic is to get Fail2Ban working with OpenSIPs log files.
Same like the instructions in URL link below.

I have tried to follow the directions in this link but the code to edit the
logging of OpenSIPs looks at bit different on my new fresh install of
OpenSIPs 3.1 on Debian 10.7.
https://www.opensips.org/Documentation/Tutorials-Fail2Ban

The is what is in the link above:

-------
from:
----------------------------------------------------------------------------
------

 if (!www_authorize("", "subscriber")) {
	www_challenge("", "0");
	exit;
}
----------------------------------------------------------------------------
----

----
To:
----------------------------------------------------------------------------
-----

$var(auth_code) = www_authorize("", "subscriber");
if ( $var(auth_code) == -1 || $var(auth_code) == -2 ) {
		xlog("L_NOTICE","Auth error for $fU@$fd from $si cause
$var(auth_code)");
}
if ( $var(auth_code) < 0 ) {
		www_challenge("", "0");
		exit;
}
----------------------------------------------------------------------------
----

The issue is that my new install of OpenSIP has code a bit different.
Instead of "0" it has "AUTH".
And when I change the Code like the TO: section above OpenSIPS will not
start because it says Error in Config File it cannot load opensips.

------------
This is what the default code looks like in the opensips.cfg for OpenSIPS
3.1 after a new fresh install like I have:   Notice that www_challenger is
"auth" and not "0"   I have tried to enter it as '0" as per the instructions
in URL link above but that is when it then causes OpenSIPS to not be able to
restart.
----------------------------------------------------------------------------
----
	if (is_method("REGISTER")) {
		# authenticate the REGISTER requests
		if (!www_authorize("", "subscriber")) {
			www_challenge("", "auth");
			exit;
		}
----------------------------------------------------------------------------
----

Rick McGill – CEO
Rick at NetroVOIP.com     |     Rick at NetropolitanWorks.com 
Thailand: +66-2105-4262  x1001  |   USA: +1-737-237-2030   |    Mobile:
+66-85557-3000
Support:: +66-97047-2000  |  SKYPE & LINE ID:  NetroVOIP  |
Support at NetroVOIP.com 
  ₪  www.NetroVOIP.com  Telecommunications / Video Consulting & Solutions
Provider

LetSi.NetroVOIP.com

Video Conference Solution that works with Windows, MAC, Android, and iPhone.
Secure alternative to Zoom for NetroVOIP Cloud PBX customers.   






More information about the Users mailing list