<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.E-MailFormatvorlage18
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.E-MailFormatvorlage20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.E-MailFormatvorlage21
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE-AT link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>Btw the xlog don’t include a IP information of the request device:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US># xlog("L_INFO", "Request rejected, bad UA='$x_hdr(User-Agent)' - [% logreq_init -%]\n");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>So the right string should be looks like this:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US># xlog("L_NOTICE", "Request rejected, bad UA='$x_hdr(User-Agent)' from IP=$si - [% logreq_init -%]\n");<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>And the fail2ban regex like this then:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US># failregex = Request rejected, bad UA='.*' from IP=<HOST><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=DE>Von:</span></b><span lang=DE> Spce-user <spce-user-bounces@lists.sipwise.com> <b>Im Auftrag von </b>Hohl Matthias<br><b>Gesendet:</b> Dienstag, 26. März 2019 10:29<br><b>An:</b> 'Alex Lutay' <alutay@sipwise.com>; spce-user@lists.sipwise.com<br><b>Betreff:</b> Re: [Spce-user] Upgrade from 5.5.5 to 6.5.3 - Block Useragent Edit<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>Oh okay.. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>so to get fail2ban to work for this, I have to change the debug level to 2, but this will produce very big log files, or I change the kamailio.tt2 from xlog(“L_INFO” to xlog(“L_NOTICE<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>Right?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=DE>Von:</span></b><span lang=DE> Spce-user <<a href="mailto:spce-user-bounces@lists.sipwise.com">spce-user-bounces@lists.sipwise.com</a>> <b>Im Auftrag von </b>Alex Lutay<br><b>Gesendet:</b> Dienstag, 26. März 2019 10:23<br><b>An:</b> <a href="mailto:spce-user@lists.sipwise.com">spce-user@lists.sipwise.com</a><br><b>Betreff:</b> Re: [Spce-user] Upgrade from 5.5.5 to 6.5.3 - Block Useragent Edit<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hi,<br><br>The default kamailio log level is "NOTICE"<br>but the message has "INFO" level.<br>To increase the verbosity here use:<br><br>> ngcp-kamctl proxy fifo corex.debug 2<br><br>Thanks to Andrew Pogrebennyk for the hint here!<br><br>On 3/25/19 11:25 PM, Hohl Matthias wrote:<br>> i tried today the useragents blocking via config.yml file and the<br>> blocking works fine BUT I have no log entry anywhere.<br>> <br>> Neither in kamailio-proxy.log or in kamailio-lb.log<br>> <br>> But my phone with the bad user agent was rejected… I also tried it with<br>> blocked… it also works, but no log entry for it.<br>> <br>> Maybe I search on wrong place?<br>> <br>> I searched for “rejected” in proxy and lb log.<br><br>-- <br>Alex Lutay<br>_______________________________________________<br>Spce-user mailing list<br><a href="mailto:Spce-user@lists.sipwise.com">Spce-user@lists.sipwise.com</a><br><a href="https://lists.sipwise.com/listinfo/spce-user">https://lists.sipwise.com/listinfo/spce-user</a><o:p></o:p></p></div></body></html>