Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
06f5db67
Commit
06f5db67
authored
Oct 26, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Auth, radius) suppress accounting messages when not enabled
parent
3cfac591
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
157 additions
and
145 deletions
+157
-145
Radius.php
src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php
+157
-145
No files found.
src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php
View file @
06f5db67
...
@@ -48,7 +48,7 @@ class Radius implements IAuthConnector
...
@@ -48,7 +48,7 @@ class Radius implements IAuthConnector
/**
/**
* @var null port to use for accounting
* @var null port to use for accounting
*/
*/
private
$acctPort
=
"1813"
;
private
$acctPort
=
null
;
/**
/**
* @var null shared secret to use for this server
* @var null shared secret to use for this server
...
@@ -120,6 +120,8 @@ class Radius implements IAuthConnector
...
@@ -120,6 +120,8 @@ class Radius implements IAuthConnector
*/
*/
public
function
startAccounting
(
$username
,
$sessionid
)
public
function
startAccounting
(
$username
,
$sessionid
)
{
{
// only send messages if target port specified
if
(
$this
->
acctPort
!=
null
)
{
$radius
=
radius_auth_open
();
$radius
=
radius_auth_open
();
$error
=
null
;
$error
=
null
;
...
@@ -130,7 +132,8 @@ class Radius implements IAuthConnector
...
@@ -130,7 +132,8 @@ class Radius implements IAuthConnector
$this
->
sharedSecret
,
$this
->
sharedSecret
,
$this
->
timeout
,
$this
->
timeout
,
$this
->
maxRetries
$this
->
maxRetries
))
{
)
)
{
$error
=
radius_strerror
(
$radius
);
$error
=
radius_strerror
(
$radius
);
}
elseif
(
!
radius_create_request
(
$radius
,
RADIUS_ACCOUNTING_REQUEST
))
{
}
elseif
(
!
radius_create_request
(
$radius
,
RADIUS_ACCOUNTING_REQUEST
))
{
$error
=
radius_strerror
(
$radius
);
$error
=
radius_strerror
(
$radius
);
...
@@ -162,7 +165,7 @@ class Radius implements IAuthConnector
...
@@ -162,7 +165,7 @@ class Radius implements IAuthConnector
syslog
(
LOG_ERR
,
'RadiusError:'
.
radius_strerror
(
$error
));
syslog
(
LOG_ERR
,
'RadiusError:'
.
radius_strerror
(
$error
));
exit
;
exit
;
}
}
switch
(
$req
)
{
switch
(
$req
)
{
case
RADIUS_ACCOUNTING_RESPONSE
:
case
RADIUS_ACCOUNTING_RESPONSE
:
break
;
break
;
default
:
default
:
...
@@ -172,6 +175,7 @@ class Radius implements IAuthConnector
...
@@ -172,6 +175,7 @@ class Radius implements IAuthConnector
radius_close
(
$radius
);
radius_close
(
$radius
);
}
}
}
}
}
/**
/**
* stop radius accounting
* stop radius accounting
...
@@ -181,6 +185,8 @@ class Radius implements IAuthConnector
...
@@ -181,6 +185,8 @@ class Radius implements IAuthConnector
*/
*/
public
function
stopAccounting
(
$username
,
$sessionid
,
$session_time
)
public
function
stopAccounting
(
$username
,
$sessionid
,
$session_time
)
{
{
// only send messages if target port specified
if
(
$this
->
acctPort
!=
null
)
{
$radius
=
radius_auth_open
();
$radius
=
radius_auth_open
();
$error
=
null
;
$error
=
null
;
...
@@ -191,7 +197,8 @@ class Radius implements IAuthConnector
...
@@ -191,7 +197,8 @@ class Radius implements IAuthConnector
$this
->
sharedSecret
,
$this
->
sharedSecret
,
$this
->
timeout
,
$this
->
timeout
,
$this
->
maxRetries
$this
->
maxRetries
))
{
)
)
{
$error
=
radius_strerror
(
$radius
);
$error
=
radius_strerror
(
$radius
);
}
elseif
(
!
radius_create_request
(
$radius
,
RADIUS_ACCOUNTING_REQUEST
))
{
}
elseif
(
!
radius_create_request
(
$radius
,
RADIUS_ACCOUNTING_REQUEST
))
{
$error
=
radius_strerror
(
$radius
);
$error
=
radius_strerror
(
$radius
);
...
@@ -227,7 +234,7 @@ class Radius implements IAuthConnector
...
@@ -227,7 +234,7 @@ class Radius implements IAuthConnector
syslog
(
LOG_ERR
,
'RadiusError:'
.
radius_strerror
(
$error
));
syslog
(
LOG_ERR
,
'RadiusError:'
.
radius_strerror
(
$error
));
exit
;
exit
;
}
}
switch
(
$req
)
{
switch
(
$req
)
{
case
RADIUS_ACCOUNTING_RESPONSE
:
case
RADIUS_ACCOUNTING_RESPONSE
:
break
;
break
;
default
:
default
:
...
@@ -237,6 +244,7 @@ class Radius implements IAuthConnector
...
@@ -237,6 +244,7 @@ class Radius implements IAuthConnector
radius_close
(
$radius
);
radius_close
(
$radius
);
}
}
}
}
}
/**
/**
* update radius accounting (interim update)
* update radius accounting (interim update)
...
@@ -246,6 +254,8 @@ class Radius implements IAuthConnector
...
@@ -246,6 +254,8 @@ class Radius implements IAuthConnector
*/
*/
public
function
updateAccounting
(
$username
,
$sessionid
,
$session_time
)
public
function
updateAccounting
(
$username
,
$sessionid
,
$session_time
)
{
{
// only send messages if target port specified
if
(
$this
->
acctPort
!=
null
)
{
$radius
=
radius_auth_open
();
$radius
=
radius_auth_open
();
if
(
!
defined
(
'RADIUS_UPDATE'
))
{
if
(
!
defined
(
'RADIUS_UPDATE'
))
{
define
(
'RADIUS_UPDATE'
,
3
);
define
(
'RADIUS_UPDATE'
,
3
);
...
@@ -259,7 +269,8 @@ class Radius implements IAuthConnector
...
@@ -259,7 +269,8 @@ class Radius implements IAuthConnector
$this
->
sharedSecret
,
$this
->
sharedSecret
,
$this
->
timeout
,
$this
->
timeout
,
$this
->
maxRetries
$this
->
maxRetries
))
{
)
)
{
$error
=
radius_strerror
(
$radius
);
$error
=
radius_strerror
(
$radius
);
}
elseif
(
!
radius_create_request
(
$radius
,
RADIUS_ACCOUNTING_REQUEST
))
{
}
elseif
(
!
radius_create_request
(
$radius
,
RADIUS_ACCOUNTING_REQUEST
))
{
$error
=
radius_strerror
(
$radius
);
$error
=
radius_strerror
(
$radius
);
...
@@ -293,7 +304,7 @@ class Radius implements IAuthConnector
...
@@ -293,7 +304,7 @@ class Radius implements IAuthConnector
syslog
(
LOG_ERR
,
'RadiusError:'
.
radius_strerror
(
$error
));
syslog
(
LOG_ERR
,
'RadiusError:'
.
radius_strerror
(
$error
));
exit
;
exit
;
}
}
switch
(
$req
)
{
switch
(
$req
)
{
case
RADIUS_ACCOUNTING_RESPONSE
:
case
RADIUS_ACCOUNTING_RESPONSE
:
break
;
break
;
default
:
default
:
...
@@ -303,6 +314,7 @@ class Radius implements IAuthConnector
...
@@ -303,6 +314,7 @@ class Radius implements IAuthConnector
radius_close
(
$radius
);
radius_close
(
$radius
);
}
}
}
}
}
/**
/**
* authenticate user against radius
* authenticate user against radius
...
...
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