File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / mpd / doc / mpd30.html
Revision 1.1.1.4 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 00:39:23 2021 UTC (3 years, 3 months ago) by misho
Branches: mpd, MAIN
CVS tags: v5_9p16, v5_9, HEAD
mpd 5.9

    1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    2: <HTML>
    3: <HEAD>
    4: <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    5: <TITLE>RADIUS</TITLE>
    6: </HEAD>
    7: <BODY text="#000000" bgcolor="#ffffff">
    8: 
    9: <A HREF="mpd.html"><EM>Mpd 5.9 User Manual</EM></A>
   10:  <b>:</b> <A HREF="mpd17.html"><EM>Configuring Mpd</EM></A>
   11:  <b>:</b> <A HREF="mpd29.html"><EM>Authentication, Authorization and Accounting (AAA)</EM></A>
   12:  <b>:</b> <EM>RADIUS</EM><BR>
   13: <b>Previous:</b> <A HREF="mpd29.html"><EM>Authentication, Authorization and Accounting (AAA)</EM></A><BR>
   14: <b>Next:</b> <A HREF="mpd31.html"><EM>External authentication</EM></A>
   15: 
   16: 
   17: <HR NOSHADE>
   18:   <H2><A NAME="30"></A>4.10.1. RADIUS<A NAME="radius"></A></H2>
   19: 
   20: <p>This chapter describes RADIUS authentication backend.
   21: Mpd supports both user authentication and session accounting using RADIUS.
   22: RADIUS-Accounting and RADIUS-Authentication are independant so it is possible
   23: to use them in any combination.</p>
   24: <p>All authentication methods are supported with RADIUS (PAP, CHAP, MS-CHAPv1,
   25: MS-CHAPv2, EAP). Password changing is currently not supported.</p>
   26: <p>All of these commands apply to the currently active link.</p>
   27: <p>
   28: <dl>
   29: 
   30: <dt><b><code>set radius server <em>name</em> <em>secret</em> [ <em>auth-port</em> [ <em>acct-port</em> ]]</code></b><dd><p>Configure RADIUS server parameters. Multiple RADIUS servers may be configured 
   31: by repeating this command, and up to 10 servers may be specified.
   32: If one of auth/acct ports specified as 0, it will not be used for requests
   33: of that type.</p>
   34: 
   35: <dt><b><code>unset radius server <em>name</em> [ <em>auth-port</em> [ <em>acct-port</em> ]]</code></b><dd><p>Deletes cpecific RADIUS server from pool.</p>
   36: 
   37: <dt><b><code>set radius src-addr <em>ipaddr</em></code></b><dd><p>Configure IP address on the multihomed host that is used as a source address
   38: for all requests.</p>
   39: 
   40: <dt><b><code>set radius timeout <em>seconds</em></code></b><dd><p>Set the timeout for completion of RADIUS requests.</p>
   41: <p>The default is 5 second.</p>
   42: 
   43: <dt><b><code>set radius retries <em>#retries</em></code></b><dd><p>Set the number of retries for RADIUS requests.</p>
   44: <p>The default is 3 retries.</p>
   45: 
   46: <dt><b><code>set radius me <em>IP</em>|<em>ifname</em>|<em>hostname</em></code></b><dd><p>Send the given IP in the RAD_NAS_IP_ADDRESS attribute to the server.</p>
   47: 
   48: <dt><b><code>set radius v6me <em>IPv6</em></code></b><dd><p>Send the given IP in the RAD_NAS_IPV6_ADDRESS attribute to the server.</p>
   49: 
   50: <dt><b><code>set radius identifier <em>name</em></code></b><dd><p>Send the given name in the RAD_NAS_IDENTIFIER attribute to the server.
   51: If not set the local hostname is used.</p>
   52: 
   53: <dt><b><code>set radius enable message-authentic</code></b><dd><p>Adds the Message-Authenticator attribute to the RADIUS request. 
   54: The Message-Authenticator is an HMAC-MD5 checksum of the entire 
   55: Access-Request packet using the shared secret as the key. This 
   56: should protect the RADIUS server against online dictionary attacks.
   57: This is mandatory when using the EAP-RADIUS-Proxy and it's implicitly 
   58: added to the request by Mpd.</p>
   59: 
   60: <dt><b>RADIUS internals</b><dd>
   61: <p>RADIUS attributes supported by mpd:
   62: <pre>
   63: N   Name                       	   Access	 Accounting
   64: 	                	Req	Resp	Req	Resp
   65: 1   User-Name			+	+	+	-
   66: 2   User-Password		+	-	-	-
   67: 3   CHAP-Password		+	-	-	-
   68: 4   NAS-IP-Address		+	-	+	-
   69: 5   NAS-Port			+	-	+	-
   70: 6   Service-Type		+	-	+	-
   71: 7   Framed-Protocol		+	-	+	-
   72: 8   Framed-IP-Address		-	+	+	-
   73: 9   Framed-IP-Netmask		-	+	+	-
   74: 11  Filter-Id			-	+	-	-
   75: 12  Framed-MTU			-	+	-	-
   76: 13  Framed-Compression		-	+	-	-
   77: 18  Reply-Message		-	+	-	-
   78: 22  Framed-Route		-	+	-	-
   79: 24  State			+	+	+	-
   80: 25  Class			-	+	+	-
   81: 27  Session-Timeout		-	+	-	-
   82: 28  Idle-Timeout		-	+	-	-
   83: 30  Called-Station-Id		+	-	+	-
   84: 31  Calling-Station-Id		+	-	+	-
   85: 32  NAS-Identifier		+	-	+	-
   86: 40  Acct-Status-Type		-	-	+	-
   87: 42  Acct-Input-Octets		-	-	+	-
   88: 43  Acct-Output-Octets		-	-	+	-
   89: 44  Acct-Session-Id		+	-	+	-
   90: 45  Acct-Authentic		-	-	+	-
   91: 46  Acct-Session-Time		-	-	+	-
   92: 47  Acct-Input-Packets		-	-	+	-
   93: 48  Acct-Output-Packets		-	-	+	-
   94: 49  Acct-Terminate-Cause	-	-	+	-
   95: 50  Acct-Multi-Session-Id	-	-	+	-
   96: 51  Acct-Link-Count		-	-	+	-
   97: 52  Acct-Input-Gigawords	-	-	+	-
   98: 53  Acct-Output-Gigawords	-	-	+	-
   99: 60  CHAP-Challenge		+	-	-	-
  100: 61  NAS-Port-Type		+	-	+	-
  101: 64  Tunnel-Type			+	-	+	-
  102: 65  Tunnel-Medium-Type		+	-	+	-
  103: 66  Tunnel-Client-Endpoint	+	-	+	-
  104: 67  Tunnel-Server-Endpoint	+	-	+	-
  105: 85  Acct-Interim-Interval	-	+	-	-
  106: 87  NAS-Port-Id			+	-	+	-
  107: 88  Framed-Pool			-	+	-	-
  108: 90  Tunnel-Client-Auth-ID	+	-	+	-
  109: 91  Tunnel-Server-Auth-ID	+	-	+	-
  110: 95  NAS-IPv6-Address		+	-	+	-
  111: 99  Framed-IPv6-Route		-	+	-	-
  112: 
  113:     Microsoft VSA (311)
  114: 1   MS-CHAP-Response		+	-	-	-
  115: 2   MS-CHAP-Error		-	+	-	-
  116: 7   MS-MPPE-Encryption-Policy	-	+	-	-
  117: 8   MS-MPPE-Encryption-Types	-	+	-	-
  118: 10  MS-CHAP-Domain		-	+	-	-
  119: 11  MS-CHAP-Challenge		+	-	-	-
  120: 12  MS-CHAP-MPPE-Keys		-	+	-	-
  121: 16  MS-MPPE-Send-Key		-	+	-	-
  122: 17  MS-MPPE-Recv-Key		-	+	-	-
  123: 25  MS-CHAP2-Response		+	-	-	-
  124: 26  MS-CHAP2-Success		-	+	-	-
  125: 28  MS-Primary-DNS-Server	-	+	-	-
  126: 29  MS-Secondary-DNS-Server	-	+	-	-
  127: 30  MS-Primary-NBNS-Server	-	+	-	-
  128: 31  MS-Secondary-NBNS-Server	-	+	-	-
  129: 
  130:     DSL Forum VSA (3561)
  131: 1   ADSL-Agent-Circuit-Id	+	-	+	-
  132: 2   ADSL-Agent-Remote-Id	+	-	+	-
  133: 
  134:     mpd VSA (12341)
  135: 1   mpd-rule			-	+	-	-
  136: 2   mpd-pipe			-	+	-	-
  137: 3   mpd-queue			-	+	-	-
  138: 4   mpd-table			-	+	-	-
  139: 5   mpd-table-static		-	+	-	-
  140: 6   mpd-filter			-	+	-	-
  141: 7   mpd-limit			-	+	-	-
  142: 8   mpd-input-octets		-	-	+	-
  143: 9   mpd-input-packets		-	-	+	-
  144: 10  mpd-output-octets		-	-	+	-
  145: 11  mpd-output-packets		-	-	+	-
  146: 12  mpd-link			+	-	+	-
  147: 13  mpd-bundle			-	-	+	-
  148: 14  mpd-iface			-	-	+	-
  149: 15  mpd-iface-index		-	-	+	-
  150: 16  mpd-input-acct		-	+	-	-
  151: 17  mpd-output-acct		-	+	-	-
  152: 18  mpd-action			-	+	-	-
  153: 19  mpd-peer-ident		+	-	+	-
  154: 20  mpd-iface-name		-	+	-	-
  155: 21  mpd-iface-descr		-	+	-	-
  156: 22  mpd-iface-group		-	+	-	-
  157: 154 mpd-drop-user		-	-	-	+
  158: </pre>
  159: </p>
  160: <p>To use mpd VSA you should add such dictionary to your RADIUS server:
  161: <pre>
  162: #----------------------------------------------------------
  163: # dictionary.mpd                                                                                   
  164:                                                                                                    
  165: VENDOR          mpd             12341                                                              
  166:                                                                                                    
  167: BEGIN-VENDOR	mpd
  168: 
  169: ATTRIBUTE	mpd-rule	1	string
  170: ATTRIBUTE	mpd-pipe	2	string
  171: ATTRIBUTE	mpd-queue	3	string
  172: ATTRIBUTE	mpd-table	4	string
  173: ATTRIBUTE	mpd-table-static	5	string
  174: ATTRIBUTE	mpd-filter	6	string
  175: ATTRIBUTE	mpd-limit	7	string
  176: ATTRIBUTE	mpd-input-octets	8	string
  177: ATTRIBUTE	mpd-input-packets	9	string
  178: ATTRIBUTE	mpd-output-octets	10	string
  179: ATTRIBUTE	mpd-output-packets	11	string
  180: ATTRIBUTE	mpd-link	12	string
  181: ATTRIBUTE	mpd-bundle	13	string
  182: ATTRIBUTE	mpd-iface	14	string
  183: ATTRIBUTE	mpd-iface-index	15	integer
  184: ATTRIBUTE	mpd-input-acct	16	string
  185: ATTRIBUTE	mpd-output-acct	17	string
  186: ATTRIBUTE	mpd-action	18	string
  187: ATTRIBUTE	mpd-peer-ident	19	string
  188: ATTRIBUTE	mpd-iface-name	20	string
  189: ATTRIBUTE	mpd-iface-descr	21	string
  190: ATTRIBUTE	mpd-iface-group	22	string
  191: ATTRIBUTE	mpd-drop-user	154	integer
  192: 
  193: END-VENDOR	mpd
  194: #----------------------------------------------------------
  195: </pre>
  196: </p>
  197: <p>Mpd allows RADIUS server to terminate user session by setting vendor specific
  198: mpd-drop-user attribute to nonzero value in accounting start/update reply packet.</p>
  199: 
  200: <dt><b>RADIUS ACL's</b><dd>
  201: <p>Mpd can use the Access Control Lists (ACLs) given by the RADIUS server.
  202: This ACLs may include ipfw rules, pipes, queues and tables and also mpd
  203: internal traffic filtering/shaping/limiting features. That two sets are 
  204: redundant. ipfw proposed as standard and universal solution, while internal
  205: filter/shaper/limiter based on ng_bpf+ng_car expected to work faster with
  206: big number of active links.</p>
  207: 
  208: <dt><b>ipfw</b><dd>
  209: <p>You can write in your RADIUS configuration something like:
  210: <pre>
  211: mpd-table += "1=10.0.0.1",
  212: mpd-table += "1=10.0.0.15",
  213: mpd-pipe += "1=bw 10Kbyte/s",
  214: mpd-pipe += "5=bw 20Kbyte/s",
  215: mpd-rule += "1=pipe %p1 all from any to table\\(%t1\\) in",
  216: mpd-rule += "2=pipe %p5 all from table\\(%t1\\) to any out",
  217: mpd-rule += "100=allow all from any to any",
  218: </pre>
  219: </p>
  220: <p>When mpd receives these parameters it will call ipfw(8) to create
  221: firewall rules, pipes and queues with unique numbers starting from 10000
  222: (configurable via 'set global start...'). %rX, %pX, %qX, %tX and %aX
  223: macroses will be expanded within mpd-rule and mpd-queue.
  224: To the end of each rule will be added "via ngX" to make the rule apply
  225: only to that client's networking interface.</p>
  226: <p>Allowed macroses:
  227: <pre>
  228: %rX IPFW rule pool
  229: %pX IPFW pipe pool
  230: %qX IPFW queue pool
  231: %tX IPFW table pool
  232: %a1 peer negotiated IP address
  233: %a2 self negotiated IP address
  234: </pre>
  235: </p>
  236: <p>As a result of this example we would get these commands executed:
  237: <pre>
  238: ipfw table 32 add 10.0.0.1
  239: ipfw table 32 add 10.0.0.15
  240: ipfw pipe 10000 config bw 10Kbyte/s
  241: ipfw pipe 10001 config bw 20Kbyte/s
  242: ipfw add 10000 pipe 10000 all from any to table\(32\) in via ng0
  243: ipfw add 10001 pipe 10001 all from table\(32\) to any out via ng0
  244: ipfw add 10002 allow all from any to any via ng0
  245: </pre>
  246: 
  247: When the link goes down, all created rules will be removed.</p>
  248: <p>Note: As soon as mpd executes ipfw commands using shell, shell's
  249: special characters like "(" and ")" must be slashed.</p>
  250: <p>You can specify <em>mpd-table += "1=peer_addr"</em> to use mpd-table
  251: with the peer negotiated IP address.</p>
  252: 
  253: <dt><b>internal (ng_bpf/ng_car)</b><dd>
  254: <p>Mpd can create complex per-interface traffic filtering/limiting engines inside
  255: netgraph when it is requested by mpd-filter and mpd-limit RADIUS attributes.</p>
  256: <p>mpd-filter attribute is a packet filter declaration for using in mpd-limit.
  257: mpd-filter consists of two main parts: match/nomatch verdict and the condition.
  258: tcpdump (libpcap) expression syntax used for conditions.</p>
  259: <p>mpd-filter: <em>match</em>|<em>nomatch</em> <em>{condition}</em></p>
  260: <p>mpd-limit attribute is an action which should be done for packet. It consists
  261: of two main parts: filter and action. </p>
  262: <p>mpd-limit: <em>{filter}</em> <em>{action}</em></p>
  263: <p>Filter can be or "all" (any packet) or "fltX"
  264: (packets matching to specified mpd-filter).</p>
  265: <p>filter: <em>any</em>|<em>fltX</em></p>
  266: <p>Action can be: "" (do nothing, just account),
  267: "pass" (stop processing and pass packet), 
  268: "deny" (stop processing and drop packet), 
  269: "rate-limit" (do Cisco-like rate-limit), 
  270: "shape" (do simple RED aware traffic shaping). </p>
  271: <p>Actions "rate-limit" and "shape" can have optional "pass" suffix
  272: to stop processing after doing this action.</p>
  273: <p>action: <em></em> | <em>pass</em> | <em>deny</em> | 
  274: <em>rate-limit</em> <em>{rate(bits/s)}</em> [<em>{normal burst(bytes)}</em> [<em>{extended burst(bytes)}</em>]] [<em>pass</em>] |
  275: <em>shape</em> <em>{rate(bits/s)}</em> [<em>{burst(bytes)}</em>] [<em>pass</em>]</p>
  276: <p>As example you can write in your RADIUS configuration something like:
  277: <pre>
  278: mpd-filter += "1#1=nomatch dst net 10.0.0.0/24",
  279: mpd-filter += "1#2=match dst net 10.0.0.0/8",
  280: mpd-filter += "2#1=nomatch src net 10.0.0.0/24",
  281: mpd-filter += "2#2=match src net 11.0.0.0/8",
  282: mpd-limit += "in#1=flt1 pass",
  283: mpd-limit += "in#2#Biz=all shape 64000 4000",
  284: mpd-limit += "out#1=flt2 pass",
  285: mpd-limit += "out#2#Biz=all rate-limit 1024000 150000 300000",
  286: </pre>
  287: </p>
  288: <p>As result, one ng_bpf node will be created to implement traffic filters 
  289: and several (two for this example) ng_car nodes for traffic shaping 
  290: and rate-limiting. Incoming traffic to 10.0.0.0/8 except 10.0.0.0/24
  291: will be passed, other traffic will be shaped to 64Kbits/s. Outgoing
  292: traffic from 10.0.0.0/8 except 10.0.0.0/24 will be passed, all other
  293: will be limited to 1024Kbit/s. Also traffic that passed mpd-limit rules
  294: marked "Biz" will be accordingly accounted and present with that name
  295: in AAA accounting requests.</p>
  296: 
  297: 
  298: </dl>
  299: </p>
  300:  <HR NOSHADE>
  301: <A HREF="mpd.html"><EM>Mpd 5.9 User Manual</EM></A>
  302:  <b>:</b> <A HREF="mpd17.html"><EM>Configuring Mpd</EM></A>
  303:  <b>:</b> <A HREF="mpd29.html"><EM>Authentication, Authorization and Accounting (AAA)</EM></A>
  304:  <b>:</b> <EM>RADIUS</EM><BR>
  305: <b>Previous:</b> <A HREF="mpd29.html"><EM>Authentication, Authorization and Accounting (AAA)</EM></A><BR>
  306: <b>Next:</b> <A HREF="mpd31.html"><EM>External authentication</EM></A>
  307: 
  308: 
  309: 
  310: </BODY>
  311: </HTML>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>