Introduction
The best projects are those that teach you something new. I’ve recently been tasked with decomissioning a RADIUS Server. Not a major task when you first think about it, but the plot thickens.
- This RADIUS server is running Netware 6.
- RADIUS is provided by BorderManager.
- It is used to authenticate ADSL Routers, CDMA Devices and dial up connections all over the country.
- It authenticates against E-Directory.
- That particular E-Directory tree is not replicated anywhere.
- Noone knows the usernames and passwords for the ADSL Routers around the country, so we can’t change user credentials on them.
- Noone knows the shared secret for the RADIUS Clients.
- Once connected users connect a PPTP VPN to a Windows Server which authenticates against AD.
- Some connections have multiple users behind them.
Investigation
Oh man this is going to be fun. I’ve got no Netware or Borderware experience and the people who setup this system are long gone. There is no record of anything and we have no idea as to the number of connections in use, what they are used for and who uses them.
The first step is to figure out our current state. To do this we have to do some pretty heavy log analysis. Our data sources are:
- RADIUS Debug logs: Shows all Access-Request, Accounting and other RADIUS Requests for a 6 month period.
- VPN logs: Shows all PPTP VPN connections for a 6 month period.
- Export of E-Directory accounts.
- Export of Active Directory accounts.
The initial stats from these were a great start. We were able to export a list of unique connections over the past 6 months, with an idea of frequency of use. We were then left with a list of RADIUS connections (ADSL, CMDA and Dial-Up) and a list of VPN Connections, both with a fair amount of contact info such as name or telephone number. The next hurdle was mapping WHICH VPN users used which RADIUS connection.
We first matched the obvious ones, those connections with E-Directory and AD accounts with the same names. We were still left with a large number of unmatched accounts. Had the RADIUS connections had static IPs matching these would have been trivial. Unfortunately they were all dynamic, meaning that one address could be mapped to any number of RADIUS connections over the time period. After much hacking at the data I ended up importing it into Access so I could try and perform some SQL magic. Much googling later I ended up with the following query:
SELECT RADIUSLogs.Date AS RADIUSLogs_Date, RADIUSLogs.Time AS RADIUSLogs_Time, RADIUSLogs.[User-Name], RADIUSLogs.[Framed-IP-Address], VPNLogs.Date AS VPNLogs_Date, VPNLogs.Time AS VPNLogs_Time, VPNLogs.Username, VPNLogs.RemoteIP
FROM RADIUSLogs INNER JOIN VPNLogs ON (RADIUSLogs.Date=VPNLogs.Date) AND (RADIUSLogs.[Framed-IP-Address]=VPNLogs.RemoteIP)
WHERE VPNLogs.Time>=dateadd(”n”,-15,RadiusLogs.Time) And VPNLogs.Time<=dateadd(”n”,+15,RadiusLogs.Time) And VPNLogs.Time>RadiusLogs.Time
ORDER BY RADIUSLogs.[User-Name], VPNLogs.Username;
which joins the RADIUS and VPN logs by Date and IP Address and shows results where the VPN connection was connected within 15 minutes of the RADIUS connection connecting, bearing in mind that connected RADIUS connections sent accounting requests every ten minutes. This query can then be used to populate a Pivot Table mapping RADIUS connections to VPN connections, giving me a list of VPN users per RADIUS connection. This is by no means full proof. I can think of several situations in which the results returned will be invalid, but it is a first step. The output of this was run by a business user who helped identify those entries that didn’t make much sense and they were removed. We now had a list of RADIUS connections and the VPN users behind them.
RADIUS Migration
At this stage we decided to migrate the RADIUS functionality to a Windows IAS Server. This would mean that authentication would be performed against Active Directory rather than E-Directory. By a stroke of luck a decent number of the E Directory accounts used were already synchronised with AD using Identity Manager. Unfortunately a large number were not, which left us in a difficult situation. As stated we are unable to change the usernames and passwords used on the ADSL routers as we don’t have passwords for them and now we have accounts that we don’t have passwords for.
I did a bit of Googling. It is possible to capture RADIUS traffic, but the password is encrypted with a shared secret. Then I found the Wireshark Wiki page on RADIUS (http://wiki.wireshark.org/Radius). Wireshark can quite happily decrypt RADIUS if you configure the RADIUS shared secret within the app. To do this:
- Open Wireshark. Go to Edit, Preferences
- Expand Protocols, then go to RADIUS.
- Populate the Shared Secret field.
So now all I needed was the RADIUS shared secret. This is stored in BorderManager and cannot be exported. I tried various asterisk reveal apps with no luck. Luckily the company who maintains the RADIUS proxy servers which forward the authentication requests (Telecom) were able to give this to me.
Next problem, how do I capture network traffic on a Novell server? I can’t install Wireshark locally (it may be possible but god knows how!). Network Team to the rescue here. I got a colleague to mirror the port that the RADIUS server was on to an unused NIC on an old server. This means that all traffic to and from the RADIUS server also shows up on this unused NIC. I installed Wireshark, unbound TCP/IP from the spare adapter (just in case it caused issues) and started capturing.
It is impossible to try and watch unfiltered traffic so I started with the following display filter: radius
This shows all RADIUS traffic. Simple and effective. However it soon became apparent that I was only interested in the
Access-Request packets, not the accounting ones. So after a bit of playing I had the following: radius.code==1. RADIUS code 1 is Access-Request, which is the packet that contains the username and password.
Now I could catch every authentication request sent to the Novell RADIUS server and hopefully see the username and password used. I crossed my fingers and waited.
It worked. As you can see from the packet below we can now see the username and decrypted password!
We left Wireshark Capturing for a week and managed to capture all but 5 of the passwords we needed. Phone calls to the remaining sites asking them to reboot their routers got the rest.
All that is left to do is configure IAS on the Windows Server and perform the change. I’ll write about those in another post soon. In the meantime I’m going to be sitting here feeling happy with myself for learning something new.