Skip to content

Commit

Permalink
unbound: add 'unbound check' target for advanced options #4327
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Jul 13, 2021
1 parent 354835a commit e8d7876
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions plist
Expand Up @@ -835,6 +835,7 @@
/usr/local/opnsense/scripts/systemhealth/logformats/syslog.py
/usr/local/opnsense/scripts/systemhealth/queryLog.py
/usr/local/opnsense/scripts/unbound/cache.sh
/usr/local/opnsense/scripts/unbound/check.sh
/usr/local/opnsense/scripts/unbound/download_blacklists.py
/usr/local/opnsense/scripts/unbound/start.sh
/usr/local/opnsense/scripts/unbound/wrapper.py
Expand Down
32 changes: 32 additions & 0 deletions src/opnsense/scripts/unbound/check.sh
@@ -0,0 +1,32 @@
#!/bin/sh

# Copyright (c) 2021 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.

set -e

cp /usr/local/etc/unbound.opnsense.d/*.conf /var/unbound/etc/
/usr/local/sbin/unbound-checkconf /var/unbound/unbound.conf 2>&1 | \
sed -e 's/^unbound-checkconf:[[:space:]]//g'
6 changes: 6 additions & 0 deletions src/opnsense/service/conf/actions.d/actions_unbound.conf
Expand Up @@ -52,6 +52,12 @@ parameters:
type:script
message:Starting Unbound

[check]
command:/usr/local/opnsense/scripts/unbound/check.sh
parameters:
type:script_output
message:Checking Unbound configuration

[dnsbl]
command:
/usr/local/opnsense/scripts/unbound/download_blacklists.py &&
Expand Down

0 comments on commit e8d7876

Please sign in to comment.