<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Michele,<br>
      <br>
      What you fetch from REDIS is the plain-text password, right ? Have
      you checked if the loaded pwd is correct ?<br>
      <br>
      Best regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
  OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a>

OpenSIPS Bootcamp 2017, Houston, US
  <a class="moz-txt-link-freetext" href="http://opensips.org/training/OpenSIPS_Bootcamp_2017.html">http://opensips.org/training/OpenSIPS_Bootcamp_2017.html</a>
</pre>
    <div class="moz-cite-prefix">On 06/14/2017 10:45 AM, Michele Pinassi
      wrote:<br>
    </div>
    <blockquote cite="mid:37d6c048-3e1b-3b0a-dbf3-ea867e55278a@unisi.it"
      type="cite">
      <pre wrap="">Hi all,

i'm trying to setup a REDIS cache to share register data with my two
OpenSIPS server, to have some redundancy.

On opensips.cfg:

#### AUTHentication modules
loadmodule "auth.so"
modparam("auth", "username_spec", "$var(username)")
modparam("auth", "password_spec", "$avp(password)")
modparam("auth", "disable_nonce_check", 1)

loadmodule "auth_db.so"
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "load_credentials", "$avp(password)=password")

[...]

#### Redis module
loadmodule "cachedb_redis.so"
modparam("cachedb_redis", "cachedb_url", "redis:voip://192.168.1.1:6379/")

[...]

### REGISTER
        if (is_method("REGISTER")) {
            # Check for cache...
           if(cache_fetch("redis:voip","passwd_$tU",$avp(password))) {
               $var(username) = $tU;
               $var(rc) = pv_www_authorize("");
           } else {
               # or authenticate the REGISTER requests...
                $var(rc) = www_authorize("","subscriber");
           }

            switch($var(rc)) {
                case 1 :
                   xlog("L_INFO", "Registration SUCCESS $fu\n");
                    # Save credentials to REDIS cache
                   
cache_store("redis:voip","passwd_$tU","$avp(password)",128000);
                    break;
                case -1:
                    xlog("L_ERR","Auth error for $fU@$fd from $si:
INVALID USER");
                    break;
                case -2:
                    xlog("L_ERR","Auth error for $fU@$fd from $si:
INVALID PASSWORD");
                    break;
                case -3: # Stale nonce - This is not an error, so don't
print anything
                    break;
                case -4:
                    www_challenge("", "0");
                    break;
                default:
                    xlog("L_ERR","Auth error for $fU@$fd from $si cause
$var(rc)");
            }

but i got an INVALID PASSWORD for all account stored in REDIS cache.
What's wrong ?

Thanks, Michele


</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>