<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>LINICKX.com</title><link>https://www.linickx.com/</link><description></description><lastBuildDate>Sun, 07 May 2023 17:55:00 +0100</lastBuildDate><item><title>UniFi, OpenWRT, freeRADIUS: Mac Address Dynamic VLAN Assignment for WPA2-PSK</title><link>https://www.linickx.com/unifi-openwrt-freeradius-mac-address-dynamic-vlan-assignment-for-wpa2-psk</link><description>&lt;p&gt;This is much simpler than I imagined...&lt;/p&gt;
&lt;h2&gt;Scenario&lt;/h2&gt;
&lt;p&gt;For my home Wi-Fi, I want a single SSID but I want to place devices (Such as IOT) into different VLANs, but since this is personal use I don't want the headache of certificates that comes with 802.1x / WPA-Enterprise, thus want to keep the simplicity of passwords (WPA2-PSK).&lt;/p&gt;
&lt;p&gt;UniFi APs support Dynamic VLAN Assignment, but it wasn't obvious what needs to be done on the RADIUS side... well, it'd be simple for Cisco's ISE but I don't have that at home, so freeadius it is 😜&lt;/p&gt;
&lt;p&gt;In this solution there's two key things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;MAC Authorization isn't a security feature; it's more of a convenience feature, Windows &amp;amp; Linux easily allow changing the MAC address of a network card&lt;/li&gt;
&lt;li&gt;The config below has a &lt;em&gt;default allow&lt;/em&gt; that is unknown Mac addresses are permitted&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The idea is, I have one SSID for all my devices, new devices "just work" and they can be moved around afterwards. The &lt;em&gt;security&lt;/em&gt; of the SSID hasn't changed the strength of the &lt;code&gt;PSK&lt;/code&gt; is the key.&lt;/p&gt;
&lt;p&gt;The example below assumes you have a working Wi-Fi, with working VLANs and a working firewall/router to connect them together, we start with installing freeradius onto OpenWRT.&lt;/p&gt;
&lt;h2&gt;Install Freeradius&lt;/h2&gt;
&lt;p&gt;On your OpenWRT box, install the default packages...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;opkg update &amp;amp;&amp;amp; opkg install freeradius3-default freeradius3-utils
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, if you want to be fancy and install just the bare minimum you &lt;em&gt;only&lt;/em&gt; need the below packages, this will exclude all the EAP stuff, but you'll have to hack about with the default site and config files to get the service to start properly... you've been warned! &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;freeradius3 freeradius3-common freeradius3-mod-always freeradius3-mod-attr-filter freeradius3-mod-chap freeradius3-mod-detail freeradius3-mod-exec freeradius3-mod-expiration freeradius3-mod-files freeradius3-mod-logintime freeradius3-mod-pap freeradius3-mod-preprocess freeradius3-utils 
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Edit Config files&lt;/h3&gt;
&lt;p&gt;The first step is to define your &lt;em&gt;RADIUS Clients&lt;/em&gt;, the things that send authentication requests. The file you need to edit is &lt;code&gt;/etc/freeradius3/clients.conf&lt;/code&gt;; the RADIUS packets come directly from the Access-Point so you can either add them one at a time, or add a subnet like this:&lt;/p&gt;
&lt;p&gt;Place at the bottom of the file.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;client vlan1 {
        ipaddr = 192.168.1.0/24
        secret = correcthorsebatterystaple
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, add the &lt;em&gt;WI-FI Clients&lt;/em&gt; to &lt;code&gt;/etc/freeradius3/mods-config/files/authorize&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Place at the top of the file.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;de:ad:be:ef:00:01       Cleartext-Password := &amp;quot;de:ad:be:ef:00:01&amp;quot;
                        Tunnel-Type = VLAN,
                        Tunnel-Medium-Type = 6,                         
                        Tunnel-Private-Group-Id = 2

DEFAULT                 Auth-Type := Accept
                        Tunnel-Type = VLAN,
                        Tunnel-Medium-Type = 6,
                        Tunnel-Private-Group-Id = 1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Where &lt;code&gt;de:ad:be:ef:00:01&lt;/code&gt; is the MAC Address of the device, such as your phone or notebook and &lt;code&gt;Tunnel-Private-Group-Id = 2&lt;/code&gt; places the device into &lt;code&gt;VLAN 2&lt;/code&gt;. This example places all unknown MAC addresses into &lt;code&gt;VLAN 1&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;Testing &amp;amp; Logging&lt;/h3&gt;
&lt;p&gt;With the config files changed, I recommend you stop the radius service : &lt;code&gt;/etc/init.d/radiusd stop&lt;/code&gt; and then start freeradius in debug mode: &lt;code&gt;radiusd -X&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;In debug mode, you'll need to keep your SSH open but you'll see the authentication requests on the screen, if you've made any mistakes it's easier to spot this way.&lt;/p&gt;
&lt;p&gt;After testing is complete, you can run &lt;code&gt;/etc/init.d/radiusd start&lt;/code&gt; to run it as a background service.&lt;/p&gt;
&lt;p&gt;While you are running &lt;code&gt;radiusd -X&lt;/code&gt; no logs are produced, the output is to the screen; by default when you re-enable the service the logs will output to disk: &lt;code&gt;/var/log/radius.log&lt;/code&gt;. If you want to see the logs in &lt;code&gt;luci&lt;/code&gt; then, edit &lt;code&gt;/etc/freeradius3/radiusd.conf&lt;/code&gt; change &lt;code&gt;destination = files&lt;/code&gt; ➡️ &lt;code&gt;destination = syslog&lt;/code&gt; you may also want to set &lt;code&gt;auth = yes&lt;/code&gt; so that you see both failed &amp;amp; passed authentications.&lt;/p&gt;
&lt;h2&gt;UniFi update the SSID&lt;/h2&gt;
&lt;p&gt;Before changing the SSID, a RADIUS server needs to be defined under &lt;code&gt;Settings &amp;gt; Profiles &amp;gt; RADIUS&lt;/code&gt; . The &lt;em&gt;secret&lt;/em&gt; is the same secret which was defined above in clients.conf; the IP address is that of your OpenWRT box. Account is optional, enable if logging disconnect events is important to you.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2023/05/UniFi_RADIUS.png"&gt;&lt;img src="/files/2023/05/UniFi_RADIUS.png" alt="Screenshot of UniFi RADIUS Profile" class="img-fluid" style="max-width: 80%;"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Finally edit your SSID under &lt;code&gt;Settings &amp;gt; Wireless Networks&lt;/code&gt; , scroll to the bottom and enable RADIUS MAC Auth, selecting the profile you just created.&lt;/p&gt;
&lt;p&gt;&lt;a href="/files/2023/05/Unifi_Radius_macauth.png"&gt;&lt;img src="/files/2023/05/Unifi_Radius_macauth.png" alt="Screenshot of UniFi SSID Mac Auth section" class="img-fluid" style="max-width: 80%;"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you have freeradius running in debug mode you'll see events when devices try to connect!&lt;/p&gt;
&lt;h2&gt;/End&lt;/h2&gt;
&lt;p&gt;Adding new devices is as simple as putting entries into the &lt;code&gt;authorize&lt;/code&gt; file with your desired VLAN.&lt;/p&gt;
&lt;p&gt;References:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;https://openwrt.org/docs/guide-user/network/wifi/freeradius&lt;/li&gt;
&lt;li&gt;https://neilzone.co.uk/2021/09/using-freeradius-to-assign-vlans-for-unifi-wi-fi&lt;/li&gt;
&lt;li&gt;https://help.ui.com/hc/en-us/articles/360015268353-UniFi-Gateway-Configuring-RADIUS-Server&lt;/li&gt;
&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nick Bettison</dc:creator><pubDate>Sun, 07 May 2023 17:55:00 +0100</pubDate><guid isPermaLink="false">tag:www.linickx.com,2023-05-07:unifi-openwrt-freeradius-mac-address-dynamic-vlan-assignment-for-wpa2-psk</guid><category>Security</category><category>RADIUS</category><category>UniFi</category><category>OpenWRT</category></item><item><title>How to Import Vendor Specific Attributes into Cisco Secure ACS SE Applience</title><link>https://www.linickx.com/how-to-import-vendor-specific-attributes-into-cisco-secure-acs-se-applience</link><description>&lt;p&gt;I wanted to write a document on how to import RADIUS VSA's (&lt;em&gt;vendor
specific attributes&lt;/em&gt;) into cisco's ACS SE (&lt;em&gt;Solution Engine&lt;/em&gt;) appliance,
the reason being that I couldn't find any good examples on the net and
cisco's documentation just wasn't clear enough.&lt;/p&gt;
&lt;p&gt;My purpose was to use RADIUS authentication between a Nokia IPSO
appliance such that users who access voyager or ssh get authenticated
centrally; for RADIUS authentication to work your authentication server
(&lt;span style="font-style: italic"&gt;in this case ACS&lt;/span&gt;) needs to
supply the AAA client (&lt;span style="font-style: italic"&gt;in this can the
ipso box&lt;/span&gt;) with a "return list attribute". By default ACS doesn't
have the nokia attributes; to import attributes you need to get your
hands on a dictionary file, for nokia ipso it's /etc/nokia.dictionary -
I've a copy
&lt;a href="https://www.linickx.com/files/cisco/nokia-dictionary.txt"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In you dictionary file you need to pick out some key elements, firstly
the IANA-assigned enterprise code for the vendor and secondly a list of
attributes to add. Using my nokia example the vendor code is the top
line:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;VENDOR        Nokia        94&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Thus the code is 94 , and everything below that are attributes.&lt;/p&gt;
&lt;p&gt;So... Getting started with ACS, firstly if you have AAA clients which
you want to use the new attributes you are going to need to delete them,
and to be save reboot ACS. Now the import is done via the &lt;a href="http://www.cisco.com/en/US/products/sw/secursw/ps5338/products_tech_note09186a00801ddba8.shtml"&gt;RDBMS sync
process&lt;/a&gt;,
since you do not have OS level access to ACS you need to upload a file
called "accountActions.csv" (&lt;span style="font-style: italic"&gt;case
sensitive&lt;/span&gt;), uploading this file tells the internal database to
perform some commands or actions, examples would be to bulk import some
users or bulk group changes, in our case we're going to insert a new
"Vendor" into the RADIUS database, and then insert some attributes.&lt;/p&gt;
&lt;p&gt;I have created a file called
&lt;a href="https://www.linickx.com/files/cisco/createVendor_accountActions.csv"&gt;createVendor_accountActions.csv&lt;/a&gt;
if you renamed it to accountActions.csv and uploaded it to your ACS box
via the RDBMS Sync tool (&lt;em&gt;under system configuration&lt;/em&gt;) it'd perform the
following actions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;ul&gt;
&lt;li&gt;Command -1&lt;/li&gt;
&lt;li&gt;Priority - 8&lt;/li&gt;
&lt;li&gt;Action - 350 (&lt;em&gt;Create new Vendor&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;Vendor Name - Nokia&lt;/li&gt;
&lt;li&gt;ACS Vendor Number - Auto Assigned&lt;/li&gt;
&lt;li&gt;Vendor ID - 94&lt;/li&gt;
&lt;li&gt;Date of DB Transaction - 25/09/2007 13:00&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;ul&gt;
&lt;li&gt;Command - 2&lt;/li&gt;
&lt;li&gt;Priotity - 0&lt;/li&gt;
&lt;li&gt;Action - 355 (&lt;em&gt;Restart ACS Services&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;Date of DB Transaction - 25/09/2007 13:00&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The command numbers are just like primary key fields in a database or
row numbers in a spreadsheet, they need to be unique and incremental for
each csv file, and the priority specify and order to apply the commands,
you I guess you could set the priorities all to 0 and rely on the
command number to process the file in order, but I set a priority just
in case. After you apply the file ACS will be temporarily unavailable as
the services restart.&lt;/p&gt;
&lt;p&gt;Now, we look at one line of
&lt;a href="https://www.linickx.com/files/cisco/importAttributes_accountActions.csv"&gt;importAttributes_accountActions.csv&lt;/a&gt;,
again it would need to be renamed to accountActions.csv, before
uploaded, and lets take a look at one line.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Command -1&lt;/li&gt;
&lt;li&gt;Priority - 7&lt;/li&gt;
&lt;li&gt;Action - 352 (&lt;em&gt;Add VSA&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;Attribute Name - Nokia-IMSI&lt;/li&gt;
&lt;li&gt;The vendor to assign the attribute to - 94 (&lt;em&gt;Nokia&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;Attribute ID - 224&lt;/li&gt;
&lt;li&gt;Attribue type - integer ( &lt;em&gt;can only be integer, string or ipaddr&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;Date of DB Transaction - 25/09/2007 13:00&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Hopefully this all starts to make sense when looking at your dictionary
file, again the final line of the file restarts the services. An
important thing to not here is that if you create a new vendor you need
to re-start the services before you can apply an attribute to it, and
you need to restart the services again to use the attributes... at this
point here it's probably worth mentioning that the version of ACS SE I'm
using now (&lt;em&gt;4.1&lt;/em&gt;) is a windows appliance, so if at any point your box
hasn't done what you think a reboot won't hurt ;)&lt;/p&gt;
&lt;p&gt;Now you can add your AAA client and in my example you could set the
vendor to RADIUS (Nokia) , if you then go into interface configuration
RADIUS (Nokia) will appear, go in there and tick all the boxes for
"group", finally if you go into your group setup at the very bottom will
be a list of attributes you've imported and can use ! :cool:&lt;/p&gt;
&lt;p&gt;Just in can you need them here are my references:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.cisco.com/en/US/docs/net_mgmt/cisco_secure_access_control_server_for_windows/4.1/user/A_RDBMS.html"&gt;RDBMS Sync Import
Definitions&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.cisco.com/en/US/products/sw/secursw/ps5338/products_tech_note09186a00801ddba8.shtml"&gt;Importing an accountActions.csv file into ACS
SE&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.cisco.com/univercd/cc/td/doc/product/access/acs_soft/csacsapp/user/ag.htm"&gt;Universe CD version of RDBM SSync import
Defs&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nick</dc:creator><pubDate>Mon, 05 Nov 2007 16:35:00 +0000</pubDate><guid isPermaLink="false">tag:www.linickx.com,2007-11-05:how-to-import-vendor-specific-attributes-into-cisco-secure-acs-se-applience</guid><category>acs</category><category>authentication</category><category>Cisco</category><category>how to</category><category>radius</category></item></channel></rss>