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
da71e1a0
Commit
da71e1a0
authored
Apr 18, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(ui) set httponly cookie, closes
https://github.com/opnsense/core/issues/897
parent
b78720b8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
authgui.inc
src/etc/inc/authgui.inc
+4
-1
services.php
src/opnsense/mvc/app/config/services.php
+10
-0
services_api.php
src/opnsense/mvc/app/config/services_api.php
+10
-0
No files found.
src/etc/inc/authgui.inc
View file @
da71e1a0
...
...
@@ -168,7 +168,10 @@ function session_auth(&$Login_Error)
);
if
(
session_status
()
==
PHP_SESSION_NONE
)
{
session_start
();
if
(
session_start
())
{
$sess_name
=
session_name
();
setcookie
(
$sess_name
,
session_id
(),
null
,
'/'
,
null
,
null
,
(
$config
[
'system'
][
'webgui'
][
'protocol'
]
==
"https"
));
}
}
// Detect protocol change
...
...
src/opnsense/mvc/app/config/services.php
View file @
da71e1a0
...
...
@@ -7,6 +7,7 @@ use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;
use
Phalcon\Mvc\View\Engine\Volt
as
VoltEngine
;
use
Phalcon\Mvc\Model\Metadata\Memory
as
MetaDataAdapter
;
use
Phalcon\Session\Adapter\Files
as
SessionAdapter
;
use
OPNsense\Core\Config
;
/**
* The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
...
...
@@ -75,6 +76,15 @@ $di->set('modelsMetadata', function () {
$di
->
setShared
(
'session'
,
function
()
{
$session
=
new
SessionAdapter
();
$session
->
start
();
// Set session response cookie, unfortunalty we need to read the config here to determine if secure option is
// a valid choice.
$cnf
=
Config
::
getInstance
();
if
((
string
)
$cnf
->
object
()
->
system
->
webgui
->
protocol
==
'https'
)
{
$secure
=
true
;
}
else
{
$secure
=
false
;
}
setcookie
(
session_name
(),
session_id
(),
null
,
'/'
,
null
,
$secure
,
true
);
return
$session
;
});
...
...
src/opnsense/mvc/app/config/services_api.php
View file @
da71e1a0
...
...
@@ -34,6 +34,7 @@ use Phalcon\Mvc\Url as UrlResolver;
use
Phalcon\Mvc\View
;
use
Phalcon\Mvc\Model\Metadata\Memory
as
MetaDataAdapter
;
use
Phalcon\Session\Adapter\Files
as
SessionAdapter
;
use
OPNsense\Core\Config
;
/**
* The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
...
...
@@ -62,6 +63,15 @@ $di->set('url', function () use ($config) {
$di
->
setShared
(
'session'
,
function
()
{
$session
=
new
SessionAdapter
();
$session
->
start
();
// Set session response cookie, unfortunalty we need to read the config here to determine if secure option is
// a valid choice.
$cnf
=
Config
::
getInstance
();
if
((
string
)
$cnf
->
object
()
->
system
->
webgui
->
protocol
==
'https'
)
{
$secure
=
true
;
}
else
{
$secure
=
false
;
}
setcookie
(
session_name
(),
session_id
(),
null
,
'/'
,
null
,
$secure
,
true
);
return
$session
;
});
...
...
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