From 87e8313108775b607ded14e88b687a916b2c4206 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 26 Feb 2020 10:56:29 +0100 Subject: [PATCH] chore: dependency updates, some cleanups and doc fixes --- README.md | 2 +- package.json | 4 ++-- src/app.ts | 3 ++- src/radius/handler/eap/eapMethods/EAP-MD5.ts | 8 ++------ src/radius/handler/eap/eapMethods/EAP-TTLS.ts | 6 ------ src/types/EAPChallenge.ts | 3 --- src/types/Handler.ts | 20 ------------------- 7 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 src/types/EAPChallenge.ts delete mode 100644 src/types/Handler.ts diff --git a/README.md b/README.md index f188ba7..519206f 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Therefore it's not easy to extend or modify it, or even bring new feature in. The idea of this project is to make a super simple node radius server, which is async by default. No complex thread handling, no other fancy thing. The basic goal is to make WPA2 authenticiation easy again. -### 802.11x protocol in node +### 802.1x protocol in node Another motivation is that it is very exciting to see how wireless protocols have evolved, and see how a implementation like TTLS works. diff --git a/package.json b/package.json index afeda0c..b9795ef 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "dependencies": { "debug": "^4.1.1", "imap-simple": "^4.3.0", - "ldapauth-fork": "^4.3.1", + "ldapauth-fork": "^4.3.2", "ldapjs": "^1.0.2", "md5": "^2.2.1", "native-duplexpair": "^1.0.0", @@ -38,7 +38,7 @@ "@types/radius": "0.0.28", "chai": "^4.2.0", "eslint": "^6.8.0", - "mocha": "^7.0.1", + "mocha": "^7.1.0", "prettier": "^1.19.1", "typescript": "^3.8.2" } diff --git a/src/app.ts b/src/app.ts index 35a98eb..09514ec 100644 --- a/src/app.ts +++ b/src/app.ts @@ -9,7 +9,8 @@ import { startTLSServer } from './tls/crypt'; /* test node version */ const testSocket = startTLSServer(); if (typeof (testSocket.tls as any).exportKeyingMaterial !== 'function') { - console.error('UNSUPPORTED NODE VERSION FOUND!!') + console.error(`UNSUPPORTED NODE VERSION (${process.version}) FOUND!!`); + console.log('run "sudo npx n nightly" to get nightly build of node js.'); process.exit(-1); } diff --git a/src/radius/handler/eap/eapMethods/EAP-MD5.ts b/src/radius/handler/eap/eapMethods/EAP-MD5.ts index 5c7ebf5..db4c1ef 100644 --- a/src/radius/handler/eap/eapMethods/EAP-MD5.ts +++ b/src/radius/handler/eap/eapMethods/EAP-MD5.ts @@ -3,16 +3,10 @@ /* eslint-disable no-bitwise */ import { RadiusPacket } from 'radius'; import debug from 'debug'; -import { ResponseAuthHandler } from '../../../../types/Handler'; import { IPacketHandlerResult } from '../../../../types/PacketHandler'; import { IEAPMethod } from '../../../../types/EAPMethod'; import { IAuthentication } from '../../../../types/Authentication'; -interface IEAPResponseHandlers { - response: (respData?: Buffer, msgType?: number) => void; - checkAuth: ResponseAuthHandler; -} - export class EAPMD5 implements IEAPMethod { getEAPType(): number { return 4; @@ -33,6 +27,8 @@ export class EAPMD5 implements IEAPMethod { ): Promise { // not implemented + debug('eap md5 not implemented...'); + return {}; } } diff --git a/src/radius/handler/eap/eapMethods/EAP-TTLS.ts b/src/radius/handler/eap/eapMethods/EAP-TTLS.ts index 79fe1cc..20d38ac 100644 --- a/src/radius/handler/eap/eapMethods/EAP-TTLS.ts +++ b/src/radius/handler/eap/eapMethods/EAP-TTLS.ts @@ -8,7 +8,6 @@ import { attr_id_to_name, attr_name_to_id } from 'radius'; import debug from 'debug'; import { encodeTunnelPW, ITLSServer, startTLSServer } from '../../../../tls/crypt'; -import { ResponseAuthHandler } from '../../../../types/Handler'; import { IPacket, IPacketAttributes, @@ -23,11 +22,6 @@ import { secret } from '../../../../../config'; const log = debug('radius:eap:ttls'); -interface IEAPResponseHandlers { - response: (respData?: Buffer, msgType?: number) => void; - checkAuth: ResponseAuthHandler; -} - function tlsHasExportKeyingMaterial( tlsSocket ): tlsSocket is { diff --git a/src/types/EAPChallenge.ts b/src/types/EAPChallenge.ts deleted file mode 100644 index d99dd4f..0000000 --- a/src/types/EAPChallenge.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface IEAPChallenge { - decode(data: Buffer, stateID: string): { username: string; password?: string }; -} diff --git a/src/types/Handler.ts b/src/types/Handler.ts deleted file mode 100644 index 165eb9a..0000000 --- a/src/types/Handler.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { RadiusPacket } from 'radius'; - -export type ResponseHandler = ( - msg: Buffer -) => Promise<{ identifier: number; response: ResponseHandler }>; -export type ResponseAuthHandler = ( - username: string, - password: string, - additionalAuthHandler?: AdditionalAuthHandler -) => void; - -export interface IResponseHandlers { - response: ResponseHandler; - checkAuth: ResponseAuthHandler; -} - -export type AdditionalAuthHandler = ( - success: boolean, - params: { packet: RadiusPacket; attributes: any[]; secret: string } -) => void;