📄 ser_radius.sgml
字号:
<section> <title>File <filename moreinfo="none">users</filename></title> <simpara> This file contains authentication information for each user. For testing purposes we will create user <quote>test</quote>. Put the following into the file: </simpara> <programlisting format="linespecific">test Auth-Type := Digest, User-Password == "test" Reply-Message = "Hello, test with digest"</programlisting> <simpara> The username and password is for testing only, you can safely remove the entry once your RADIUS server works and you are able to authenticate. </simpara> </section> </section> <section> <title>Test The Server</title> <note> <simpara> This step is optional. </simpara> </note> <simpara> The basic configuration of FreeRADIUS server is done it now we are going to test if it really works. Start the server with parameter -X. That will cause the server to stay in the foreground (it will not turn into daemon) and produce a lot of debugging information on the standard output: </simpara> <screen format="linespecific">root@/usr/local/src# radiusd -X</screen> <simpara> Create file <filename moreinfo="none">digest</filename> and put the following into the file: </simpara> <programlisting format="linespecific">User-Name = "test", Digest-Response = "631d6d73147add2f9e437f59bbc3aeb7", Digest-Realm = "testrealm", Digest-Nonce = "1234abcd" , Digest-Method = "INVITE", Digest-URI = "sip:5555551212@example.com", Digest-Algorithm = "MD5", Digest-User-Name = "test"</programlisting> <simpara> All the attributes must be on a single line. </simpara> <simpara> Run <command moreinfo="none">radclient</command> to test the server: </simpara> <screen format="linespecific">root@/usr/local/src# radclient -f digest localhost auth <shared_secret></screen> <note> <simpara> I suppose that you run the test utility directly on the &rad; server since it comes with the FreeRADIUS server package. That also means that you have to enable access from localhost in your <filename moreinfo="none">clients.conf</filename> file. Don't forget to replace <shared_secret> with the shared secret configured for locahost clients in <filename moreinfo="none">clients.conf</filename>. </simpara> </note> <simpara> If your server works properly then you should see the following response: </simpara> <screen format="linespecific">Received response ID 224, code 2, length = 45 Reply-Message = "Hello, test with digest"</screen> </section> <section> <title>Authentication Configuration</title> <simpara> To create user <quote>joe</quote> in domain <quote>iptel.org</quote> with password <quote>heslo</quote> put the following into file <filename moreinfo="none">/usr/local/etc/raddb/users</filename>: </simpara> <programlisting format="linespecific">joe@iptel.org Auth-Type := Digest, User-Password == "heslo" Reply-Message = "Authenticated", Sip-Rpid = "1234"</programlisting> <simpara> Attribute <quote>Sip-Rpid</quote> is optional. The attribute contains a phone number associated to the user. &ser; can be configured to put the phone number into Remote-Party-ID header field of the &sip; message. The header field can be then used by &pstn; gateways to display the number as the number of the caller on regular phones. You can omit the attribute if you don't need it. </simpara> </section> <section> <title>Accounting Configuration</title> <simpara> By default FreeRADIUS server will log all accounting requests into <filename moreinfo="none">/usr/local/var/log/radius/radacct</filename> directory in form of plain text files. The server will create one file for each hostname in the directory. The following example shows how the log files look like. </simpara> <example> <title>Example of Accounting Report</title> <programlisting format="linespecific">Tue Jun 24 00:20:55 2003 Acct-Status-Type = Start Service-Type = 15 Sip-Response-Code = 200 Sip-Method = 1 User-Name = "gh@192.168.2.16" Calling-Station-Id = "sip:gh@192.168.2.16" Called-Station-Id = "sip:jiri@192.168.2.16" Sip-Translated-Request-URI = "sip:jiri@192.168.2.36" Acct-Session-Id = "b9a2ffaa-0458-42e1-b5fd-59656b795d29@192.168.2.32" Sip-To-Tag = "cb2cfe2e-3659-28c7-a8cc-ab0b8cbd3012" Sip-From-Tag = "a783bd2f-bb8d-46fd-84a9-00a9833f189e" Sip-CSeq = "1" NAS-IP-Address = 192.168.2.16 NAS-Port = 5060 Acct-Delay-Time = 0 Client-IP-Address = 127.0.0.1 Acct-Unique-Session-Id = "9b323e6b2f5b0f33" Timestamp = 1056406855Tue Jun 24 00:20:56 2003 Acct-Status-Type = Stop Service-Type = 15 Sip-Response-Code = 200 Sip-Method = 8 User-Name = "jiri@192.168.2.16" Calling-Station-Id = "sip:jiri@192.168.2.16" Called-Station-Id = "sip:gh@192.168.2.16" Sip-Translated-Request-URI = "sip:192.168.2.32:9576" Acct-Session-Id = "b9a2ffaa-0458-42e1-b5fd-59656b795d29@192.168.2.32" Sip-To-Tag = "a783bd2f-bb8d-46fd-84a9-00a9833f189e" Sip-From-Tag = "cb2cfe2e-3659-28c7-a8cc-ab0b8cbd3012" Sip-CSeq = "4580" NAS-IP-Address = 192.168.2.16 NAS-Port = 5060 Acct-Delay-Time = 0 Client-IP-Address = 127.0.0.1 Acct-Unique-Session-Id = "b2c2479a07b17c95" Timestamp = 1056406856</programlisting> </example> </section> <section> <title>Group Checking Configuration</title> <simpara> If you want to make user <quote>joe</quote> in domain <quote>iptel.org</quote> member of group <quote>pstn</quote> then add the following to your <filename moreinfo="none">/usr/local/etc/raddb/users</filename> file: </simpara> <programlisting format="linespecific">joe@iptel.org Sip-Group == "pstn", Auth-Type := Accept Reply-Message = "Authorized"</programlisting> </section> </chapter> <chapter> <title>&ser; Configuration</title> <simpara> We will describe installation from sources here. If you use binary packages then there is an additional package containing &rad; related modules. You will need to install the package. </simpara> <warning> <simpara> Due to a mistake the binary packages for &rad; do not include &rad;-enabled version of acc (accounting) module. The packages contain modules for &rad; authentication and group membership checking only. </simpara> <simpara> If you need accounting over &rad; then you will have to compile &rad;-enabled version of acc module from the sources. This will be fixed in one of future releases, we apologize for any inconvenience. </simpara> </warning> <simpara> &rad;-related modules are not compiled by default. To compile them, edit <filename moreinfo="none">Makefile</filename>, find variable <varname>exclude_modules</varname> and you should see <quote>auth_radius</quote>, <quote>group_radius</quote>, and <quote>uri_radius</quote> among excluded modules. Simply remove the three modules from the list. </simpara> <simpara> If you need &rad; accounting then edit also sip_router/modules/acc/Makefile and uncomment lines containing: </simpara> <programlisting format="linespecific">DEFS+=-DRAD_ACCLIBS=-L$(LOCALBASE)/lib -lradiusclient</programlisting> <simpara> Then recompile and re-install &ser: </simpara> <screen format="linespecific">root@localhost:/usr/local/src/sip_router# make properroot@localhost:/usr/local/src/sip_router# make allroot@localhost:/usr/local/src/sip_router# make install</screen> <section> <title>Authentication Configuration</title> <simpara> Edit configuration file of &ser; and instead of <filename moreinfo="none">auth_db.so</filename> load <filename moreinfo="none">auth_radius.so</filename> and also replace <function moreinfo="none">www_authorize</function> with <function moreinfo="none">radius_www_authorize</function>. </simpara> <note> <simpara> <function moreinfo="none">radius_www_authorize</function> takes just one parameter (as opposed to <function moreinfo="none">www_authorize</function> which takes 2). </simpara> </note> </section> <section> <title>Accounting Configuration</title> <simpara> To enable &rad; accounting simply use <varname>radius_log_flag</varname> and <varname>radius_log_missed_flag</varname> parameters instead of <varname>log_flag</varname> and <varname>log_missed_flag</varname>. Mark transactions that should be logged with flags configured in the parameters. </simpara> </section> <section> <title>Group Membership Checking</title> <simpara> Instead of <filename moreinfo="none">group.so</filename> load <filename moreinfo="none">group_radius.so</filename>. The module exports the same functions as <filename moreinfo="none">group.so</filename>, the only difference is that all the function names exported by <filename moreinfo="none">group_radius.so</filename> have <quote>radius_</quote> prefix. </simpara> </section> </chapter> <chapter> <title>Frequently Asked Questions</title> <qandaset> <qandaentry> <question> <simpara> I compiled &ser; &rad; modules and installed radiusclient library, but when I try to start ser I get the following error message: </simpara> <programlisting format="linespecific">libradiusclient.so.0: cannot open shared object file: No such file or directory</programlisting> </question> <answer> <simpara> Make sure that the directory which contains the library (usually <filename moreinfo="none">/usr/local/lib</filename>) is listed in <filename moreinfo="none">/etc/ld.so.conf</filename> and run <command moreinfo="none">ldconfig -v</command> (as root). </simpara> </answer> </qandaentry> <qandaentry> <question> <simpara> I configured everything as described in this HOWTO, but I get the following message from radiusclient library <quote> check_radius_reply: received invalid reply digest from RADIUS server</quote>. What does that mean ? </simpara> </question> <answer> <simpara> That means that radiusclient library was unable to verify digest of the RADIUS message (it is not related to &sip; digest) because shared secret of the client and server do not match. </simpara> <note> <simpara> FreeRADIUS server has two files that can contain definitions of clients and corresponding shared secrets--<filename moreinfo="none">clients</filename> and <filename moreinfo="none">clients.conf</filename>. </simpara> <simpara> If you have proper shared secret in one file and you still get the mentioned error message then check also the other file. This can easily happen to clients running on the same host (127.0.0.1 or localhost), because <filename moreinfo="none">clients.conf</filename> contains definition for localhost by default with secret <quote>testing123</quote>. </simpara> </note> </answer> </qandaentry> </qandaset> </chapter></book>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -