<div dir="ltr">I am using the following script to ban users failing to authenticate with fail2ban:<div>My problem is that it logs attempts of users only existing to the database</div><div>I would like to modify it in order to log all FAILED authentication attempts</div><div>Is this possible?</div><div> </div><div><div># Authentication route</div><div>route[AUTH] {</div><div>#!ifdef WITH_AUTH</div><div><br></div><div>  if(is_present_hf("Authorization"))</div><div>  {</div><div>    if($sht(a=>$au::auth_count)==3)</div><div>    {</div><div>     <span class="" style="white-space:pre">  </span>$var(exp) = $Ts - 900;</div><div>        if($sht(a=>$au::last_auth) > $var(exp))</div><div>        {</div><div>            sl_send_reply("403", "Try later");</div><div>            exit;</div><div>        } else {</div><div>            $sht(a=>$au::auth_count) = 0;</div><div>        }</div><div>    }</div><div>    if(!www_authenticate("$td", "subscriber"))</div><div>    {</div><div>     <span class="" style="white-space:pre">     </span>switch ($retcode) {</div><div>            case -1:</div><div>                sl_send_reply("403", "Forbidden");</div><div>            exit;</div><div>            case -2:</div><div>#fixed null -> $null:</div><div>                if($sht(a=>$au::auth_count) == $null)</div><div>                    $sht(a=>$au::auth_count) = 0;</div><div>                $sht(a=>$au::auth_count) = $sht(a=>$au::auth_count) + 1;</div><div>xlog("User $fu Authenticating from ip $si\n");</div><div>                if($sht(a=>$au::auth_count) == 3)</div><div>xlog("User $fU Authenticating for the 3d time from ip $si\n");</div><div>                $sht(a=>$au::last_auth) = $Ts;</div><div>            break;</div><div>        }</div><div><span class="" style="white-space:pre">       </span>www_challenge("$td"/*realm*/,"0"/*qop*/);</div><div>        exit;</div><div>    }</div><div>    $sht(a=>$au::auth_count) = 0;</div><div>  } else {</div><div>    www_challenge("$td","0");</div><div>    exit;</div><div>  }</div><div>}</div><div>#!endif<br></div></div></div>