Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| vendors:cisco:routers:radius [2026/09/17 14:10] – gerardorourke | vendors:cisco:routers:radius [2026/09/21 10:27] (current) – [File: /etc/raddb/clients.conf] gerardorourke | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Radius Start Stop Events for VoIP Calls ======= | ====== Radius Start Stop Events for VoIP Calls ======= | ||
| + | |||
| + | ===== Cisco CUBE Config ===== | ||
| < | < | ||
| Line 15: | Line 17: | ||
| gw-accounting aaa | gw-accounting aaa | ||
| | | ||
| + | | ||
| ! | ! | ||
| + | voice class aaa 1000 | ||
| + | | ||
| + | ! note this is used in the below dial-peer 200 - so this does NOT produce an accounting record - so we don't get one per leg. | ||
| + | ! | ||
| + | dial-peer voice 100 voip | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | no voice-class sip localhost | ||
| + | | ||
| + | | ||
| + | srtp | ||
| + | no vad | ||
| + | ! | ||
| + | dial-peer voice 200 voip | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | no vad | ||
| + | ! | ||
| + | |||
| </ | </ | ||
| + | ===== Radius Config ===== | ||
| + | |||
| + | ====File: / | ||
| + | |||
| + | < | ||
| + | client cisco-router { | ||
| + | ipaddr | ||
| + | secret | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ====File: / | ||
| + | |||
| + | < | ||
| + | accounting { | ||
| + | # Update accounting packet by adding the CUI attribute | ||
| + | # recorded from the corresponding Access-Accept | ||
| + | # use it only if your NAS boxes do not support CUI themselves | ||
| + | # cui | ||
| + | |||
| + | # | ||
| + | # Create a ' | ||
| + | # Note that accounting requests which are proxied | ||
| + | # are also logged in the detail file. | ||
| + | detail | ||
| + | |||
| + | # If h323-setup-time exists THEN perform the regex etc (GOR) | ||
| + | |||
| + | if (& | ||
| + | update request { | ||
| + | & | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if (& | ||
| + | update request { | ||
| + | & | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if (& | ||
| + | update request { | ||
| + | & | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if (& | ||
| + | update request { | ||
| + | & | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if (& | ||
| + | update request { | ||
| + | & | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if (& | ||
| + | update request { | ||
| + | & | ||
| + | } | ||
| + | } | ||
| + | |||
| + | # REST enabled (GOR) | ||
| + | rest | ||
| + | |||
| + | # daily | ||
| + | |||
| + | # Update the wtmp file | ||
| + | # | ||
| + | # If you don't use " | ||
| + | # available on all systems), you can delete this line. | ||
| + | # unix | ||
| + | |||
| + | # | ||
| + | # For Simultaneous-Use tracking. | ||
| + | # | ||
| + | # Due to packet losses in the network, the data here | ||
| + | # may be incorrect. | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # | ||
| + | # Return an address to the IP Pool when we see a stop record. | ||
| + | # | ||
| + | # Ensure that & | ||
| + | # pool of IPs are used. | ||
| + | # | ||
| + | |||
| + | # | ||
| + | # Log traffic to an SQL database. | ||
| + | # | ||
| + | # See " | ||
| + | -sql | ||
| + | |||
| + | # | ||
| + | # If you receive stop packets with zero session length, | ||
| + | # they will NOT be logged in the database. | ||
| + | # will print a message (only in debugging mode), and will | ||
| + | # return " | ||
| + | # | ||
| + | # You can ignore these packets by uncommenting the following | ||
| + | # three lines. | ||
| + | # accounting request, and the NAS will retransmit. | ||
| + | # | ||
| + | # if (noop) { | ||
| + | # ok | ||
| + | # } | ||
| + | |||
| + | # Cisco VoIP specific bulk accounting | ||
| + | # | ||
| + | |||
| + | # For Exec-Program and Exec-Program-Wait | ||
| + | exec | ||
| + | |||
| + | # Filter attributes from the accounting response. | ||
| + | attr_filter.accounting_response | ||
| + | |||
| + | # | ||
| + | # See " | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== / | ||
| + | |||
| + | < | ||
| + | rest { | ||
| + | # | ||
| + | # This subsection configures the tls related items | ||
| + | # that control how FreeRADIUS connects to a HTTPS | ||
| + | # server. | ||
| + | # | ||
| + | tls { | ||
| + | # Certificate Authorities: | ||
| + | # " | ||
| + | # File containing a single CA, which is the issuer of the server | ||
| + | # certificate. | ||
| + | # " | ||
| + | # File containing a bundle of certificates, | ||
| + | # certificate chain validation. | ||
| + | # " | ||
| + | # Directory holding CA certificates to verify the peer with. | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # Server certificate verification requirements. | ||
| + | # " | ||
| + | # " | ||
| + | # trusted CAs) | ||
| + | # | ||
| + | # The default is " | ||
| + | # | ||
| + | |||
| + | # Server certificate CN verification requirements. | ||
| + | # " | ||
| + | # " | ||
| + | # in the URI) | ||
| + | # | ||
| + | # The default is " | ||
| + | # | ||
| + | } | ||
| + | |||
| + | # rlm_rest will open a connection to the server specified in connect_uri | ||
| + | # to populate the connection cache, ready for the first request. | ||
| + | # The server will not start if the server specified is unreachable. | ||
| + | # | ||
| + | # If you wish to disable this pre-caching and reachability check, | ||
| + | # comment out the configuration item below. | ||
| + | # | ||
| + | # connect_uri = " | ||
| + | connect_uri = " | ||
| + | |||
| + | # | ||
| + | # When set, connects to the server over a UNIX socket which may be | ||
| + | # helpful for those with (pseudo)security constraints that make it | ||
| + | # easier to use an UNIX socket than explain to an auditor the use of | ||
| + | # non-TLS HTTP localhost connections. | ||
| + | # | ||
| + | # NOTE: This is not allowed to be an xlat as it can lead to security issues. | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # | ||
| + | # When set, connect_uri_socket is an abstract UNIX socket | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # | ||
| + | # How long before new connection attempts timeout, defaults to 4.0 seconds. | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # | ||
| + | # Specify HTTP protocol version to use. one of ' | ||
| + | # ' | ||
| + | # | ||
| + | # | ||
| + | |||
| + | # | ||
| + | # The following config items can be used in each of the sections. | ||
| + | # The sections themselves reflect the sections in the server. | ||
| + | # For example if you list rest in the authorize section of a virtual server, | ||
| + | # the settings from the authorize section here will be used. | ||
| + | # | ||
| + | # The following config items may be listed in any of the sections: | ||
| + | # uri - to send the request to. | ||
| + | # method | ||
| + | # ' | ||
| + | # body - The format of the HTTP body sent to the remote server. | ||
| + | # May be ' | ||
| + | # attr_num | ||
| + | # | ||
| + | # raw_value | ||
| + | # | ||
| + | # data - Send custom freeform data in the HTTP body. Content-type | ||
| + | # may be specified with ' | ||
| + | # | ||
| + | # done using the appropriate xlat method e.g. %{urlencode:< | ||
| + | # force_to | ||
| + | # May be ' | ||
| + | # or ' | ||
| + | # tls - TLS settings for HTTPS. | ||
| + | # auth - HTTP auth method to use, one of ' | ||
| + | # ' | ||
| + | # ' | ||
| + | # username | ||
| + | # password | ||
| + | # require_auth - Require HTTP authentication. | ||
| + | # timeout | ||
| + | # chunk - Chunk size to use. If set, HTTP chunked encoding is used to | ||
| + | # send data to the REST server. Make sure that this is large | ||
| + | # | ||
| + | # representation. | ||
| + | # A number like 8192 is good. | ||
| + | # | ||
| + | # Additional HTTP headers may be specified with control: | ||
| + | # The values of those attributes should be in the format: | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # You should set this attribute before calling the rest module, | ||
| + | # via something like the following example. | ||
| + | # update the HTTP attribute and key value to whatever is needed on | ||
| + | # your local system. | ||
| + | # to not work for your system. | ||
| + | # | ||
| + | # | ||
| + | # & | ||
| + | # } | ||
| + | # rest | ||
| + | # | ||
| + | # The control: | ||
| + | # (i.e. deleted) after each call to the rest module, and each | ||
| + | # %{rest:} expansion. | ||
| + | # call do not affect headers from a different REST call. | ||
| + | # | ||
| + | # Body encodings are the same for requests and responses | ||
| + | # | ||
| + | # POST - All attributes and values are urlencoded | ||
| + | # [outer.][< | ||
| + | # | ||
| + | # JSON - All attributes and values are escaped according to the JSON specification | ||
| + | # - attribute | ||
| + | # - attr_num | ||
| + | # ' | ||
| + | # - type Type of the attribute (e.g. " | ||
| + | # - value Attribute value, for enumerated attributes the human readable value is | ||
| + | # | ||
| + | # { | ||
| + | # "< | ||
| + | # " | ||
| + | # " | ||
| + | # " | ||
| + | # }, | ||
| + | # "< | ||
| + | # " | ||
| + | # " | ||
| + | # " | ||
| + | # }, | ||
| + | # "< | ||
| + | # " | ||
| + | # " | ||
| + | # " | ||
| + | # }, | ||
| + | # } | ||
| + | # | ||
| + | # The response format adds three optional fields: | ||
| + | # - do_xlat | ||
| + | # - is_json | ||
| + | # in string form. Defaults to true. | ||
| + | # - op | ||
| + | # | ||
| + | # | ||
| + | # value will be used, and it will be assigned to a single | ||
| + | # | ||
| + | # { | ||
| + | # "< | ||
| + | # " | ||
| + | # " | ||
| + | # " | ||
| + | # " | ||
| + | # }, | ||
| + | # "< | ||
| + | # "< | ||
| + | # " | ||
| + | # " | ||
| + | # } | ||
| + | # } | ||
| + | |||
| + | # | ||
| + | # Module return codes are determined by HTTP response codes. These vary depending on the | ||
| + | # section. | ||
| + | # | ||
| + | # If the body is processed and found to be malformed or unsupported fail will be returned. | ||
| + | # If the body is processed and found to contain attribute updated will be returned, | ||
| + | # except in the case of a 401 code. | ||
| + | # | ||
| + | |||
| + | # Authorize/ | ||
| + | # | ||
| + | # Code | ||
| + | # 404 not found | ||
| + | # 410 gone no notfound | ||
| + | # 403 forbidden | ||
| + | # 401 unauthorized | ||
| + | # 204 no content | ||
| + | # 2xx successful | ||
| + | # 5xx server error no fail | ||
| + | # xxx - | ||
| + | # | ||
| + | # The status code is held in %{reply: | ||
| + | # | ||
| + | authorize { | ||
| + | uri = " | ||
| + | method = ' | ||
| + | tls = ${..tls} | ||
| + | } | ||
| + | authenticate { | ||
| + | uri = " | ||
| + | method = ' | ||
| + | tls = ${..tls} | ||
| + | |||
| + | # | ||
| + | # Note that you CANNOT set ' | ||
| + | # here. When doing user authentication, | ||
| + | # uses the User-Name and User-Password. | ||
| + | # | ||
| + | } | ||
| + | |||
| + | # Preacct/ | ||
| + | # | ||
| + | # Code | ||
| + | # 204 no content | ||
| + | # 2xx successful | ||
| + | # 5xx server error no fail | ||
| + | # xxx - | ||
| + | |||
| + | # GOR - this was the default setting for uri in accounting before I edited it. | ||
| + | # uri = " | ||
| + | |||
| + | # initial data line config below - but then updated to use the tmp / cleaned up versions | ||
| + | # data = ' | ||
| + | in}"," | ||
| + | |||
| + | preacct { | ||
| + | uri = " | ||
| + | method = ' | ||
| + | tls = ${..tls} | ||
| + | } | ||
| + | accounting { | ||
| + | uri = " | ||
| + | method = ' | ||
| + | body = ' | ||
| + | data = ' | ||
| + | _origin":" | ||
| + | tls = ${..tls} | ||
| + | } | ||
| + | post-auth { | ||
| + | uri = " | ||
| + | method = ' | ||
| + | tls = ${..tls} | ||
| + | } | ||
| + | pre-proxy { | ||
| + | uri = " | ||
| + | method = ' | ||
| + | tls = ${..tls} | ||
| + | } | ||
| + | post-proxy { | ||
| + | uri = " | ||
| + | method = ' | ||
| + | tls = ${..tls} | ||
| + | } | ||
| + | |||
| + | # Options for calling rest xlats | ||
| + | # uri and method will be derived from the string provided to the xlat | ||
| + | xlat { | ||
| + | # | ||
| + | # The whole string passed to a REST xlat is URI encoded. | ||
| + | # With body_uri_encode = yes, any body data will remain encoded. | ||
| + | # With body_uri_encode = no, the body data will be decoded and sent as provided. | ||
| + | # | ||
| + | body_uri_encode = yes | ||
| + | tls = ${..tls} | ||
| + | } | ||
| + | |||
| + | # | ||
| + | # The connection pool is used to pool outgoing connections. | ||
| + | # | ||
| + | pool { | ||
| + | # Connections to create during module instantiation. | ||
| + | # If the server cannot create specified number of | ||
| + | # connections during instantiation it will exit. | ||
| + | # Set to 0 to allow the server to start without the | ||
| + | # web service being available. | ||
| + | start = ${thread[pool].start_servers} | ||
| + | |||
| + | # Minimum number of connections to keep open | ||
| + | min = ${thread[pool].min_spare_servers} | ||
| + | |||
| + | # Maximum number of connections | ||
| + | # | ||
| + | # If these connections are all in use and a new one | ||
| + | # is requested, the request will NOT get a connection. | ||
| + | # | ||
| + | # Setting ' | ||
| + | # that some threads may starve, and you will see errors | ||
| + | # like 'No connections available and at max connection limit' | ||
| + | # | ||
| + | # Setting ' | ||
| + | # that there are more connections than necessary. | ||
| + | max = ${thread[pool].max_servers} | ||
| + | |||
| + | # Spare connections to be left idle | ||
| + | # | ||
| + | # NOTE: Idle connections WILL be closed if " | ||
| + | # is set. This should be less than or equal to " | ||
| + | spare = ${thread[pool].max_spare_servers} | ||
| + | |||
| + | # Number of uses before the connection is closed | ||
| + | # | ||
| + | # 0 means " | ||
| + | uses = 0 | ||
| + | |||
| + | # The number of seconds to wait after the server tries | ||
| + | # to open a connection, and fails. | ||
| + | # no new connections will be opened. | ||
| + | retry_delay = 30 | ||
| + | |||
| + | # The lifetime (in seconds) of the connection | ||
| + | lifetime = 0 | ||
| + | |||
| + | # idle timeout (in seconds). | ||
| + | # unused for this length of time will be closed. | ||
| + | idle_timeout = 60 | ||
| + | |||
| + | # NOTE: All configuration settings are enforced. | ||
| + | # connection is closed because of " | ||
| + | # " | ||
| + | # connections MAY fall below " | ||
| + | # happens, it will open a new connection. | ||
| + | # also log a WARNING message. | ||
| + | # | ||
| + | # The solution is to either lower the " | ||
| + | # or increase lifetime/ | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Example of How to make Rest Requests conditional ==== | ||
| + | < | ||
| + | if (& | ||
| + | rest | ||
| + | } | ||
| + | else { | ||
| + | noop | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== Useful Commands ===== | ||
| + | |||
| + | < | ||
| + | # Check config (before restarting) | ||
| + | sudo radiusd -XC | ||
| + | |||
| + | #Restart | ||
| + | systemctl restart radiusd | ||
| + | </ | ||
| + | |||
| + | ===== Lock it down ===== | ||
| + | By default we have the default and inner-tunnel symlinks in the / | ||
| + | |||
| + | But the default should be replaced with a dedicated simple config | ||
| + | |||
| + | Remove the two default symlink configs from the enabled sites directory | ||
| + | < | ||
| + | sudo rm / | ||
| + | sudo rm / | ||
| + | </ | ||
| + | |||
| + | * Create your dedicated config just for Cisco CUBEs - / | ||
| + | |||
| + | Example: | ||
| + | < | ||
| + | server cube-accounting { | ||
| + | listen { | ||
| + | type = acct | ||
| + | ipaddr = * | ||
| + | port = 1813 | ||
| + | proto = udp | ||
| + | } | ||
| + | |||
| + | recv Accounting-Request { | ||
| + | accounting | ||
| + | } | ||
| + | |||
| + | accounting { | ||
| + | detail | ||
| + | |||
| + | # Your existing cleanup blocks... | ||
| + | |||
| + | if (& | ||
| + | update request { | ||
| + | & | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if (& | ||
| + | rest | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | * Create your symlink | ||
| + | * < | ||