Get 802.1x authentication method

This commit is contained in:
VP-002 U 2019-11-05 14:04:37 -05:00
parent 86389999de
commit bd7e69be9b

View File

@ -436,6 +436,22 @@ function getLinuxIfaceDNSsuffix(connectionName) {
}
}
function getLinuxIfaceAuthProtocol(connectionName) {
if(connectionName) {
const cmd = `nmcli connection show "${connectionName}" \| grep 802-1x.eap;`;
try {
const result = execSync(cmd).toString();
const resultFormat = result.replace(/\s+/g,' ').trim();
const authenticationProtocol = resultFormat.split(" ").slice(1).toString();
return authenticationProtocol == '--' ? '': authenticationProtocol;
} catch (e) {
return 'Not configured';
}
} else {
return 'Not configured';
}
}
function testVirtualNic(iface, ifaceName, mac) {
const virtualMacs = ['00:00:00:00:00:00', '00:03:FF', '00:05:69', '00:0C:29', '00:0F:4B', '00:0F:4B', '00:13:07', '00:13:BE', '00:15:5d', '00:16:3E', '00:1C:42', '00:21:F6', '00:21:F6', '00:24:0B', '00:24:0B', '00:50:56', '00:A0:B1', '00:E0:C8', '08:00:27', '0A:00:27', '18:92:2C', '16:DF:49', '3C:F3:92', '54:52:00', 'FC:15:97'];
if (mac) {
@ -507,6 +523,7 @@ function networkInterfaces(callback) {
let operstate = 'down';
let dhcp = false;
let dnsSuffix = '';
let authMethod = '';
let type = '';
if (ifaces.hasOwnProperty(dev)) {
@ -563,6 +580,7 @@ function networkInterfaces(callback) {
const connectionName = getLinuxIfaceConnectionName(iface);
dhcp = getLinuxIfaceDHCPstatus(connectionName);
dnsSuffix = getLinuxIfaceDNSsuffix(connectionName);
authMethod = getLinuxIfaceAuthProtocol(connectionName);
lines = execSync(cmd).toString().split('\n');
@ -585,6 +603,7 @@ function networkInterfaces(callback) {
if (iface === 'lo' || iface.startsWith('bond')) { type = 'virtual'; }
}
if (_windows) {
authMethod = 'Unknow';
dnsSuffix = getWindowsIfaceDNSsuffix(dnsSuffixes.ifaces, dev);
nics.forEach(detail => {
if (detail.mac === mac) {
@ -616,6 +635,7 @@ function networkInterfaces(callback) {
speed,
dhcp,
dnsSuffix,
authMethod,
carrierChanges,
});
}