OPNsense Forum

International Forums => German - Deutsch => Topic started by: Reiter der OPNsense on September 04, 2017, 04:09:31 pm

Title: Google SafeSearch & Co.
Post by: Reiter der OPNsense on September 04, 2017, 04:09:31 pm
Hallo allerseits

Ich wollte auf meiner OPNSense zu Hause mal kurz (ha, ha) Google SafeSearch & Co. wegen den Kidz in Betrieb nehmen.

Zuerst dachte ich, mach erst mal auf die Schnelle was mit Unbound so im Stil von:
https://support.opendns.com/hc/en-us/articles/227986807-How-to-Enforcing-Google-SafeSearch-YouTube-and-Bing
https://forum.opnsense.org/index.php?topic=3423.msg11265#msg11265
http://www.iamasuperuser.com/enforce-google-safe-search-using-pfsense/

Sobald ich aber via GUI --> Unbound DNS --> General --> Custom options --> include: /var/unbound/safesearch.conf z. B. zum Testen nur diese eine Zeile local-data: "www.google.ch A 216.239.38.120" hinzufüge, lässt sich anschliessend Unbound nicht mehr starten.

Via GUI --> Host overrides hat es glaub ich geklappt, aber gemäss den diversen Anleitungen müsste man ja für alle möglichen Google-Domains (https://www.google.com/supported_domains) einen Eintrag erstellen.

Fragen:
Gruss, Stefan
Title: Re: Google SafeSearch & Co.
Post by: JeGr on September 04, 2017, 04:19:01 pm
Kann es sein, dass du nicht alles in die Custom Options Box eingetragen hast? Da steht bspw. nicht nur "include:" sondern vorher noch ein "server:" und in der nächsten Zeile erst das Include. Unbound ist wie jeder Dienst sehr herrisch, was sein Config-File-Format angeht. Ansonsten kannst du auch unbound mal auf der Kommandozeile via SSH starten und den Fehler anschauen (oder im Log nachsehen, was unbound beim Starten nicht gefällt).
Title: Re: Google SafeSearch & Co.
Post by: Reiter der OPNsense on September 04, 2017, 06:16:37 pm
Quote
Da steht bspw. nicht nur "include:" sondern vorher noch ein "server:" und in der nächsten Zeile erst das Include.
Braucht es das server: wirklich?

Die resultierende unbound.conf (gekürzt) sieht so aus:
Code: [Select]
##########################
# Unbound Configuration
##########################

##
# Server configuration
##
server:
chroot: /var/unbound
username: unbound
directory: /var/unbound
pidfile: /var/run/unbound.pid

[...]

# Access lists
include: /var/unbound/access_lists.conf

# Static host entries
include: /var/unbound/host_entries.conf

# DHCP leases (if configured)
include: /var/unbound/dhcpleases.conf

# Domain overrides
include: /var/unbound/domainoverrides.conf

# Unbound custom options
include: /var/unbound/safesearch.conf               <------ Ergebnis

###
# Remote Control Config
###
include: /var/unbound/remotecontrol.conf

Habe folgenden Eintrag im system.log gefunden:
Code: [Select]
Sep  4 17:30:53 OPNsense opnsense: /services_unbound.php: The command '/usr/local/sbin/unbound -c '/var/unbound/unbound.conf'' returned exit code '1', the output was '/var/unbound/unbound.conf:107: error: cannot open include file '/var/unbound/safesearch.conf': No such file or directory read /var/unbound/unbound.conf failed: 1 errors in configuration file [1504539053] unbound[10313:0] fatal error: Could not read config file: /var/unbound/unbound.conf'
Die Datei ist aber vorhanden. Habe dann die Rechte der Datei auf unbound:unbound gesetzt (statt root). Jetzt kommt:
Code: [Select]
Sep  4 17:36:36 OPNsense opnsense: /status_services.php: The command '/usr/local/sbin/unbound -c '/var/unbound/unbound.conf'' returned exit code '1', the output was '/var/unbound/safesearch.conf:1: error: syntax error read /var/unbound/unbound.conf failed: 1 errors in configuration file [1504539396] unbound[49435:0] fatal error: Could not read config file: /var/unbound/unbound.conf'
Für mich nur Bahnhof.
Gib es irgendwo noch andere Logs?
Title: Re: Google SafeSearch & Co.
Post by: JeGr on September 05, 2017, 01:42:57 pm
Warum Bahnhof? Steht doch genau da, was sein Problem ist:

/var/unbound/safesearch.conf:1

Zeile 1 in safesearch.conf.

Zuerst war wie du richtig gelernt hast, die Dateirechte falsch und er konnte das File nicht öffnen. Jetzt kann er es laden, aber es hat Syntaxfehler, also mal in deine safesearch.conf reinschauen, ob da was falsches drinsteht.
Title: Re: Google SafeSearch & Co.
Post by: Reiter der OPNsense on September 06, 2017, 05:17:01 pm
Ich bin ein wenig weiter gekommen: Wenn "local-data:"-Einträge innerhalb der unbound.conf nach
Code: [Select]
# Domain overrides
include: /var/unbound/domainoverrides.conf
stehen, dann startet der Dienst nicht.

Man müsste also die custom options mindestens vor den domain overrides einfügen. Aber vielleicht würde dann ja etwas anderes nicht funktionieren? Die Reihenfolge scheint heikel zu sein, siehe z. B. auch hier:
https://forum.opnsense.org/index.php?topic=1848.msg5847#msg5847