mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
dns/dnscrypt-proxy: change core DNS approach slightly
Only trigger on 0.0.0.0/:: combination. Also makes clashes with previous defaults and user input less likely. Core services are already validated as being run on 0.0.0.0/:: even when they are not so this is fine. Change the defaults as well as they make more sense (but keep the non-standard port) and make it a required setting (not sure what the default would have been).
This commit is contained in:
@@ -8,6 +8,7 @@ Plugin Changelog
|
||||
1.13
|
||||
|
||||
* Add necessary hooks to allow the plugin to be used as a standalone core DNS server
|
||||
* Changed default listening addresses to 0.0.0.0/:: for new users
|
||||
|
||||
1.12
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
|
||||
* Copyright (C) 2023 Franco Fichtner <franco@opnsense.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -51,7 +52,7 @@ function dnscryptproxy_services()
|
||||
$ports = [];
|
||||
|
||||
/*
|
||||
* DNS service is eligable for core use when both 127.0.0.1 and ::1 are set.
|
||||
* DNS service is eligable for core use when both 0.0.0.0 and :: are set.
|
||||
* In order to provide dual stack ports we need to intersect the resulting
|
||||
* ports for each address family.
|
||||
*/
|
||||
@@ -59,9 +60,9 @@ function dnscryptproxy_services()
|
||||
$localhost6 = [];
|
||||
|
||||
foreach (explode(',', (string)$model->listen_addresses) as $addrport) {
|
||||
if (preg_match('/^127\.0\.0\.1:([\d]+)$/', $addrport, $matches)) {
|
||||
if (preg_match('/^0\.0\.0\.0:([\d]+)$/', $addrport, $matches)) {
|
||||
$localhost4[$matches[1]] = 1;
|
||||
} elseif (preg_match('/^\[::1\]:([\d]+)$/', $addrport, $matches)) {
|
||||
} elseif (preg_match('/^\[::\]:([\d]+)$/', $addrport, $matches)) {
|
||||
$localhost6[$matches[1]] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
<style>tokenize</style>
|
||||
<type>select_multiple</type>
|
||||
<allownew>true</allownew>
|
||||
<help>Set the IP address and port combinations this service should listen on, e.g 127.0.0.1:5353 and/or [::1]:5353</help>
|
||||
<help>Set the IP address/port combinations this service should listen on.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.allowprivileged</id>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<model>
|
||||
<mount>//OPNsense/dnscryptproxy/general</mount>
|
||||
<description>dnscrypt-proxy configuration</description>
|
||||
<version>0.1.1</version>
|
||||
<version>0.1.2</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<listen_addresses type="CSVListField">
|
||||
<default>127.0.0.1:5353,[::1]:5353</default>
|
||||
<Required>N</Required>
|
||||
<default>0.0.0.0:5353,[::]:5353</default>
|
||||
<Required>Y</Required>
|
||||
</listen_addresses>
|
||||
<allowprivileged type="BooleanField">
|
||||
<default>0</default>
|
||||
|
||||
Reference in New Issue
Block a user