[OpenSIPS-Users] How to recalculate ha1 and ha1b

Dioris Moreno nesken at gmail.com
Fri Jul 10 03:12:47 CEST 2009


When you change the domain column in the subscriber table, you have to
recalculate ha1 and ha1b fields. In order to do that you must have the
password of each subscriber. It is stored in the 'password' column if you
have set STORE_PLAINTEXT_PW=1 in opensipsctlrc (default).

HA1 is a MD5 hash of "username:domain:password". For example, if you have
created a SIP account 1000 at mydomain.com using password 123456, then HA1 is
the MD5 hash of "1000:mydomain.com:123456" (without quotes). On the other
hand HA1B is the MD5 hash of "username at domain:domain:password"; so using the
same example above, HA1B would be the MD5 hash of "1000 at mydomain.com:m
ydomain.com:123456" (without quotes).

So, to recalculate and update ha1 and ha1b columns in the subscriber table,
just execute the following sql statement in mysql:

update subscriber
set ha1 = md5(concat(username, ':', domain, ':', password)),
ha1b = md5(concat(username, '@', domain, ':', domain, ':', password))

I hope this could be useful.

Regards,

Dioris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20090709/5d1ec2f1/attachment.htm 


More information about the Users mailing list