Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Node Radius Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Node Radius Server
Commits
1778948e
Commit
1778948e
authored
Jan 23, 2021
by
simon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: bring everything up2date
parent
4711c385
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
3822 additions
and
3206 deletions
+3822
-3206
package-lock.json
package-lock.json
+3794
-3181
package.json
package.json
+9
-9
src/auth/GoogleLDAPAuth.ts
src/auth/GoogleLDAPAuth.ts
+11
-6
src/auth/LDAPAuth.ts
src/auth/LDAPAuth.ts
+4
-4
src/radius/handler/EAPPacketHandler.ts
src/radius/handler/EAPPacketHandler.ts
+4
-6
No files found.
package-lock.json
View file @
1778948e
This diff is collapsed.
Click to expand it.
package.json
View file @
1778948e
...
@@ -34,27 +34,27 @@
...
@@ -34,27 +34,27 @@
"
debug
"
:
"
^4.3.1
"
,
"
debug
"
:
"
^4.3.1
"
,
"
imap-simple
"
:
"
^5.0.0
"
,
"
imap-simple
"
:
"
^5.0.0
"
,
"
ldapauth-fork
"
:
"
^5.0.1
"
,
"
ldapauth-fork
"
:
"
^5.0.1
"
,
"
ldapjs
"
:
"
^2.2.
2
"
,
"
ldapjs
"
:
"
^2.2.
3
"
,
"
native-duplexpair
"
:
"
^1.0.0
"
,
"
native-duplexpair
"
:
"
^1.0.0
"
,
"
node-cache
"
:
"
^5.1.2
"
,
"
node-cache
"
:
"
^5.1.2
"
,
"
radius
"
:
"
~1.1.4
"
,
"
radius
"
:
"
~1.1.4
"
,
"
smtp-client
"
:
"
^0.3.3
"
,
"
smtp-client
"
:
"
^0.3.3
"
,
"
yargs
"
:
"
~16.
1.1
"
"
yargs
"
:
"
~16.
2.0
"
},
},
"license"
:
"GPLv3"
,
"license"
:
"GPLv3"
,
"devDependencies"
:
{
"devDependencies"
:
{
"
@hokify/eslint-config
"
:
"
^1.
0.5
"
,
"
@hokify/eslint-config
"
:
"
^1.
1.0
"
,
"
@types/chai
"
:
"
^4.2.14
"
,
"
@types/chai
"
:
"
^4.2.14
"
,
"
@types/ldapjs
"
:
"
^1.0.9
"
,
"
@types/ldapjs
"
:
"
^1.0.9
"
,
"
@types/mocha
"
:
"
^8.
0.4
"
,
"
@types/mocha
"
:
"
^8.
2.0
"
,
"
@types/radius
"
:
"
0.0.28
"
,
"
@types/radius
"
:
"
0.0.28
"
,
"
@types/yargs
"
:
"
^15.0.1
0
"
,
"
@types/yargs
"
:
"
^15.0.1
2
"
,
"
chai
"
:
"
^4.2.0
"
,
"
chai
"
:
"
^4.2.0
"
,
"
eslint
"
:
"
^7.1
4
.0
"
,
"
eslint
"
:
"
^7.1
8
.0
"
,
"
mocha
"
:
"
^8.2.1
"
,
"
mocha
"
:
"
^8.2.1
"
,
"
prettier
"
:
"
^2.2.1
"
,
"
prettier
"
:
"
^2.2.1
"
,
"
standard-version
"
:
"
^9.
0
.0
"
,
"
standard-version
"
:
"
^9.
1
.0
"
,
"
ts-node
"
:
"
^9.
0.0
"
,
"
ts-node
"
:
"
^9.
1.1
"
,
"
typescript
"
:
"
^4.1.
2
"
"
typescript
"
:
"
^4.1.
3
"
}
}
}
}
src/auth/GoogleLDAPAuth.ts
View file @
1778948e
...
@@ -79,7 +79,7 @@ export class GoogleLDAPAuth implements IAuthentication {
...
@@ -79,7 +79,7 @@ export class GoogleLDAPAuth implements IAuthentication {
return
;
return
;
}
}
res
.
on
(
'
searchEntry
'
,
function
(
entry
)
{
res
.
on
(
'
searchEntry
'
,
(
entry
)
=>
{
// log('entry: ' + JSON.stringify(entry.object));
// log('entry: ' + JSON.stringify(entry.object));
usernameFields
.
forEach
((
field
)
=>
{
usernameFields
.
forEach
((
field
)
=>
{
const
index
=
entry
.
object
[
field
]
as
string
;
const
index
=
entry
.
object
[
field
]
as
string
;
...
@@ -87,11 +87,11 @@ export class GoogleLDAPAuth implements IAuthentication {
...
@@ -87,11 +87,11 @@ export class GoogleLDAPAuth implements IAuthentication {
});
});
});
});
res
.
on
(
'
searchReference
'
,
function
(
referral
)
{
res
.
on
(
'
searchReference
'
,
(
referral
)
=>
{
log
(
`referral:
${
referral
.
uris
.
join
()}
`
);
log
(
`referral:
${
referral
.
uris
.
join
()}
`
);
});
});
res
.
on
(
'
error
'
,
function
(
ldapErr
)
{
res
.
on
(
'
error
'
,
(
ldapErr
)
=>
{
console
.
error
(
`error:
${
JSON
.
stringify
(
ldapErr
)}
`
);
console
.
error
(
`error:
${
JSON
.
stringify
(
ldapErr
)}
`
);
reject
(
ldapErr
);
reject
(
ldapErr
);
});
});
...
@@ -110,7 +110,12 @@ export class GoogleLDAPAuth implements IAuthentication {
...
@@ -110,7 +110,12 @@ export class GoogleLDAPAuth implements IAuthentication {
this.lastDNsFetch = new Date();
this.lastDNsFetch = new Date();
}
}
async authenticate(username: string, password: string, count = 0, forceFetching = false) {
async authenticate(
username: string,
password: string,
count = 0,
forceFetching = false
): Promise<boolean> {
const cacheValidTime = new Date();
const cacheValidTime = new Date();
cacheValidTime.setHours(cacheValidTime.getHours() - 12);
cacheValidTime.setHours(cacheValidTime.getHours() - 12);
...
@@ -150,7 +155,7 @@ export class GoogleLDAPAuth implements IAuthentication {
...
@@ -150,7 +155,7 @@ export class GoogleLDAPAuth implements IAuthentication {
authClient
.
bind
(
dn
,
password
,
(
err
,
res
)
=>
{
authClient
.
bind
(
dn
,
password
,
(
err
,
res
)
=>
{
if
(
err
)
{
if
(
err
)
{
if
(
err
&&
(
err
as
any
).
stack
&&
(
err
as
any
).
stack
.
includes
(
`ldap.google.com closed`
))
{
if
(
err
&&
(
err
as
any
).
stack
&&
(
err
as
any
).
stack
.
includes
(
`ldap.google.com closed`
))
{
count
++
;
count
+=
1
;
// wait 1 second to give the ldap error handler time to reconnect
// wait 1 second to give the ldap error handler time to reconnect
setTimeout
(()
=>
resolve
(
this
.
authenticate
(
dn
,
password
)),
2000
);
setTimeout
(()
=>
resolve
(
this
.
authenticate
(
dn
,
password
)),
2000
);
return
;
return
;
...
@@ -167,6 +172,6 @@ export class GoogleLDAPAuth implements IAuthentication {
...
@@ -167,6 +172,6 @@ export class GoogleLDAPAuth implements IAuthentication {
});
});
});
});
return
!!
authResult
;
return
authResult
;
}
}
}
}
src/auth/LDAPAuth.ts
View file @
1778948e
...
@@ -43,14 +43,14 @@ export class LDAPAuth implements IAuthentication {
...
@@ -43,14 +43,14 @@ export class LDAPAuth implements IAuthentication {
searchFilter
:
config
.
searchFilter
||
'
(uid={{username}})
'
,
searchFilter
:
config
.
searchFilter
||
'
(uid={{username}})
'
,
reconnect
:
true
,
reconnect
:
true
,
});
});
this
.
ldap
.
on
(
'
error
'
,
function
(
err
)
{
this
.
ldap
.
on
(
'
error
'
,
(
err
)
=>
{
console
.
error
(
'
LdapAuth:
'
,
err
);
console
.
error
(
'
LdapAuth:
'
,
err
);
});
});
}
}
async
authenticate
(
username
:
string
,
password
:
string
)
{
async
authenticate
(
username
:
string
,
password
:
string
)
:
Promise
<
boolean
>
{
const
authResult
:
boolean
=
await
new
Promise
((
resolve
,
reject
)
=>
{
const
authResult
:
boolean
=
await
new
Promise
((
resolve
,
reject
)
=>
{
this
.
ldap
.
authenticate
(
username
,
password
,
function
(
err
,
user
)
{
this
.
ldap
.
authenticate
(
username
,
password
,
(
err
,
user
)
=>
{
if
(
err
)
{
if
(
err
)
{
resolve
(
false
);
resolve
(
false
);
console
.
error
(
'
ldap error
'
,
err
);
console
.
error
(
'
ldap error
'
,
err
);
...
@@ -61,6 +61,6 @@ export class LDAPAuth implements IAuthentication {
...
@@ -61,6 +61,6 @@ export class LDAPAuth implements IAuthentication {
});
});
});
});
return
!!
authResult
;
return
authResult
;
}
}
}
}
src/radius/handler/EAPPacketHandler.ts
View file @
1778948e
...
@@ -86,9 +86,9 @@ export class EAPPacketHandler implements IPacketHandler {
...
@@ -86,9 +86,9 @@ export class EAPPacketHandler implements IPacketHandler {
supportedEAPMethods
.
push
(
supportedMethod
);
supportedEAPMethods
.
push
(
supportedMethod
);
}
}
currentState
.
validMethods
=
currentState
.
validMethods
.
filter
(
(
method
)
=>
{
currentState
.
validMethods
=
currentState
.
validMethods
.
filter
(
return
supportedEAPMethods
.
includes
(
method
.
getEAPType
());
// kick it out?
(
method
)
=>
supportedEAPMethods
.
includes
(
method
.
getEAPType
())
// kick it out?
}
);
);
// save
// save
this
.
eapConnectionStates
.
set
(
stateID
,
currentState
);
this
.
eapConnectionStates
.
set
(
stateID
,
currentState
);
...
@@ -101,9 +101,7 @@ export class EAPPacketHandler implements IPacketHandler {
...
@@ -101,9 +101,7 @@ export class EAPPacketHandler implements IPacketHandler {
// continue with responding a NAK and add rest of supported methods
// continue with responding a NAK and add rest of supported methods
// eslint-disable-next-line no-fallthrough
// eslint-disable-next-line no-fallthrough
default
:
{
default
:
{
const
eapMethod
=
this
.
eapMethods
.
find
((
method
)
=>
{
const
eapMethod
=
this
.
eapMethods
.
find
((
method
)
=>
type
===
method
.
getEAPType
());
return
type
===
method
.
getEAPType
();
});
if
(
eapMethod
)
{
if
(
eapMethod
)
{
return
eapMethod
.
handleMessage
(
return
eapMethod
.
handleMessage
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment