]> PHS Git Server - phs-api.git/commitdiff
Testing vpn paths.
authorcharleswrayjr <charleswrayjr@gmail.com>
Mon, 8 Sep 2025 04:01:27 +0000 (23:01 -0500)
committercharleswrayjr <charleswrayjr@gmail.com>
Mon, 8 Sep 2025 04:01:27 +0000 (23:01 -0500)
src/controllers/vpn.controller.js

index 395ae58bcf60c2b229b023e2f63f66086021bb6c..7ec5747347b87bb64f01b2508e0f82967c203015 100644 (file)
@@ -75,7 +75,7 @@ module.exports = {
   }, getClients:async ( req, res, next ) => {
     const conn = new Client();
     conn.on( 'ready', () => {
-      const command = `cat /var/log/openvpn/openvpn-status.log | grep "OpenVPN CLIENT LIST`;
+      const command = `cat /var/log/openvpn/openvpn-status.log`;
       conn.exec( command, ( err, stream ) => {
         if (err) {
           conn.end();
@@ -87,7 +87,7 @@ module.exports = {
         stream.on( 'close', ( code ) => {
           conn.end();
           if (code === 0) {
-            const clients = output.split( '\n' ).filter( line => line.includes( 'CLIENT_LIST' ) ).map( line => {
+            const clients = output.split( '\n' ).filter( line => line.startsWith( 'Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since' ) ).map( line => {
               const parts = line.split( ',' );
               return { name:parts[1], ip:parts[2], connectedSince:parts[8] };
             } );