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
09489e90
Commit
09489e90
authored
May 08, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:opnsense/core
parents
0949ac91
b71288d6
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
124 additions
and
26 deletions
+124
-26
OPNsense.conf
pkg/OPNsense.conf
+1
-1
version.sh
scripts/version.sh
+1
-1
interfaces.lib.inc
src/etc/inc/interfaces.lib.inc
+25
-1
pfsense-utils.inc
src/etc/inc/pfsense-utils.inc
+9
-9
rc.php_ini_setup
src/etc/rc.php_ini_setup
+2
-2
ACL_Legacy_Page_Map.json
...nse/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json
+1
-1
+MANIFEST
src/opnsense/service/templates/OPNsense/IPFW/+MANIFEST
+8
-0
+TARGETS
src/opnsense/service/templates/OPNsense/IPFW/+TARGETS
+1
-0
ipfw.conf
src/opnsense/service/templates/OPNsense/IPFW/ipfw.conf
+70
-0
+MANIFEST
src/opnsense/service/templates/OPNsense/Proxy/+MANIFEST
+1
-1
+MANIFEST
src/opnsense/service/templates/OPNsense/Sample/+MANIFEST
+1
-1
graph.php
src/www/graph.php
+2
-7
ifstats.php
src/www/ifstats.php
+2
-2
No files found.
pkg/OPNsense.conf
View file @
09489e90
OPNsense
: {
OPNsense
: {
fingerprints
:
"/usr/local/etc/pkg/fingerprints/OPNsense"
,
fingerprints
:
"/usr/local/etc/pkg/fingerprints/OPNsense"
,
url
:
"pkg+http://pkg.opnsense.org/${ABI}/
latest
"
,
url
:
"pkg+http://pkg.opnsense.org/${ABI}/
%%REPO_FLAVOUR%%
"
,
signature_type
:
"fingerprints"
,
signature_type
:
"fingerprints"
,
mirror_type
:
"srv"
,
mirror_type
:
"srv"
,
priority
:
11
,
priority
:
11
,
...
...
scripts/version.sh
View file @
09489e90
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
set
-e
set
-e
VERSION
=
$(
git describe
--abbrev
=
0
)
VERSION
=
$(
git describe
--abbrev
=
0
--always
)
REVISION
=
$(
git rev-list
${
VERSION
}
..
--count
)
REVISION
=
$(
git rev-list
${
VERSION
}
..
--count
)
if
[
"
${
REVISION
}
"
!=
"0"
]
;
then
if
[
"
${
REVISION
}
"
!=
"0"
]
;
then
# must construct full version string manually
# must construct full version string manually
...
...
src/etc/inc/interfaces.lib.inc
View file @
09489e90
...
@@ -111,7 +111,7 @@ function legacy_interface_deladdress($ifs, $addr)
...
@@ -111,7 +111,7 @@ function legacy_interface_deladdress($ifs, $addr)
function
legacy_interface_rename
(
$ifs
,
$name
)
function
legacy_interface_rename
(
$ifs
,
$name
)
{
{
$cmd
=
'/sbin/ifconfig '
.
escapeshellarg
(
$if
)
.
' name '
.
escapeshellarg
(
$name
);
$cmd
=
'/sbin/ifconfig '
.
escapeshellarg
(
$if
s
)
.
' name '
.
escapeshellarg
(
$name
);
exec
(
$cmd
.
' 2>&1'
,
$out
,
$ret
);
exec
(
$cmd
.
' 2>&1'
,
$out
,
$ret
);
if
(
$ret
)
{
if
(
$ret
)
{
...
@@ -148,3 +148,27 @@ function legacy_vlan_tag($ifs, $member, $tag)
...
@@ -148,3 +148,27 @@ function legacy_vlan_tag($ifs, $member, $tag)
log_error
(
'The command `'
.
$cmd
.
'\' failed to execute'
);
log_error
(
'The command `'
.
$cmd
.
'\' failed to execute'
);
}
}
}
}
function
legacy_interface_stats
(
$ifs
)
{
$cmd
=
'/usr/local/sbin/ifinfo '
.
escapeshellarg
(
$ifs
);
$stats
=
array
();
exec
(
$cmd
.
' 2>&1'
,
$out
,
$ret
);
if
(
$ret
)
{
log_error
(
'The command `'
.
$cmd
.
'\' failed to execute'
);
return
$stats
;
}
if
(
count
(
$out
))
{
/* first one is header */
array_shift
(
$out
);
foreach
(
$out
as
$line
)
{
$stat
=
explode
(
':'
,
$line
);
$stats
[
trim
(
$stat
[
0
])]
=
trim
(
$stat
[
1
]);
}
}
return
$stats
;
}
src/etc/inc/pfsense-utils.inc
View file @
09489e90
...
@@ -961,21 +961,21 @@ function get_interface_info($ifdescr)
...
@@ -961,21 +961,21 @@ function get_interface_info($ifdescr)
$chkif
=
$ifinfo
[
'if'
];
$chkif
=
$ifinfo
[
'if'
];
$ifinfotmp
=
pfSense_get_interface_addresses
(
$chkif
);
$ifinfotmp
=
pfSense_get_interface_addresses
(
$chkif
);
$ifinfo
[
'status'
]
=
$ifinfotmp
[
'status'
];
$ifinfo
[
'status'
]
=
$ifinfotmp
[
'status'
];
if
(
empty
(
$ifinfo
[
'status'
]))
if
(
empty
(
$ifinfo
[
'status'
]))
{
$ifinfo
[
'status'
]
=
"down"
;
$ifinfo
[
'status'
]
=
'down'
;
}
$ifinfo
[
'macaddr'
]
=
$ifinfotmp
[
'macaddr'
];
$ifinfo
[
'macaddr'
]
=
$ifinfotmp
[
'macaddr'
];
$ifinfo
[
'ipaddr'
]
=
$ifinfotmp
[
'ipaddr'
];
$ifinfo
[
'ipaddr'
]
=
$ifinfotmp
[
'ipaddr'
];
$ifinfo
[
'subnet'
]
=
$ifinfotmp
[
'subnet'
];
$ifinfo
[
'subnet'
]
=
$ifinfotmp
[
'subnet'
];
$ifinfo
[
'linklocal'
]
=
get_interface_linklocal
(
$ifdescr
);
$ifinfo
[
'linklocal'
]
=
get_interface_linklocal
(
$ifdescr
);
$ifinfo
[
'ipaddrv6'
]
=
get_interface_ipv6
(
$ifdescr
);
$ifinfo
[
'ipaddrv6'
]
=
get_interface_ipv6
(
$ifdescr
);
$ifinfo
[
'subnetv6'
]
=
get_interface_subnetv6
(
$ifdescr
);
$ifinfo
[
'subnetv6'
]
=
get_interface_subnetv6
(
$ifdescr
);
if
(
isset
(
$ifinfotmp
[
'link0'
]))
if
(
isset
(
$ifinfotmp
[
'link0'
]))
{
$link0
=
"down"
;
$link0
=
'down'
;
$ifinfotmp
=
pfSense_get_interface_stats
(
$chkif
);
}
// $ifinfo['inpkts'] = $ifinfotmp['inpkts'];
$ifinfotmp
=
legacy_interface_stats
(
$chkif
);
// $ifinfo['outpkts'] = $ifinfotmp['outpkts'];
$ifinfo
[
'inerrs'
]
=
$ifinfotmp
[
'input errors'
];
$ifinfo
[
'inerrs'
]
=
$ifinfotmp
[
'inerrs'
];
$ifinfo
[
'outerrs'
]
=
$ifinfotmp
[
'output errors'
];
$ifinfo
[
'outerrs'
]
=
$ifinfotmp
[
'outerrs'
];
$ifinfo
[
'collisions'
]
=
$ifinfotmp
[
'collisions'
];
$ifinfo
[
'collisions'
]
=
$ifinfotmp
[
'collisions'
];
/* Use pfctl for non wrapping 64 bit counters */
/* Use pfctl for non wrapping 64 bit counters */
...
...
src/etc/rc.php_ini_setup
View file @
09489e90
src/opnsense/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json
View file @
09489e90
src/opnsense/service/templates/OPNsense/IPFW/+MANIFEST
0 → 100644
View file @
09489e90
name: opnsense-ipfw
version: 0.1
origin: opnsense/proxy
comment: IPFW configuration
desc: configuration templates for ipfw rulesets
maintainer: ad at opnsense.org
www: https://opnsense.org
prefix: /
src/opnsense/service/templates/OPNsense/IPFW/+TARGETS
0 → 100644
View file @
09489e90
ipfw.conf:/tmp/ipfw.rules.new
src/opnsense/service/templates/OPNsense/IPFW/ipfw.conf
0 → 100644
View file @
09489e90
#======================================================================================
# flush ruleset
#======================================================================================
flush
#======================================================================================
# general purpose rules 1...1000
#======================================================================================
add
100
allow
pfsync
from
any
to
any
add
110
allow
carp
from
any
to
any
# layer 2: pass ARP
add
120
pass
layer2
mac
-
type
arp
,
rarp
# OPNsense requires for WPA
add
130
pass
layer2
mac
-
type
0
x888e
,
0
x88c7
# PPP Over Ethernet Session Stage/Discovery Stage
add
140
pass
layer2
mac
-
type
0
x8863
,
0
x8864
# layer 2: block anything else non-IP(v4/v6)
add
150
deny
layer2
not
mac
-
type
ip
,
ipv6
#======================================================================================
# Allow traffic to this hosts static ip's
#======================================================================================
{%
for
intf_key
,
interface
in
interfaces
.
iteritems
() %}
{%
if
intf_key
!=
"wan"
and
interface
.
ipaddr
!=
"dhcp"
and
interface
.
ipaddr
!=
""
%}
add
{{
loop
.
index
+
1000
}}
allow
udp
from
any
to
{{
interface
.
ipaddr
}}
dst
-
port
53
keep
-
state
add
{{
loop
.
index
+
1000
}}
allow
ip
from
any
to
{
255
.
255
.
255
.
255
or
{{
interface
.
ipaddr
}} }
in
add
{{
loop
.
index
+
1000
}}
allow
ip
from
{
255
.
255
.
255
.
255
or
{{
interface
.
ipaddr
}} }
to
any
out
add
{{
loop
.
index
+
1000
}}
allow
icmp
from
{
255
.
255
.
255
.
255
or
{{
interface
.
ipaddr
}} }
to
any
out
icmptypes
0
add
{{
loop
.
index
+
1000
}}
allow
icmp
from
any
to
{
255
.
255
.
255
.
255
or
{{
interface
.
ipaddr
}} }
in
icmptypes
8
{%
endif
%}
{%
endfor
%}
{%
if
helpers
.
exists
(
'captiveportal'
) %}
{%
for
cp_key
,
cp_item
in
captiveportal
.
iteritems
() %}
{%
for
intf_key
,
interface
in
interfaces
.
iteritems
() %}
{%
if
intf_key
==
cp_item
.
interface
and
interface
.
ipaddr
!=
'dhcp'
%}
#===================================================================================
# zone {{cp_key}} ({{cp_item.zoneid}}) configuration
#===================================================================================
{
# authenticated users ( table 1 + 2 ) #}
add
{{
3000
+
cp_item
.
zoneid
|
int
*
10
+
1
}}
skipto
{{
10001
+
cp_item
.
zoneid
|
int
*
1000
}}
ip
from
table
({{
6
*(
cp_item
.
zoneid
|
int
-
1
) +
1
}})
to
any
via
{{
interface
.
if
}}
add
{{
3000
+
cp_item
.
zoneid
|
int
*
10
+
2
}}
skipto
{{
10001
+
cp_item
.
zoneid
|
int
*
1000
}}
ip
from
table
({{
6
*(
cp_item
.
zoneid
|
int
-
1
) +
1
}})
to
any
via
{{
interface
.
if
}}
{
# authenticated hosts ( table 3 + 4 ) #}
add
{{
3000
+
cp_item
.
zoneid
|
int
*
10
+
3
}}
skipto
{{
10001
+
cp_item
.
zoneid
|
int
*
1000
}}
ip
from
table
({{
6
*(
cp_item
.
zoneid
|
int
-
1
) +
3
}})
to
any
via
{{
interface
.
if
}}
add
{{
3000
+
cp_item
.
zoneid
|
int
*
10
+
4
}}
skipto
{{
10001
+
cp_item
.
zoneid
|
int
*
1000
}}
ip
from
table
({{
6
*(
cp_item
.
zoneid
|
int
-
1
) +
3
}})
to
any
via
{{
interface
.
if
}}
{
# authenticated mac addresses ( table 5 + 6 ) #}
add
{{
3000
+
cp_item
.
zoneid
|
int
*
10
+
5
}}
skipto
{{
10001
+
cp_item
.
zoneid
|
int
*
1000
}}
ip
from
table
({{
6
*(
cp_item
.
zoneid
|
int
-
1
) +
5
}})
to
any
via
{{
interface
.
if
}}
add
{{
3000
+
cp_item
.
zoneid
|
int
*
10
+
6
}}
skipto
{{
10001
+
cp_item
.
zoneid
|
int
*
1000
}}
ip
from
table
({{
6
*(
cp_item
.
zoneid
|
int
-
1
) +
5
}})
to
any
via
{{
interface
.
if
}}
{%
endif
%}
{%
endfor
%}
{%
endfor
%}
{%
endif
%}
#======================================================================================
# setup zone accounting section
#======================================================================================
{%
if
helpers
.
exists
(
'captiveportal'
) %}
{%
for
cp_key
,
cp_item
in
captiveportal
.
iteritems
() %}
{%
for
intf_key
,
interface
in
interfaces
.
iteritems
() %}
{%
if
intf_key
==
cp_item
.
interface
and
interface
.
ipaddr
!=
'dhcp'
%}
# zone {{cp_key}} ({{cp_item.zoneid}})
add
{{ (
cp_item
.
zoneid
|
int
*
1000
) +
10001
}}
count
ip
from
any
to
any
via
{{
interface
.
if
}}
add
{{ (
cp_item
.
zoneid
|
int
*
1000
) +
10998
}}
skipto
30000
all
from
any
to
any
via
{{
interface
.
if
}}
add
{{ (
cp_item
.
zoneid
|
int
*
1000
) +
10999
}}
deny
all
from
any
to
any
not
via
{{
interface
.
if
}}
{%
endif
%}
{%
endfor
%}
{%
endfor
%}
{%
endif
%}
src/opnsense/service/templates/OPNsense/Proxy/+MANIFEST
View file @
09489e90
...
@@ -3,6 +3,6 @@ version: 0.1
...
@@ -3,6 +3,6 @@ version: 0.1
origin: opnsense/proxy
origin: opnsense/proxy
comment: Squid proxy configuration
comment: Squid proxy configuration
desc: configuration templates for squid proxy
desc: configuration templates for squid proxy
maintainer: ad
@
opnsense.org
maintainer: ad
at
opnsense.org
www: https://opnsense.org
www: https://opnsense.org
prefix: /
prefix: /
src/opnsense/service/templates/OPNsense/Sample/+MANIFEST
View file @
09489e90
...
@@ -3,6 +3,6 @@ version: 0.1
...
@@ -3,6 +3,6 @@ version: 0.1
origin: opnsense/sample
origin: opnsense/sample
comment: OPNsense configuration template example
comment: OPNsense configuration template example
desc: creates some files in /tmp/.../ based on reporting definitions found in +TARGETS
desc: creates some files in /tmp/.../ based on reporting definitions found in +TARGETS
maintainer: ad
@
opnsense.org
maintainer: ad
at
opnsense.org
www: https://opnsense.org
www: https://opnsense.org
prefix: /
prefix: /
src/www/graph.php
View file @
09489e90
<?php
<?php
/*
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2004-2006 T. Lechat <dev@lechat.org>, Manuel Kasper <mk@neon1.net>
Copyright (C) 2004-2006 T. Lechat <dev@lechat.org>, Manuel Kasper <mk@neon1.net>
...
@@ -82,12 +83,6 @@ $width=200; //SVG internal width : do not modify
...
@@ -82,12 +83,6 @@ $width=200; //SVG internal width : do not modify
$fetch_link
=
"ifstats.php?if="
.
htmlspecialchars
(
$ifnum
);
$fetch_link
=
"ifstats.php?if="
.
htmlspecialchars
(
$ifnum
);
/* check for custom theme colors */
if
(
file_exists
(
"/usr/local/www/themes/
{
$g
[
'theme'
]
}
/graph.php"
))
{
$themetxt
=
file_get_contents
(
"/usr/local/www/themes/
{
$g
[
'theme'
]
}
/graph.php"
);
eval
(
$themetxt
);
}
/********* Graph DATA **************/
/********* Graph DATA **************/
print
(
'<?xml version="1.0" ?>'
.
"
\n
"
);
?>
print
(
'<?xml version="1.0" ?>'
.
"
\n
"
);
?>
<svg
width=
"100%"
height=
"100%"
viewBox=
"0 0
<?=
$width
?>
<?=
$height
?>
"
preserveAspectRatio=
"none"
xml:space=
"preserve"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
onload=
"init(evt)"
>
<svg
width=
"100%"
height=
"100%"
viewBox=
"0 0
<?=
$width
?>
<?=
$height
?>
"
preserveAspectRatio=
"none"
xml:space=
"preserve"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
onload=
"init(evt)"
>
...
...
src/www/ifstats.php
View file @
09489e90
...
@@ -37,7 +37,7 @@ if (!$realif) {
...
@@ -37,7 +37,7 @@ if (!$realif) {
$realif
=
$if
;
// Need for IPSec case interface.
$realif
=
$if
;
// Need for IPSec case interface.
}
}
$ifinfo
=
pfSense_get
_interface_stats
(
$realif
);
$ifinfo
=
legacy
_interface_stats
(
$realif
);
$temp
=
gettimeofday
();
$temp
=
gettimeofday
();
$timing
=
(
double
)
$temp
[
"sec"
]
+
(
double
)
$temp
[
"usec"
]
/
1000000.0
;
$timing
=
(
double
)
$temp
[
"sec"
]
+
(
double
)
$temp
[
"usec"
]
/
1000000.0
;
...
@@ -48,4 +48,4 @@ header("Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
...
@@ -48,4 +48,4 @@ header("Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
header
(
"Cache-Control: post-check=0, pre-check=0"
,
FALSE
);
header
(
"Cache-Control: post-check=0, pre-check=0"
,
FALSE
);
header
(
"Pragma: no-cache"
);
// HTTP/1.0
header
(
"Pragma: no-cache"
);
// HTTP/1.0
echo
"
$timing
|"
.
$ifinfo
[
'
inbytes'
]
.
"|"
.
$ifinfo
[
'outbytes
'
]
.
"
\n
"
;
echo
"
$timing
|"
.
$ifinfo
[
'
bytes received'
]
.
"|"
.
$ifinfo
[
'bytes transmitted
'
]
.
"
\n
"
;
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