const commands = [
`ls /etc/openvpn/ccd/* 2>/dev/null || true`,
`ls /etc/openvpn/easy-rsa/pki/issued/*.crt 2>/dev/null || true`,
+ 'ls /home/node/clients/* 2>/dev/null || true'
];
conn.exec( commands.join( ' && ' ), ( err, stream ) => {
if (err) {
}
console.log(output);
const clients = [];
- const ccdFiles = output.split('\n').filter(line => !line.endsWith('.crt')).filter( l => !l.startsWith('.') && l !== '' && !l.endsWith('server'));
+ const ccdFiles = output.split('\n').filter(line => !line.endsWith('.crt') && !line.endsWith('.ovpn')).filter( l => !l.startsWith('.') && l !== '' && !l.endsWith('server'));
const crtFiles = output.split('\n').filter(line => line.endsWith('.crt')).filter( l => !l.startsWith('.') && l !== '' && !l.endsWith('server.crt'));
-
+ const ovpnFiles = output.split('\n').filter(line => line.endsWith('.ovpn')).filter( l => !l.startsWith('.') && l !== '');
+ console.log(ovpnFiles);
console.log(ccdFiles);
console.log(crtFiles);
logger.warn( `staticIpMatch: ${ staticIpMatch }`);
const hasCrt = crtFiles.some( crt => crt.includes( `${ clientName }.crt` ) );
logger.warn(`hasCrt: ${ hasCrt }`);
+ const hasOvpn = ovpnFiles.some( ovpn => ovpn.includes( `${ clientName }.ovpn` ) );
+ const ovpnPath = `/home/node/clients/${ clientName }.ovpn`;
clients.push( {
clientName,
staticIp:staticIpMatch ? staticIpMatch[1] : null,
hasCertificate:hasCrt,
+ hasOvpn:hasOvpn,
+ ovpnPath
} );
} catch (error) {
logger.warn( `Failed to read ${ ccdFile }: ${ error.message }` );