diff mbox

[OpenWrt-Devel] base-files: sysfixtime exclude dnsmasq.time

Message ID 1442912718-6840-1-git-send-email-kevin@darbyshire-bryant.me.uk
State Superseded
Headers show

Commit Message

Kevin Darbyshire-Bryant Sept. 22, 2015, 9:05 a.m. UTC
dnsmasq maintains dnsmasq.time across reboots and uses it as a means of
determining if current time is good enough to validate dnssec time
stamps.  By including /etc/dnsmasq.time as a time source for sysfixtime,
the mechanism was effectively defeated because time was set to the last
time that dnsmasq considered current even though that time is in
the past.  Since that time is out of date, dns(sec) resolution would
fail thus defeating any ntp based mechanisms for setting the clock
correctly.

In theory the process is defeated by any files in /etc that are newer
than /etc/dnsmasq.time however dnsmasq now updates the file's timestamp
on process TERM so hopefully /etc/dnsmasq.time is the latest file
timestamp in /etc as part of openWrt shutdown/reboot.

Either way, including /etc/dnsmasq.time as a time source for sysfixtime
is not helpful.

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
---
 package/base-files/files/etc/init.d/sysfixtime | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bastian Bittorf Sept. 22, 2015, 5:34 p.m. UTC | #1
* Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk> [22.09.2015 11:06]:
> Either way, including /etc/dnsmasq.time as a time source for sysfixtime
> is not helpful.

please drop this patch, i will send a V2 which is faster - thanks Kevin for V1

bye, bastian
Kevin Darbyshire-Bryant Sept. 22, 2015, 6:33 p.m. UTC | #2
Patch dropped. Thanks for picking it up & improving. 

Kevin

--
Cheers,

Kevin@Darbyshire-Bryant.me.uk

Sent from my phone, apologies for brevity, spelling & top posting

> On 22 Sep 2015, at 18:41, Bastian Bittorf <bittorf@bluebottle.com> wrote:
> 
> * Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk> [22.09.2015 11:06]:
>> Either way, including /etc/dnsmasq.time as a time source for sysfixtime
>> is not helpful.
> 
> please drop this patch, i will send a V2 which is faster - thanks Kevin for V1
> 
> bye, bastian
diff mbox

Patch

diff --git a/package/base-files/files/etc/init.d/sysfixtime b/package/base-files/files/etc/init.d/sysfixtime
index 4010e06..218ef20 100755
--- a/package/base-files/files/etc/init.d/sysfixtime
+++ b/package/base-files/files/etc/init.d/sysfixtime
@@ -5,7 +5,7 @@  START=00
 
 boot() {
 	local curtime="$(date +%s)"
-	local maxtime="$(find /etc -type f -exec date -r {} +%s \; | sort -nr | head -n1)"
+	local maxtime="$(find /etc -type f -path /etc/dnsmasq.time -prune -o -exec date -r {} +%s \; | sort -nr | head -n1)"
 	[ $curtime -lt $maxtime ] && date -s @$maxtime
 }