Added session duration handling
This commit is contained in:
parent
2b7fbfdebd
commit
3a58c19c44
@ -30,6 +30,7 @@ catch (error) {
|
|||||||
client_secret: "password",
|
client_secret: "password",
|
||||||
default_vlan_enabled: false,
|
default_vlan_enabled: false,
|
||||||
mac_auth_only: false
|
mac_auth_only: false
|
||||||
|
session_duration: 60
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (process.env['NETRADIUS_PORT_RADIUS_AUTH']) config.ports.radius_authentication = process.env['NETRADIUS_PORT_RADIUS_AUTH'];
|
if (process.env['NETRADIUS_PORT_RADIUS_AUTH']) config.ports.radius_authentication = process.env['NETRADIUS_PORT_RADIUS_AUTH'];
|
||||||
@ -40,6 +41,7 @@ if (process.env['NETRADIUS_DEFAULT_VLAN']) config.default_vlan_enabled = process
|
|||||||
if (process.env['NETRADIUS_DEFAULT_VLAN_ID']) config.default_vlan_id = process.env['NETRADIUS_DEFAULT_VLAN_ID'];
|
if (process.env['NETRADIUS_DEFAULT_VLAN_ID']) config.default_vlan_id = process.env['NETRADIUS_DEFAULT_VLAN_ID'];
|
||||||
if (process.env['NETRADIUS_CLIENT_SECRET']) config.client_secret = process.env['NETRADIUS_CLIENT_SECRET'];
|
if (process.env['NETRADIUS_CLIENT_SECRET']) config.client_secret = process.env['NETRADIUS_CLIENT_SECRET'];
|
||||||
if (process.env['NETRADIUS_MAC_AUTH_ONLY']) config.mac_auth_only = process.env['NETRADIUS_MAC_AUTH_ONLY'];
|
if (process.env['NETRADIUS_MAC_AUTH_ONLY']) config.mac_auth_only = process.env['NETRADIUS_MAC_AUTH_ONLY'];
|
||||||
|
if (process.env['NETRADIUS_SESSION_DURATION']) config.session_duration = process.env['NETRADIUS_SESSION_DURATION'];
|
||||||
|
|
||||||
// Set defaults
|
// Set defaults
|
||||||
if (!config.ports.radius_authentication) config.ports.radius_authentication = 1812;
|
if (!config.ports.radius_authentication) config.ports.radius_authentication = 1812;
|
||||||
|
|||||||
@ -18,6 +18,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
var user = data.authUser (username, password);
|
var user = data.authUser (username, password);
|
||||||
var vlan = false;
|
var vlan = false;
|
||||||
|
var code = 'Access-Reject';
|
||||||
if (user) {
|
if (user) {
|
||||||
log.write (username + " access granted to VLAN " + user.vlan);
|
log.write (username + " access granted to VLAN " + user.vlan);
|
||||||
code = 'Access-Accept';
|
code = 'Access-Accept';
|
||||||
@ -42,7 +43,8 @@ module.exports = {
|
|||||||
attributes: {
|
attributes: {
|
||||||
"Tunnel-Medium-Type": 6,
|
"Tunnel-Medium-Type": 6,
|
||||||
"Tunnel-Type": 13,
|
"Tunnel-Type": 13,
|
||||||
"Tunnel-Private-Group-Id": vlan
|
"Tunnel-Private-Group-Id": vlan,
|
||||||
|
"Session-Timeout": config.radius.session_duration || 60
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
callback (response, null);
|
callback (response, null);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user