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
70d95fbc
Commit
70d95fbc
authored
Mar 30, 2016
by
Ad Schellevis
Committed by
Franco Fichtner
Apr 01, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(unbound_dhcpd) style fixes
(cherry picked from commit
483980c6
)
parent
4d8cfa7f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
unbound_dhcpd.py
src/opnsense/scripts/dns/unbound_dhcpd.py
+11
-6
No files found.
src/opnsense/scripts/dns/unbound_dhcpd.py
View file @
70d95fbc
...
...
@@ -30,6 +30,7 @@
"""
import
os
import
sys
sys
.
path
.
insert
(
0
,
"/usr/local/opnsense/site-python"
)
import
subprocess
import
time
...
...
@@ -38,6 +39,7 @@ from daemonize import Daemonize
import
watchers.dhcpd
import
params
def
unbound_control
(
commands
,
output_stream
=
None
):
""" execute (chrooted) unbound-control command
:param commands: command list (parameters)
...
...
@@ -45,8 +47,8 @@ def unbound_control(commands, output_stream=None):
:return: None
"""
output_stream
=
open
(
os
.
devnull
,
'w'
)
subprocess
.
check_call
([
'/usr/sbin/chroot'
,
'-u'
,
'unbound'
,
'-g'
,
'unbound'
,
'/'
,
'/usr/local/sbin/unbound-control'
,
'-c'
,
'/var/unbound/unbound.conf'
]
+
commands
,
subprocess
.
check_call
([
'/usr/sbin/chroot'
,
'-u'
,
'unbound'
,
'-g'
,
'unbound'
,
'/'
,
'/usr/local/sbin/unbound-control'
,
'-c'
,
'/var/unbound/unbound.conf'
]
+
commands
,
stdout
=
output_stream
,
stderr
=
subprocess
.
STDOUT
)
output_stream
.
seek
(
0
)
...
...
@@ -64,13 +66,15 @@ def unbound_known_addresses():
result
.
append
(
parts
[
4
])
return
result
# parse input params
app_params
=
{
'pid'
:
'/var/run/unbound_dhcpd.pid'
,
app_params
=
{
'pid'
:
'/var/run/unbound_dhcpd.pid'
,
'domain'
:
'local'
,
'target'
:
'/var/unbound/dhcpleases.conf'
,
'background'
:
'1'
}
'background'
:
'1'
}
params
.
update_params
(
app_params
)
def
main
():
# cleanup interval (seconds)
cleanup_interval
=
60
...
...
@@ -118,6 +122,7 @@ def main():
# wait for next cycle
time
.
sleep
(
1
)
# startup
if
app_params
[
'background'
]
==
'1'
:
daemon
=
Daemonize
(
app
=
"unbound_dhcpd"
,
pid
=
app_params
[
'pid'
],
action
=
main
)
...
...
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