OPNsense Forum

Archive => 23.1 Legacy Series => Topic started by: ks98330q on April 27, 2023, 05:27:27 am

Title: Secure NTP
Post by: ks98330q on April 27, 2023, 05:27:27 am
Just checking to see if secure NTP can be configured on OPNSense.
If not, could it be enabled?

Title: Re: Secure NTP
Post by: CJ on April 27, 2023, 01:49:38 pm
Interesting.  I hadn't realized there was an effort to do secure NTP.

Is your concern interception between the internet and the OPNSense machine, OPNSense and your LAN clients, or your LAN clients to the internet?
Title: Re: Secure NTP
Post by: lilsense on April 27, 2023, 02:11:26 pm
you can install Chrony and use NTS.
Title: Re: Secure NTP
Post by: abulafia on April 27, 2023, 10:44:27 pm
you can install Chrony and use NTS.
Yep. Here's a list of NTS servers:
- https://gist.github.com/jauderho/2ad0d441760fc5ed69d8d4e2d6b35f8d
- https://gitlab.com/-/snippets/2481323

I use:
time.cloudflare.com,ptbtime1.ptb.de,ptbtime2.ptb.de,ptbtime3.ptb.de,ntp2.glypnod.com,nts.sth1.ntp.se,nts.sth2.ntp.se,ntp.3eck.net,ntp.trifence.ch,ntp.zeitgitter.net,nts1.adopo.net,www.jabber-germany.de,www.masters-of-cloud.de,ntppool1.time.nl,ntppool2.time.nl,ptbtime4.ptb.de,paris.time.system76.com,ntp3.fau.de
Title: Re: Secure NTP
Post by: ks98330q on April 28, 2023, 04:06:37 pm
Interesting.  I hadn't realized there was an effort to do secure NTP.

Is your concern interception between the internet and the OPNSense machine, OPNSense and your LAN clients, or your LAN clients to the internet?

Yes.  It obviously isnt well known, or most dont reallly give $.02 about it.  Anyway, NIST in the US offers an authenticated NTP service. Its free, and renews every september. 
Title: Re: Secure NTP
Post by: ks98330q on April 28, 2023, 04:07:10 pm
you can install Chrony and use NTS.
Yep. Here's a list of NTS servers:
- https://gist.github.com/jauderho/2ad0d441760fc5ed69d8d4e2d6b35f8d
- https://gitlab.com/-/snippets/2481323

I use:
time.cloudflare.com,ptbtime1.ptb.de,ptbtime2.ptb.de,ptbtime3.ptb.de,ntp2.glypnod.com,nts.sth1.ntp.se,nts.sth2.ntp.se,ntp.3eck.net,ntp.trifence.ch,ntp.zeitgitter.net,nts1.adopo.net,www.jabber-germany.de,www.masters-of-cloud.de,ntppool1.time.nl,ntppool2.time.nl,ptbtime4.ptb.de,paris.time.system76.com,ntp3.fau.de

Ill give it a try....
Title: Re: Secure NTP
Post by: depc80 on April 29, 2023, 11:18:22 pm
you can install Chrony and use NTS.
Yep. Here's a list of NTS servers:
- https://gist.github.com/jauderho/2ad0d441760fc5ed69d8d4e2d6b35f8d
- https://gitlab.com/-/snippets/2481323

I use:
time.cloudflare.com,ptbtime1.ptb.de,ptbtime2.ptb.de,ptbtime3.ptb.de,ntp2.glypnod.com,nts.sth1.ntp.se,nts.sth2.ntp.se,ntp.3eck.net,ntp.trifence.ch,ntp.zeitgitter.net,nts1.adopo.net,www.jabber-germany.de,www.masters-of-cloud.de,ntppool1.time.nl,ntppool2.time.nl,ptbtime4.ptb.de,paris.time.system76.com,ntp3.fau.de
Awesome. How to create a cron job to get it update everyday?
Title: Re: Secure NTP
Post by: lilsense on April 30, 2023, 10:25:16 pm
chrony/ntp updates itself automagically...
Title: Re: Secure NTP
Post by: depc80 on May 03, 2023, 01:18:07 pm
Thank you.
However I ran into an issue where enabled Chrony crashed OPNsense. Adguard logs see  a lot of queries every couple milliseconds. Took awhile to get to webgui so I could disable it. At first, I thought the issue was the redirect rule so I disabled it and also only added 1 server. Still seeing a lot of queries sending to Adguard. I ended up disabling Chrony for now.
Today I switched to Zenarmor since the latest update is working without problem for my OPNsense. Will try Chrony again later.
Title: Re: Secure NTP
Post by: abulafia on May 04, 2023, 10:05:59 am
Running adguard and chrony and never had an issue between those two.

I assume you have disabled the regular NTP server service? (Services -> Network Time -> General -> "Time Servers" empty and "Client Mode" ticked)

And another wild shot in the dark: You have disabled the rate limit in Adguard Home (Settings -> DNS Settings -> Rate Limit set to "0")?
Title: Re: Secure NTP
Post by: depc80 on May 05, 2023, 02:22:07 pm
Running adguard and chrony and never had an issue between those two.

I assume you have disabled the regular NTP server service? (Services -> Network Time -> General -> "Time Servers" empty and "Client Mode" ticked)

And another wild shot in the dark: You have disabled the rate limit in Adguard Home (Settings -> DNS Settings -> Rate Limit set to "0")?
I switch to Zenarmor for now, reduce ~40ms ping but it's a completely different topic. Anyway, would NAT redirect rule like DNS or NTP cause PTR flooding Adguard?
Today I installed Chrony and added a couple servers from here
Code: [Select]
https://gist.github.com/jauderho/2ad0d441760fc5ed69d8d4e2d6b35f8dAfter that I see a buttload of PTR resolve in Unbound logs right away. However, things seem going back to normal after restart or maybe bc I change NAT redirect NTP rule before DNS. Can't re-create the issue.
Title: Re: Secure NTP
Post by: SteveK on November 28, 2023, 12:20:00 pm
Just found this topic...while I was about to implement secure NTP, too.

I have a question...setup:
- Install chrony, enable it, check " NTS Client Support", add the appropriate NTP servers in "NTP Peers"
- and for the network time service: remote all entries of time servers and check "Client support"

So far, the network service has provided NTP in all interfaces (set in "Interfaces" accordingly).

What is the "right approach"? Set the chrony "Listen port" to "123" + manually enter the networks in "Allowed Networks", like "10.55.10.0/24; 10.55.160.0/23" in order to provide NTP service?
I mean that by enabling "Client support" for the network time service ends the NTP service.
Title: Re: Secure NTP
Post by: lilsense on November 28, 2023, 12:46:17 pm
You'd want to leave everything as default, but yes you should use the IP subnets and the individual interfaces as you don't want attacks from outside on NTP ports.
Title: Re: Secure NTP
Post by: abulafia on January 23, 2024, 06:15:47 pm
I gather the regular approach is to use firewall rules to control whether e.g. NTP is available or not to a given subnet, not limiting the "listen to" interface settings in each service.

Works for me. No WAN rule "pass"ing traffic to port 123 = nobody from outside can access my local NTP server.