Commit 843c6c01 authored by Girish Ramakrishnan's avatar Girish Ramakrishnan

print the CN for the logs

parent 818e760b
...@@ -282,7 +282,7 @@ const onClientConnect = (req, res, next) => { ...@@ -282,7 +282,7 @@ const onClientConnect = (req, res, next) => {
if (!cn || !remoteIp || !vpnIp) return next(new HttpError(400, 'Invalid Request')) if (!cn || !remoteIp || !vpnIp) return next(new HttpError(400, 'Invalid Request'))
const match = /^.*\/([A-Za-z0-9.]+)\/([A-Za-z0-9\-_]+)$/.exec(cn) // cn is the full path of the key that matched const match = /^.*\/([A-Za-z0-9.]+)\/([A-Za-z0-9\-_]+)$/.exec(cn) // cn is the full path of the key that matched
if (!match) return next(new HttpError(409, 'Invalid Request')) if (!match) return next(new HttpError(400, `Invalid CN: ${cn}`))
const [, user, deviceName] = match const [, user, deviceName] = match
Promise.race([ Promise.race([
...@@ -307,7 +307,7 @@ const onClientDisconnect = (req, res, next) => { ...@@ -307,7 +307,7 @@ const onClientDisconnect = (req, res, next) => {
if (!cn) return next(new HttpError(400, 'Invalid Request')) if (!cn) return next(new HttpError(400, 'Invalid Request'))
const match = /^.*\/([A-Za-z0-9.]+)\/([A-Za-z0-9\-_]+)$/.exec(cn) // cn is the full path of the key that matched const match = /^.*\/([A-Za-z0-9.]+)\/([A-Za-z0-9\-_]+)$/.exec(cn) // cn is the full path of the key that matched
if (!match) return next(new HttpError(409, 'Invalid Request')) if (!match) return next(new HttpError(400, `Invalid CN: ${cn}`))
const [, user, deviceName] = match const [, user, deviceName] = match
if (connectedClients[user] && connectedClients[user][deviceName]) { if (connectedClients[user] && connectedClients[user][deviceName]) {
...@@ -330,7 +330,7 @@ const onLearnAddress = (req, res, next) => { ...@@ -330,7 +330,7 @@ const onLearnAddress = (req, res, next) => {
if (operation === 'add' || operation === 'update') { if (operation === 'add' || operation === 'update') {
const match = /^.*\/([A-Za-z0-9.]+)\/([A-Za-z0-9\-_]+)$/.exec(cn) // cn is the full path of the key that matched const match = /^.*\/([A-Za-z0-9.]+)\/([A-Za-z0-9\-_]+)$/.exec(cn) // cn is the full path of the key that matched
if (!match) return next(new HttpError(409, 'Invalid Request')) if (!match) return next(new HttpError(400, `Invalid CN: ${cn}`))
const [, user, deviceName] = match const [, user, deviceName] = match
const hostname = deviceName + '.' + user const hostname = deviceName + '.' + user
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment