Testing » History » Version 2
    « Previous - 
    Version 2/4
    (diff) - 
    Next » - 
    Current version
    
    Luke Murphey, 10/28/2016 10:05 PM 
    
    
Testing¶
Below is information regarding how to set up a RADIUS server in order to run the unit tests against.
Install a RADIUS server (FreeRADIUS)¶
Install FreeRADIUS per directions for your OS. On mac, you can install it via brew:
brew install freeradius-server
Setup a user¶
Create a user for testing bu adding one to the users config file (raddb/users). The actual path varies. On a Mac with FreeRADIUS 3.0.12, the file is at /usr/local/Cellar/freeradius-server/3.0.12/etc/raddb/.
I usually just use the example that is suggested in the FreeRADIUS docs:
bob    Cleartext-Password := "hello" 
       Reply-Message := "Hello, %{User-Name}" 
	
Test your RADIUS server with radtest¶
Start FreeRADIUS in debugging mode:
radiusd -X
Next, run radtest against the server:
radtest bob hello localhost 0 testing123
If successful, you should see a message ending with:
Received Access-Accept Id 238 from 127.0.0.1:1812 to 0.0.0.0:0 length 32
    Reply-Message = "Hello, bob" 
	
Setup FreeRADIUS with the vendor specific roles¶
Install the vendor specific dictionary for Splunk¶
Install the Splunk vendor specific dictionary.
BEGIN-VENDOR Splunk
    ATTRIBUTE Splunk-Roles 1 string
END-VENDOR Splunk
	This file should be saved to something like "splunk.dictionary" and added to the dictionary file:
$INCLUDE /usr/local/Cellar/freeradius-server/3.0.12/etc/raddb/splunk.dictionary
Modify user account to set roles¶
Modify the users file to return the roles:
bob    Cleartext-Password := "hello" 
       Reply-Message := "Hello, %{User-Name}",
       Splunk-Roles = "can_delete,admin" 
	Next, run radtest against the server:
radtest bob hello localhost 0 testing123
If successful, you should see a message with the roles:
Received Access-Accept Id 16 from 127.0.0.1:1812 to 0.0.0.0:0 length 56
    Reply-Message = "Hello, bob" 
    Splunk-Roles = "can_delete,admin" 
	
Setup Splunk¶
Install Splunk and the RADIUS authentication app.
To run the tests with the given configuration, use the following local.build.properties file:
value.test.radius.server=127.0.0.1 value.test.radius.secret=testing123 value.test.radius.username=bob value.test.radius.password=hello value.test.radius.identifier=unit_test value.test.radius.vendor_code=27389 value.test.radius.roles_attribute_id=1