[OpenSIPS-Users] OpenSIPS and REDIS

Michele Pinassi michele.pinassi at unisi.it
Wed Jun 14 03:45:58 EDT 2017


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


-- 
Michele Pinassi
Responsabile Telefonia di Ateneo
Servizio Reti, Sistemi e Sicurezza Informatica - Università degli Studi di Siena
tel: 0577.(23)5000 - centralino at unisi.it

Per trovare una soluzione rapida ai tuoi problemi tecnici consulta le FAQ di Ateneo, http://www.faq.unisi.it 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.opensips.org/pipermail/users/attachments/20170614/fe5c6212/attachment.sig>


More information about the Users mailing list