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
bbb0d208
Commit
bbb0d208
authored
Apr 12, 2017
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dhcp: do previous for dhcpd_chroot_path
parent
8c31aa3c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
34 deletions
+26
-34
services.inc
src/etc/inc/services.inc
+22
-29
system.inc
src/etc/inc/system.inc
+2
-2
rc.initial.setports
src/etc/rc.initial.setports
+2
-2
firmware-product
src/opnsense/firmware-product
+0
-1
No files found.
src/etc/inc/services.inc
View file @
bbb0d208
...
@@ -322,33 +322,27 @@ function services_radvd_configure($blacklist = array())
...
@@ -322,33 +322,27 @@ function services_radvd_configure($blacklist = array())
function
services_dhcpd_leasesfile
()
function
services_dhcpd_leasesfile
()
{
{
global
$g
;
return
'/var/dhcpd/var/db/dhcpd.leases'
;
return
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
;
}
}
function
services_dhcpdv6_leasesfile
()
function
services_dhcpdv6_leasesfile
()
{
{
global
$g
;
return
'/var/dhcpd/var/db/dhcpd6.leases'
;
return
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd6.leases"
;
}
}
function
services_dhcpd_configure
(
$family
=
'all'
,
$blacklist
=
array
(),
$verbose
=
false
)
function
services_dhcpd_configure
(
$family
=
'all'
,
$blacklist
=
array
(),
$verbose
=
false
)
{
{
global
$g
;
$dirs
=
array
(
'/dev'
,
'/etc'
,
'/lib'
,
'/run'
,
'/usr'
,
'/usr/local/sbin'
,
'/var/db'
,
'/var/run'
);
$dirs
=
array
(
'/dev'
,
'/etc'
,
'/lib'
,
'/run'
,
'/usr'
,
'/usr/local/sbin'
,
'/var/db'
,
'/var/run'
);
foreach
(
$dirs
as
$dir
)
{
foreach
(
$dirs
as
$dir
)
{
mwexecf
(
'/bin/mkdir -p %s'
,
"
{
$g
[
'dhcpd_chroot_path'
]
}
{
$dir
}
"
);
mwexecf
(
'/bin/mkdir -p %s'
,
"
/var/dhcpd
{
$dir
}
"
);
}
}
if
(
mwexecf
(
'/sbin/mount -uw %s'
,
"
{
$g
[
'dhcpd_chroot_path'
]
}
/dev"
,
true
))
{
if
(
mwexecf
(
'/sbin/mount -uw %s'
,
'/var/dhcpd/dev'
,
true
))
{
mwexecf
(
'/sbin/mount -t devfs devfs %s'
,
"
{
$g
[
'dhcpd_chroot_path'
]
}
/dev"
);
mwexecf
(
'/sbin/mount -t devfs devfs %s'
,
'/var/dhcpd/dev'
);
}
}
mwexecf
(
'/usr/sbin/chown -R dhcpd:dhcpd %s'
,
$g
[
'dhcpd_chroot_path'
]
);
mwexecf
(
'/usr/sbin/chown -R dhcpd:dhcpd %s'
,
'/var/dhcpd'
);
if
(
$family
==
'all'
||
$family
==
'inet'
)
{
if
(
$family
==
'all'
||
$family
==
'inet'
)
{
services_dhcpdv4_configure
(
$verbose
);
services_dhcpdv4_configure
(
$verbose
);
...
@@ -379,12 +373,12 @@ function is_dhcpv4_server_enabled()
...
@@ -379,12 +373,12 @@ function is_dhcpv4_server_enabled()
function
services_dhcpdv4_configure
(
$verbose
=
false
)
function
services_dhcpdv4_configure
(
$verbose
=
false
)
{
{
global
$config
,
$g
;
global
$config
;
$need_ddns_updates
=
false
;
$need_ddns_updates
=
false
;
$ddns_zones
=
array
();
$ddns_zones
=
array
();
killbypid
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run/dhcpd.pid"
,
'TERM'
,
true
);
killbypid
(
'/var/dhcpd/var/run/dhcpd.pid'
,
'TERM'
,
true
);
if
(
!
is_dhcpv4_server_enabled
())
{
if
(
!
is_dhcpv4_server_enabled
())
{
return
;
return
;
...
@@ -914,13 +908,13 @@ EOD;
...
@@ -914,13 +908,13 @@ EOD;
$dhcpdconf
.=
services_dhcpd_zones
(
$ddns_zones
);
$dhcpdconf
.=
services_dhcpd_zones
(
$ddns_zones
);
}
}
@
file_put_contents
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/etc/dhcpd.conf"
,
$dhcpdconf
);
@
file_put_contents
(
'/var/dhcpd/etc/dhcpd.conf'
,
$dhcpdconf
);
@
touch
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd.leases"
);
@
touch
(
'/var/dhcpd/var/db/dhcpd.leases'
);
@
unlink
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run/dhcpd.pid"
);
@
unlink
(
'/var/dhcpd/var/run/dhcpd.pid'
);
/* fire up dhcpd in a chroot */
/* fire up dhcpd in a chroot */
if
(
count
(
$dhcpdifs
)
>
0
)
{
if
(
count
(
$dhcpdifs
)
>
0
)
{
mwexec
(
"/usr/local/sbin/dhcpd -user dhcpd -group dhcpd -chroot
{
$g
[
'dhcpd_chroot_path'
]
}
-cf /etc/dhcpd.conf -pf /var/run/dhcpd.pid "
.
join
(
" "
,
$dhcpdifs
));
mwexec
(
'/usr/local/sbin/dhcpd -user dhcpd -group dhcpd -chroot /var/dhcpd -cf /etc/dhcpd.conf -pf /var/run/dhcpd.pid '
.
join
(
' '
,
$dhcpdifs
));
}
}
if
(
$verbose
)
{
if
(
$verbose
)
{
...
@@ -1011,9 +1005,9 @@ function is_dhcpv6_server_enabled()
...
@@ -1011,9 +1005,9 @@ function is_dhcpv6_server_enabled()
function
services_dhcpdv6_configure
(
$blacklist
=
array
(),
$verbose
=
false
)
function
services_dhcpdv6_configure
(
$blacklist
=
array
(),
$verbose
=
false
)
{
{
global
$config
,
$g
;
global
$config
;
killbypid
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run/dhcpdv6.pid"
,
'TERM'
,
true
);
killbypid
(
'/var/dhcpd/var/run/dhcpdv6.pid'
,
'TERM'
,
true
);
killbypid
(
'/var/run/dhcpleases6.pid'
,
'TERM'
,
true
);
killbypid
(
'/var/run/dhcpleases6.pid'
,
'TERM'
,
true
);
if
(
!
is_dhcpv6_server_enabled
())
{
if
(
!
is_dhcpv6_server_enabled
())
{
...
@@ -1302,15 +1296,14 @@ EOD;
...
@@ -1302,15 +1296,14 @@ EOD;
$dhcpdv6conf
.=
"
\n
ddns-update-style none;
\n
"
;
$dhcpdv6conf
.=
"
\n
ddns-update-style none;
\n
"
;
}
}
@
file_put_contents
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/etc/dhcpdv6.conf"
,
$dhcpdv6conf
);
@
file_put_contents
(
'/var/dhcpd/etc/dhcpdv6.conf'
,
$dhcpdv6conf
);
@
touch
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd6.leases"
);
@
touch
(
'/var/dhcpd/var/db/dhcpd6.leases'
);
@
unlink
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run/dhcpdv6.pid"
);
@
unlink
(
'/var/dhcpd/var/run/dhcpdv6.pid'
);
/* fire up dhcpd in a chroot */
/* fire up dhcpd in a chroot */
if
(
count
(
$dhcpdv6ifs
)
>
0
)
{
if
(
count
(
$dhcpdv6ifs
)
>
0
)
{
mwexec
(
"/usr/local/sbin/dhcpd -6 -user dhcpd -group dhcpd -chroot
{
$g
[
'dhcpd_chroot_path'
]
}
-cf /etc/dhcpdv6.conf -pf /var/run/dhcpdv6.pid "
.
mwexec
(
'/usr/local/sbin/dhcpd -6 -user dhcpd -group dhcpd -chroot /var/dhcpd -cf /etc/dhcpdv6.conf -pf /var/run/dhcpdv6.pid '
.
join
(
' '
,
$dhcpdv6ifs
));
join
(
" "
,
$dhcpdv6ifs
));
mwexec
(
'/usr/local/sbin/dhcpleases6 -c "/usr/local/bin/php -f /usr/local/sbin/prefixes.php|/bin/sh" -l /var/dhcpd/var/db/dhcpd6.leases'
);
mwexec
(
"/usr/local/sbin/dhcpleases6 -c
\"
/usr/local/bin/php -f /usr/local/sbin/prefixes.php|/bin/sh
\"
-l
{
$g
[
'dhcpd_chroot_path'
]
}
/var/db/dhcpd6.leases"
);
}
}
if
(
$verbose
)
{
if
(
$verbose
)
{
...
@@ -1607,7 +1600,7 @@ function is_apinger_enabled()
...
@@ -1607,7 +1600,7 @@ function is_apinger_enabled()
function
services_get
()
function
services_get
()
{
{
global
$config
,
$g
;
global
$config
;
$services
=
array
();
$services
=
array
();
...
@@ -1647,7 +1640,7 @@ function services_get()
...
@@ -1647,7 +1640,7 @@ function services_get()
$pconfig
[
'description'
]
=
gettext
(
"DHCP Server"
);
$pconfig
[
'description'
]
=
gettext
(
"DHCP Server"
);
$pconfig
[
'php'
][
'restart'
]
=
array
(
'services_dhcpdv4_configure'
);
$pconfig
[
'php'
][
'restart'
]
=
array
(
'services_dhcpdv4_configure'
);
$pconfig
[
'php'
][
'start'
]
=
array
(
'services_dhcpdv4_configure'
);
$pconfig
[
'php'
][
'start'
]
=
array
(
'services_dhcpdv4_configure'
);
$pconfig
[
'pidfile'
]
=
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run/dhcpd.pid"
;
$pconfig
[
'pidfile'
]
=
'/var/dhcpd/var/run/dhcpd.pid'
;
$services
[]
=
$pconfig
;
$services
[]
=
$pconfig
;
}
}
...
@@ -1657,7 +1650,7 @@ function services_get()
...
@@ -1657,7 +1650,7 @@ function services_get()
$pconfig
[
'description'
]
=
gettext
(
"DHCPv6 Server"
);
$pconfig
[
'description'
]
=
gettext
(
"DHCPv6 Server"
);
$pconfig
[
'php'
][
'restart'
]
=
array
(
'services_dhcpdv6_configure'
);
$pconfig
[
'php'
][
'restart'
]
=
array
(
'services_dhcpdv6_configure'
);
$pconfig
[
'php'
][
'start'
]
=
array
(
'services_dhcpdv6_configure'
);
$pconfig
[
'php'
][
'start'
]
=
array
(
'services_dhcpdv6_configure'
);
$pconfig
[
'pidfile'
]
=
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run/dhcpdv6.pid"
;
$pconfig
[
'pidfile'
]
=
'/var/dhcpd/var/run/dhcpdv6.pid'
;
$services
[]
=
$pconfig
;
$services
[]
=
$pconfig
;
}
}
...
...
src/etc/inc/system.inc
View file @
bbb0d208
...
@@ -729,7 +729,7 @@ function system_syslogd_extra_local($logsocket)
...
@@ -729,7 +729,7 @@ function system_syslogd_extra_local($logsocket)
function
system_syslogd_start
(
$verbose
=
false
)
function
system_syslogd_start
(
$verbose
=
false
)
{
{
global
$config
,
$g
;
global
$config
;
if
(
$verbose
)
{
if
(
$verbose
)
{
echo
'Starting syslog...'
;
echo
'Starting syslog...'
;
...
@@ -759,7 +759,7 @@ function system_syslogd_start($verbose = false)
...
@@ -759,7 +759,7 @@ function system_syslogd_start($verbose = false)
* get rid of this behaviour by wrapping this local array using
* get rid of this behaviour by wrapping this local array using
* the key as a "name" entry in the array...
* the key as a "name" entry in the array...
*/
*/
$syslogconfs
[
'dhcpd'
]
=
array
(
'facility'
=>
array
(
'dhcpd'
,
'dhcrelay'
,
'dhclient'
,
'dhcp6c'
),
'local'
=>
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run/log"
,
'remote'
=>
'dhcp'
);
$syslogconfs
[
'dhcpd'
]
=
array
(
'facility'
=>
array
(
'dhcpd'
,
'dhcrelay'
,
'dhclient'
,
'dhcp6c'
),
'local'
=>
'/var/dhcpd/var/run/log'
,
'remote'
=>
'dhcp'
);
$syslogconfs
[
'filter'
]
=
array
(
'facility'
=>
array
(
'filterlog'
),
'remote'
=>
'filter'
);
$syslogconfs
[
'filter'
]
=
array
(
'facility'
=>
array
(
'filterlog'
),
'remote'
=>
'filter'
);
$syslogconfs
[
'gateways'
]
=
array
(
'facility'
=>
array
(
'apinger'
),
'remote'
=>
'apinger'
);
$syslogconfs
[
'gateways'
]
=
array
(
'facility'
=>
array
(
'apinger'
),
'remote'
=>
'apinger'
);
$syslogconfs
[
'portalauth'
]
=
array
(
'facility'
=>
array
(
'captiveportal'
),
'remote'
=>
'portalauth'
);
$syslogconfs
[
'portalauth'
]
=
array
(
'facility'
=>
array
(
'captiveportal'
),
'remote'
=>
'portalauth'
);
...
...
src/etc/rc.initial.setports
View file @
bbb0d208
...
@@ -43,8 +43,8 @@ if (set_networking_interfaces_ports()) {
...
@@ -43,8 +43,8 @@ if (set_networking_interfaces_ports()) {
$config
=
parse_config
(
true
);
$config
=
parse_config
(
true
);
/* need to stop local dhcp servers to avoid wrong leases */
/* need to stop local dhcp servers to avoid wrong leases */
killbypid
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run/dhcpd.pid"
,
'TERM'
,
true
);
killbypid
(
'/var/dhcpd/var/run/dhcpd.pid'
,
'TERM'
,
true
);
killbypid
(
"
{
$g
[
'dhcpd_chroot_path'
]
}
/var/run/dhcpdv6.pid"
,
'TERM'
,
true
);
killbypid
(
'/var/dhcpd/var/run/dhcpdv6.pid'
,
'TERM'
,
true
);
interfaces_configure
(
true
);
interfaces_configure
(
true
);
rrd_configure
(
true
);
rrd_configure
(
true
);
...
...
src/opnsense/firmware-product
View file @
bbb0d208
{
{
"dhcpd_chroot_path": "/var/dhcpd",
"factory_shipped_password": "opnsense",
"factory_shipped_password": "opnsense",
"factory_shipped_username": "root",
"factory_shipped_username": "root",
"product_copyright_owner": "Deciso B.V.",
"product_copyright_owner": "Deciso B.V.",
...
...
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