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
b08d5827
Commit
b08d5827
authored
Sep 25, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/opnsense: apply style here too
parent
c91304c9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
12 deletions
+21
-12
generate_certs.php
...pnsense/scripts/OPNsense/CaptivePortal/generate_certs.php
+14
-4
process_accounting_messages.php
...ts/OPNsense/CaptivePortal/process_accounting_messages.php
+5
-5
generate_cert.php
src/opnsense/scripts/proxy/generate_cert.php
+1
-0
remote_backup.php
src/opnsense/scripts/remote_backup.php
+1
-1
api.php
src/opnsense/www/api.php
+0
-1
index.php
src/opnsense/www/index.php
+0
-1
No files found.
src/opnsense/scripts/OPNsense/CaptivePortal/generate_certs.php
View file @
b08d5827
...
...
@@ -35,6 +35,7 @@ require_once("config.inc");
require_once
(
"certs.inc"
);
require_once
(
"legacy_bindings.inc"
);
use
OPNsense\Core\Config
;
global
$config
;
// traverse captive portal zones
...
...
@@ -48,17 +49,26 @@ if (isset($configObj->OPNsense->captiveportal->zones)) {
foreach
(
$configObj
->
cert
as
$cert
)
{
if
(
$cert_refid
==
(
string
)
$cert
->
refid
)
{
// generate cert pem file
$pem_content
=
trim
(
str_replace
(
"
\n\n
"
,
"
\n
"
,
str_replace
(
"
\r
"
,
""
,
base64_decode
((
string
)
$cert
->
crt
))));
$pem_content
=
trim
(
str_replace
(
"
\n\n
"
,
"
\n
"
,
str_replace
(
"
\r
"
,
""
,
base64_decode
((
string
)
$cert
->
crt
)
)));
$pem_content
.=
"
\n
"
;
$pem_content
.=
trim
(
str_replace
(
"
\n\n
"
,
"
\n
"
,
str_replace
(
"
\r
"
,
""
,
base64_decode
((
string
)
$cert
->
prv
))));
$pem_content
.=
trim
(
str_replace
(
"
\n\n
"
,
"
\n
"
,
str_replace
(
"
\r
"
,
""
,
base64_decode
((
string
)
$cert
->
prv
))
));
$pem_content
.=
"
\n
"
;
$output_pem_filename
=
"/var/etc/cert-cp-zone"
.
$zone_id
.
".pem"
;
$output_pem_filename
=
"/var/etc/cert-cp-zone"
.
$zone_id
.
".pem"
;
file_put_contents
(
$output_pem_filename
,
$pem_content
);
chmod
(
$output_pem_filename
,
0600
);
echo
"certificate generated "
.
$output_pem_filename
.
"
\n
"
;
// generate ca pem file
if
(
!
empty
(
$cert
->
caref
))
{
$output_pem_filename
=
"/var/etc/ca-cp-zone"
.
$zone_id
.
".pem"
;
$output_pem_filename
=
"/var/etc/ca-cp-zone"
.
$zone_id
.
".pem"
;
$cert
=
(
array
)
$cert
;
$ca
=
ca_chain
(
$cert
);
file_put_contents
(
$output_pem_filename
,
$ca
);
...
...
src/opnsense/scripts/OPNsense/CaptivePortal/process_accounting_messages.php
View file @
b08d5827
...
...
@@ -55,7 +55,7 @@ $result = $db->query('
// process all sessions
if
(
$result
!==
false
)
{
while
(
$row
=
$result
->
fetchArray
(
SQLITE3_ASSOC
)
)
{
while
(
$row
=
$result
->
fetchArray
(
SQLITE3_ASSOC
))
{
$authFactory
=
new
OPNsense\Auth\AuthenticationFactory
();
$authenticator
=
$authFactory
->
get
(
$row
[
'authenticated_via'
]);
if
(
$authenticator
!=
null
)
{
...
...
@@ -66,11 +66,11 @@ if ($result !== false) {
$stmt
->
bindParam
(
':zoneid'
,
$row
[
'zoneid'
]);
$stmt
->
bindParam
(
':sessionid'
,
$row
[
'sessionid'
]);
$stmt
->
execute
();
if
(
method_exists
(
$authenticator
,
'startAccounting'
))
{
if
(
method_exists
(
$authenticator
,
'startAccounting'
))
{
// send start accounting event
$authenticator
->
startAccounting
(
$row
[
'username'
],
$row
[
'sessionid'
]);
}
}
elseif
(
$row
[
'deleted'
]
==
1
&&
$row
[
'state'
]
!=
'STOPPED'
)
{
}
elseif
(
$row
[
'deleted'
]
==
1
&&
$row
[
'state'
]
!=
'STOPPED'
)
{
// stop accounting, send stop event (if applicable)
$stmt
=
$db
->
prepare
(
'update accounting_state
set state = \'STOPPED\'
...
...
@@ -79,13 +79,13 @@ if ($result !== false) {
$stmt
->
bindParam
(
':zoneid'
,
$row
[
'zoneid'
]);
$stmt
->
bindParam
(
':sessionid'
,
$row
[
'sessionid'
]);
$stmt
->
execute
();
if
(
method_exists
(
$authenticator
,
'startAccounting'
))
{
if
(
method_exists
(
$authenticator
,
'startAccounting'
))
{
$time_spend
=
time
()
-
$row
[
'created'
];
$authenticator
->
stopAccounting
(
$row
[
'username'
],
$row
[
'sessionid'
],
$time_spend
);
}
}
elseif
(
$row
[
'state'
]
!=
'STOPPED'
)
{
// send interim updates (if applicable)
if
(
method_exists
(
$authenticator
,
'updateAccounting'
))
{
if
(
method_exists
(
$authenticator
,
'updateAccounting'
))
{
// send interim update event
$time_spend
=
time
()
-
$row
[
'created'
];
$authenticator
->
updateAccounting
(
$row
[
'username'
],
$row
[
'sessionid'
],
$time_spend
);
...
...
src/opnsense/scripts/proxy/generate_cert.php
View file @
b08d5827
...
...
@@ -34,6 +34,7 @@ require_once("config.inc");
require_once
(
"certs.inc"
);
require_once
(
"legacy_bindings.inc"
);
use
OPNsense\Core\Config
;
global
$config
;
// Our template systems stores the ca certid into /usr/local/etc/squid/ca.pem.id
...
...
src/opnsense/scripts/remote_backup.php
View file @
b08d5827
#!/usr/local/bin/php
<?
<?
php
/**
* Backup to Google Drive (if configured)
*/
...
...
src/opnsense/www/api.php
View file @
b08d5827
...
...
@@ -24,7 +24,6 @@ try {
$application
=
new
\Phalcon\Mvc\Application
(
$di
);
echo
$application
->
handle
()
->
getContent
();
}
catch
(
\Exception
$e
)
{
$response
=
array
();
$response
[
'errorMessage'
]
=
$e
->
getMessage
();
...
...
src/opnsense/www/index.php
View file @
b08d5827
...
...
@@ -24,7 +24,6 @@ try {
$application
=
new
\Phalcon\Mvc\Application
(
$di
);
echo
$application
->
handle
()
->
getContent
();
}
catch
(
\Exception
$e
)
{
echo
$e
->
getMessage
();
}
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