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
92dbe83e
Commit
92dbe83e
authored
Aug 26, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: sample file has had garbage for aliases and ipsec since forever :(
parent
ba57a3be
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
60 additions
and
121 deletions
+60
-121
config.xml.sample
src/etc/config.xml.sample
+0
-77
filter.inc
src/etc/inc/filter.inc
+3
-3
ipsec.inc
src/etc/inc/ipsec.inc
+8
-4
system.inc
src/etc/inc/system.inc
+2
-1
upgrade_config.inc
src/etc/inc/upgrade_config.inc
+6
-3
rc.filter_synchronize
src/etc/rc.filter_synchronize
+6
-4
diag_ipsec.php
src/www/diag_ipsec.php
+2
-2
diag_logs_filter.php
src/www/diag_logs_filter.php
+12
-6
firewall_aliases.php
src/www/firewall_aliases.php
+1
-1
firewall_aliases_edit.php
src/www/firewall_aliases_edit.php
+2
-2
firewall_aliases_import.php
src/www/firewall_aliases_import.php
+2
-2
firewall_nat_out_edit.php
src/www/firewall_nat_out_edit.php
+2
-2
vpn_ipsec.php
src/www/vpn_ipsec.php
+1
-1
vpn_ipsec_keys.php
src/www/vpn_ipsec_keys.php
+1
-1
vpn_ipsec_keys_edit.php
src/www/vpn_ipsec_keys_edit.php
+3
-2
vpn_ipsec_mobile.php
src/www/vpn_ipsec_mobile.php
+1
-1
vpn_ipsec_phase1.php
src/www/vpn_ipsec_phase1.php
+1
-1
vpn_ipsec_phase2.php
src/www/vpn_ipsec_phase2.php
+4
-6
vpn_ipsec_settings.php
src/www/vpn_ipsec_settings.php
+3
-2
No files found.
src/etc/config.xml.sample
View file @
92dbe83e
...
...
@@ -530,83 +530,6 @@
</rule>
-->
</filter>
<ipsec>
<!-- <enable/> -->
<!-- syntax:
<tunnel>
<disabled/>
<auto/>
<descr></descr>
<interface>lan|wan|opt[n]</interface>
<local-subnet>
<address>xxx.xxx.xxx.xxx(/xx)</address>
*or*
<network>lan|opt[n]</network>
</local-subnet>
<remote-subnet>xxx.xxx.xxx.xxx/xx</remote-subnet>
<remote-gateway></remote-gateway>
<p1>
<mode></mode>
<myident>
<myaddress/>
*or*
<address>xxx.xxx.xxx.xxx</address>
*or*
<fqdn>the.fq.dn</fqdn>
</myident>
<encryption-algorithm></encryption-algorithm>
<hash-algorithm></hash-algorithm>
<dhgroup></dhgroup>
<lifetime></lifetime>
<pre-shared-key></pre-shared-key>
</p1>
<p2>
<protocol></protocol>
<encryption-algorithm-option></encryption-algorithm-option>
<hash-algorithm-option></hash-algorithm-option>
<pfsgroup></pfsgroup>
<lifetime></lifetime>
</p2>
</tunnel>
<mobileclients>
<enable/>
<p1>
<mode></mode>
<myident>
<myaddress/>
*or*
<address>xxx.xxx.xxx.xxx</address>
*or*
<fqdn>the.fq.dn</fqdn>
</myident>
<encryption-algorithm></encryption-algorithm>
<hash-algorithm></hash-algorithm>
<dhgroup></dhgroup>
<lifetime></lifetime>
</p1>
<p2>
<protocol></protocol>
<encryption-algorithm-option></encryption-algorithm-option>
<hash-algorithm-option></hash-algorithm-option>
<pfsgroup></pfsgroup>
<lifetime></lifetime>
</p2>
</mobileclients>
<mobilekey>
<ident></ident>
<pre-shared-key></pre-shared-key>
</mobilekey>
-->
</ipsec>
<aliases>
<!--
<alias>
<name></name>
<address>xxx.xxx.xxx.xxx(/xx)</address>
<descr></descr>
</alias>
-->
</aliases>
<proxyarp>
<!--
<proxyarpnet>
...
...
src/etc/inc/filter.inc
View file @
92dbe83e
...
...
@@ -709,7 +709,7 @@ function filter_get_vpns_list() {
/* ipsec */
if
(
isset
(
$config
[
'ipsec'
][
'enable'
]))
{
if
(
is
_array
(
$config
[
'ipsec'
][
'phase2'
]))
{
if
(
is
set
(
$config
[
'ipsec'
][
'phase2'
]))
{
foreach
(
$config
[
'ipsec'
][
'phase2'
]
as
$ph2ent
)
{
if
((
!
$ph2ent
[
'mobile'
])
&&
(
$ph2ent
[
'mode'
]
!=
'transport'
))
{
if
(
!
is_array
(
$ph2ent
[
'remoteid'
]))
...
...
@@ -1648,8 +1648,8 @@ function filter_nat_rules_generate() {
}
/* ipsec nat */
if
(
is_array
(
$config
[
'ipsec'
])
&&
isset
(
$config
[
'ipsec'
][
'enable'
]))
{
if
(
is
_array
(
$config
[
'ipsec'
][
'phase2'
]))
{
if
(
is
set
(
$config
[
'ipsec'
])
&&
is
_array
(
$config
[
'ipsec'
])
&&
isset
(
$config
[
'ipsec'
][
'enable'
]))
{
if
(
is
set
(
$config
[
'ipsec'
][
'phase2'
]))
{
foreach
(
$config
[
'ipsec'
][
'phase2'
]
as
$ph2ent
)
{
if
(
$ph2ent
[
'mode'
]
!=
'transport'
&&
!
empty
(
$ph2ent
[
'natlocalid'
]))
{
if
(
!
is_array
(
$ph2ent
[
'localid'
]))
...
...
src/etc/inc/ipsec.inc
View file @
92dbe83e
...
...
@@ -205,15 +205,19 @@ function ipsec_idinfo_to_text(& $idinfo) {
/*
* Return phase1 association for phase2
*/
function
ipsec_lookup_phase1
(
&
$ph2ent
,
&
$ph1ent
)
{
function
ipsec_lookup_phase1
(
&
$ph2ent
,
&
$ph1ent
)
{
global
$config
;
if
(
!
is
_array
(
$config
[
'ipsec'
]))
if
(
!
is
set
(
$config
[
'ipsec'
])
||
!
is_array
(
$config
[
'ipsec'
]))
{
return
false
;
if
(
!
is_array
(
$config
[
'ipsec'
][
'phase1'
]))
}
if
(
!
is_array
(
$config
[
'ipsec'
][
'phase1'
]))
{
return
false
;
if
(
empty
(
$config
[
'ipsec'
][
'phase1'
]))
}
if
(
empty
(
$config
[
'ipsec'
][
'phase1'
]))
{
return
false
;
}
foreach
(
$config
[
'ipsec'
][
'phase1'
]
as
$ph1tmp
)
{
if
(
$ph1tmp
[
'ikeid'
]
==
$ph2ent
[
'ikeid'
])
{
...
...
src/etc/inc/system.inc
View file @
92dbe83e
...
...
@@ -362,8 +362,9 @@ function system_hosts_generate()
$lhosts
.=
"
{
$host
[
'ip'
]
}
{
$host
[
'host'
]
}
.
{
$host
[
'domain'
]
}
{
$host
[
'host'
]
}
\n
"
;
else
$lhosts
.=
"
{
$host
[
'ip'
]
}
{
$host
[
'domain'
]
}
\n
"
;
if
(
!
is
_array
(
$host
[
'aliases'
])
||
!
is_array
(
$host
[
'aliases'
][
'item'
]))
if
(
!
is
set
(
$host
[
'aliases'
])
||
!
is_array
(
$host
[
'aliases'
])
||
!
is_array
(
$host
[
'aliases'
][
'item'
]))
{
continue
;
}
foreach
(
$host
[
'aliases'
][
'item'
]
as
$alias
)
{
if
(
$alias
[
'host'
])
$lhosts
.=
"
{
$host
[
'ip'
]
}
{
$alias
[
'host'
]
}
.
{
$alias
[
'domain'
]
}
{
$alias
[
'host'
]
}
\n
"
;
...
...
src/etc/inc/upgrade_config.inc
View file @
92dbe83e
...
...
@@ -3328,15 +3328,18 @@ function upgrade_108_to_109() {
}
}
function
upgrade_109_to_110
()
{
function
upgrade_109_to_110
()
{
global
$config
;
if
(
!
is
_array
(
$config
[
'ipsec'
])
||
!
is_array
(
$config
[
'ipsec'
][
'phase2'
]))
if
(
!
is
set
(
$config
[
'ipsec'
][
'phase2'
]))
{
return
;
}
foreach
(
$config
[
'ipsec'
][
'phase2'
]
as
&
$rule
)
{
if
(
!
empty
(
$rule
[
'uniqid'
]))
if
(
!
empty
(
$rule
[
'uniqid'
]))
{
continue
;
}
$rule
[
'uniqid'
]
=
uniqid
();
}
...
...
src/etc/rc.filter_synchronize
View file @
92dbe83e
...
...
@@ -159,7 +159,7 @@ function carp_sync_xml($url, $username, $password, $sections, $method = 'opnsens
unset
(
$config_copy
[
'filter'
][
'rule'
][
$x
]);
}
}
if
(
is_array
(
$config_copy
[
'aliases'
])
&&
is_array
(
$config_copy
[
'aliases'
][
'alias'
]))
{
if
(
is
set
(
$config_copy
[
'aliases'
])
&&
is
_array
(
$config_copy
[
'aliases'
])
&&
is_array
(
$config_copy
[
'aliases'
][
'alias'
]))
{
$aliascnt
=
count
(
$config_copy
[
'aliases'
][
'alias'
]);
for
(
$x
=
0
;
$x
<
$aliascnt
;
$x
++
)
{
$config_copy
[
'aliases'
][
'alias'
][
$x
][
'descr'
]
=
remove_special_characters
(
$config_copy
[
'aliases'
][
'alias'
][
$x
][
'descr'
]);
...
...
@@ -175,7 +175,7 @@ function carp_sync_xml($url, $username, $password, $sections, $method = 'opnsens
unset
(
$config_copy
[
'dnsmasq'
][
'hosts'
][
$x
]);
}
}
if
(
is_array
(
$config_copy
[
'ipsec'
])
&&
is_array
(
$config_copy
[
'ipsec'
][
'tunnel'
]))
{
if
(
is
set
(
$config_copy
[
'ipsec'
])
&&
is
_array
(
$config_copy
[
'ipsec'
])
&&
is_array
(
$config_copy
[
'ipsec'
][
'tunnel'
]))
{
$ipseccnt
=
count
(
$config_copy
[
'ipsec'
][
'tunnel'
]);
for
(
$x
=
0
;
$x
<
$ipseccnt
;
$x
++
)
{
$config_copy
[
'ipsec'
][
'tunnel'
][
$x
][
'descr'
]
=
remove_special_characters
(
$config_copy
[
'ipsec'
][
'tunnel'
][
$x
][
'descr'
]);
...
...
@@ -285,8 +285,9 @@ if (is_array($config['hasync'])) {
$sections
[]
=
'nat'
;
}
if
(
isset
(
$hasync
[
'synchronizealiases'
]))
{
if
(
!
is
_array
(
$config
[
'aliases'
]))
if
(
!
is
set
(
$config
[
'aliases'
])
||
!
is_array
(
$config
[
'aliases'
]))
{
$config
[
'aliases'
]
=
array
();
}
$sections
[]
=
'aliases'
;
}
if
(
isset
(
$hasync
[
'synchronizedhcpd'
])
&&
is_array
(
$config
[
'dhcpd'
]))
...
...
@@ -317,8 +318,9 @@ if (is_array($config['hasync'])) {
$sections
[]
=
'load_balancer'
;
}
if
(
isset
(
$hasync
[
'synchronizeipsec'
]))
{
if
(
!
is
_array
(
$config
[
'ipsec'
]))
if
(
!
is
set
(
$config
[
'ipsec'
])
||
!
is_array
(
$config
[
'ipsec'
]))
{
$config
[
'ipsec'
]
=
array
();
}
$sections
[]
=
'ipsec'
;
}
if
(
isset
(
$hasync
[
'synchronizeopenvpn'
]))
{
...
...
src/www/diag_ipsec.php
View file @
92dbe83e
...
...
@@ -50,11 +50,11 @@ function ipsec_fixup_network($network) {
return
$result
;
}
if
(
!
is_array
(
$config
[
'ipsec'
]))
{
if
(
!
is
set
(
$config
[
'ipsec'
])
||
!
is
_array
(
$config
[
'ipsec'
]))
{
$config
[
'ipsec'
]
=
array
();
}
if
(
!
is
_array
(
$config
[
'ipsec'
][
'phase1'
]))
{
if
(
!
is
set
(
$config
[
'ipsec'
][
'phase1'
]))
{
$config
[
'ipsec'
][
'phase1'
]
=
array
();
}
...
...
src/www/diag_logs_filter.php
View file @
92dbe83e
...
...
@@ -129,16 +129,22 @@ function easyrule_block_rule_create($int = 'wan', $ipproto = "inet") {
return
true
;
}
function
easyrule_block_alias_getid
(
$int
=
'wan'
)
{
function
easyrule_block_alias_getid
(
$int
=
'wan'
)
{
global
$config
;
$blockaliasname
=
'EasyRuleBlockHosts'
;
if
(
!
is_array
(
$config
[
'aliases'
]))
if
(
!
isset
(
$config
[
'aliases'
])
||
!
is_array
(
$config
[
'aliases'
]))
{
return
false
;
}
/* Hunt down an alias with the name we want, return its id */
foreach
(
$config
[
'aliases'
][
'alias'
]
as
$aliasid
=>
$alias
)
if
(
$alias
[
'name'
]
==
$blockaliasname
.
strtoupper
(
$int
))
foreach
(
$config
[
'aliases'
][
'alias'
]
as
$aliasid
=>
$alias
)
{
if
(
$alias
[
'name'
]
==
$blockaliasname
.
strtoupper
(
$int
))
{
return
$aliasid
;
}
}
return
false
;
}
...
...
@@ -152,10 +158,10 @@ function easyrule_block_alias_add($host, $int = 'wan') {
return
false
;
/* If there are no aliases, start an array */
if
(
!
is_array
(
$config
[
'aliases'
]))
{
if
(
!
is
set
(
$config
[
'aliases'
])
||
!
is
_array
(
$config
[
'aliases'
]))
{
$config
[
'aliases'
]
=
array
();
}
if
(
!
is
_array
(
$config
[
'aliases'
][
'alias'
]))
{
if
(
!
is
set
(
$config
[
'aliases'
][
'alias'
]))
{
$config
[
'aliases'
][
'alias'
]
=
array
();
}
$a_aliases
=
&
$config
[
'aliases'
][
'alias'
];
...
...
src/www/firewall_aliases.php
View file @
92dbe83e
...
...
@@ -31,7 +31,7 @@
require_once
(
"guiconfig.inc"
);
require_once
(
"filter.inc"
);
if
(
!
isset
(
$config
[
'aliases'
]))
{
if
(
!
isset
(
$config
[
'aliases'
])
||
!
is_array
(
$config
[
'aliases'
])
)
{
$config
[
'aliases'
]
=
array
();
}
if
(
!
isset
(
$config
[
'aliases'
][
'alias'
]))
{
...
...
src/www/firewall_aliases_edit.php
View file @
92dbe83e
...
...
@@ -66,10 +66,10 @@ if (is_array($config['load_balancer']['lbpool']))
$reserved_ifs
=
get_configured_interface_list
(
false
,
true
);
$reserved_keywords
=
array_merge
(
$reserved_keywords
,
$reserved_ifs
,
$reserved_table_names
);
if
(
!
is_array
(
$config
[
'aliases'
]))
{
if
(
!
is
set
(
$config
[
'aliases'
])
||
!
is
_array
(
$config
[
'aliases'
]))
{
$config
[
'aliases'
]
=
array
();
}
if
(
!
is
_array
(
$config
[
'aliases'
][
'alias'
]))
{
if
(
!
is
set
(
$config
[
'aliases'
][
'alias'
]))
{
$config
[
'aliases'
][
'alias'
]
=
array
();
}
$a_aliases
=
&
$config
[
'aliases'
][
'alias'
];
...
...
src/www/firewall_aliases_import.php
View file @
92dbe83e
...
...
@@ -44,10 +44,10 @@ if (is_array($config['load_balancer']['lbpool']))
$reserved_ifs
=
get_configured_interface_list
(
false
,
true
);
$reserved_keywords
=
array_merge
(
$reserved_keywords
,
$reserved_ifs
,
$reserved_table_names
);
if
(
!
is_array
(
$config
[
'aliases'
]))
{
if
(
!
is
set
(
$config
[
'aliases'
])
||
!
is
_array
(
$config
[
'aliases'
]))
{
$config
[
'aliases'
]
=
array
();
}
if
(
!
is
_array
(
$config
[
'aliases'
][
'alias'
]))
{
if
(
!
is
set
(
$config
[
'aliases'
][
'alias'
]))
{
$config
[
'aliases'
][
'alias'
]
=
array
();
}
$a_aliases
=
&
$config
[
'aliases'
][
'alias'
];
...
...
src/www/firewall_nat_out_edit.php
View file @
92dbe83e
...
...
@@ -41,10 +41,10 @@ if (!is_array($config['nat']['outbound']['rule'])) {
$a_out
=
&
$config
[
'nat'
][
'outbound'
][
'rule'
];
if
(
!
is_array
(
$config
[
'aliases'
]))
{
if
(
isset
(
$config
[
'aliases'
])
||
!
is_array
(
$config
[
'aliases'
]))
{
$config
[
'aliases'
]
=
array
();
}
if
(
!
is
_array
(
$config
[
'aliases'
][
'alias'
]))
{
if
(
!
is
set
(
$config
[
'aliases'
][
'alias'
]))
{
$config
[
'aliases'
][
'alias'
]
=
array
();
}
$a_aliases
=
&
$config
[
'aliases'
][
'alias'
];
...
...
src/www/vpn_ipsec.php
View file @
92dbe83e
...
...
@@ -33,7 +33,7 @@ require_once("services.inc");
require_once
(
"pfsense-utils.inc"
);
require_once
(
"interfaces.inc"
);
if
(
!
isset
(
$config
[
'ipsec'
]))
{
if
(
!
isset
(
$config
[
'ipsec'
])
||
!
is_array
(
$config
[
'ipsec'
])
)
{
$config
[
'ipsec'
]
=
array
();
}
if
(
!
isset
(
$config
[
'ipsec'
][
'phase1'
]))
{
...
...
src/www/vpn_ipsec_keys.php
View file @
92dbe83e
...
...
@@ -33,7 +33,7 @@ require_once("services.inc");
require_once
(
"pfsense-utils.inc"
);
require_once
(
"interfaces.inc"
);
if
(
!
is_array
(
$config
[
'ipsec'
]))
{
if
(
!
is
set
(
$config
[
'ipsec'
])
||
!
is
_array
(
$config
[
'ipsec'
]))
{
$config
[
'ipsec'
]
=
array
();
}
...
...
src/www/vpn_ipsec_keys_edit.php
View file @
92dbe83e
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
...
...
@@ -31,14 +32,14 @@ require_once("guiconfig.inc");
require_once
(
"vpn.inc"
);
require_once
(
"services.inc"
);
if
(
!
isset
(
$config
[
'ipsec'
]))
{
if
(
!
isset
(
$config
[
'ipsec'
])
||
!
is_array
(
$config
[
'ipsec'
])
)
{
$config
[
'ipsec'
]
=
array
();
}
if
(
!
isset
(
$config
[
'ipsec'
][
'mobilekey'
]))
{
$config
[
'ipsec'
][
'mobilekey'
]
=
array
();
}
else
{
ipsec_mobilekey_sort
();
ipsec_mobilekey_sort
();
}
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'GET'
)
{
...
...
src/www/vpn_ipsec_mobile.php
View file @
92dbe83e
...
...
@@ -34,7 +34,7 @@ require_once("vpn.inc");
require_once
(
"services.inc"
);
require_once
(
"pfsense-utils.inc"
);
if
(
!
isset
(
$config
[
'ipsec'
]))
{
if
(
!
isset
(
$config
[
'ipsec'
])
||
!
is_array
(
$config
[
'ipsec'
])
)
{
$config
[
'ipsec'
]
=
array
();
}
...
...
src/www/vpn_ipsec_phase1.php
View file @
92dbe83e
...
...
@@ -59,7 +59,7 @@ function ipsec_ikeid_next() {
}
if
(
!
isset
(
$config
[
'ipsec'
]))
{
if
(
!
isset
(
$config
[
'ipsec'
])
||
!
is_array
(
$config
[
'ipsec'
])
)
{
$config
[
'ipsec'
]
=
array
();
}
...
...
src/www/vpn_ipsec_phase2.php
View file @
92dbe83e
...
...
@@ -133,20 +133,18 @@ function getIndexByUniqueId($uniqid) {
return
$p2index
;
}
if
(
!
is_array
(
$config
[
'ipsec'
]))
{
$config
[
'ipsec'
]
=
array
();
if
(
!
isset
(
$config
[
'ipsec'
])
||
!
is_array
(
$config
[
'ipsec'
]))
{
$config
[
'ipsec'
]
=
array
();
}
if
(
!
is
_array
(
$config
[
'ipsec'
][
'client'
]))
{
if
(
!
is
set
(
$config
[
'ipsec'
][
'client'
]))
{
$config
[
'ipsec'
][
'client'
]
=
array
();
}
if
(
!
is
_array
(
$config
[
'ipsec'
][
'phase2'
]))
{
if
(
!
is
set
(
$config
[
'ipsec'
][
'phase2'
]))
{
$config
[
'ipsec'
][
'phase2'
]
=
array
();
}
if
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'GET'
)
{
// lookup p2index
if
(
!
empty
(
$_GET
[
'dup'
]))
{
...
...
src/www/vpn_ipsec_settings.php
View file @
92dbe83e
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2014 Electric Sheep Fencing, LLC
...
...
@@ -33,7 +34,7 @@ require_once("services.inc");
require_once
(
"pfsense-utils.inc"
);
require_once
(
"interfaces.inc"
);
if
(
!
isset
(
$config
[
'ipsec'
]))
{
if
(
!
isset
(
$config
[
'ipsec'
])
||
!
is_array
(
$config
[
'ipsec'
])
)
{
$config
[
'ipsec'
]
=
array
();
}
...
...
@@ -65,7 +66,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
elseif
(
isset
(
$config
[
'ipsec'
][
'preferoldsa'
]))
{
unset
(
$config
[
'ipsec'
][
'preferoldsa'
]);
}
if
(
is_array
(
$config
[
'ipsec'
]))
{
if
(
is
set
(
$config
[
'ipsec'
])
&&
is
_array
(
$config
[
'ipsec'
]))
{
foreach
(
$ipsec_loglevels
as
$lkey
=>
$ldescr
)
{
if
(
empty
(
$_POST
[
"ipsec_
{
$lkey
}
"
]))
{
if
(
isset
(
$config
[
'ipsec'
][
"ipsec_
{
$lkey
}
"
]))
{
...
...
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