1. 23 Jan, 2022 1 commit
    • Cy Schubert's avatar
      rc.d/ntp: Ensure ntpd.leap-seconds.list is readable by ntpd · 28d0a782
      Cy Schubert authored
      When a use sets umask in login.conf(5) to 027 or 077 a subsequently
      fetched /var/db/ntpd.leap-seconds.list will inherit the permissions
      allowed by the umask, resulting in a file that may not be readable
      ntpd running under the ntp account. This patch adds a umask command
      to preempt the umask in login.conf(5) prior to fetching a new copy
      of the leap-seconds file.
      
      PR:		261298
      Reported by:	Martin Waschbusch <martin@waschbuesch.de>
      
      (cherry picked from commit c6806434)
      28d0a782
  2. 22 Dec, 2019 1 commit
    • Ian Lepore's avatar
      MFC r355100: · 127abdc0
      Ian Lepore authored
      Allow opt-out of automatic ntpd leapfile checking/fetching.
      
      When a system has no internet connection, or when it is configured to obtain
      ntpd leapfiles from some source other than the internet, or even when the
      sysadmin has decided for some reason to customize ntp.conf to eliminate use
      of the leapfile, the rc.d/ntpd script emits various error messages related
      to the file.
      
      This change allows setting the rc var ntp_db_leapfile to NONE to disable all
      automatic processing related to that file in rc.d/ntpd.
      
      Differential Revision:	https://reviews.freebsd.org/D22461
      127abdc0
  3. 23 Jun, 2019 1 commit
    • Ian Lepore's avatar
      MFC r348141, r348143 · a9ccea3e
      Ian Lepore authored
      r348141:
      Handle the driftfile option correctly when ntpd_flags is empty.
      
      The logic I originally wrote to detect whether a driftfile option was in the
      set of flags was based on the result of removing the pattern *flag* being an
      empty string.  That didn't handle the case where the string was empty to
      begin with.  Doh!  So now it also specifically checks for an empty string.
      
      The result of the bad check was that ntpd would run without a driftfile, but
      it would do so only if it was running as root instead of the non-priveleged
      ntpd user, which isn't a typical case.  Ntpd runs fine without a driftfile,
      although it does take it longer to stabilize the clock frequency at startup.
      
      Reported by:	avg@
      Pointy hat:	ian@
      
      r348143:
      Remove accidentally-added blank line; the style throughout this file
      is to use no whitespace between a comment block and the code it describes.
      a9ccea3e
  4. 17 Oct, 2018 1 commit
    • Bjoern A. Zeeb's avatar
      Move the rc framework out of sbin/init into libexec/rc. · 0696600c
      Bjoern A. Zeeb authored
      The reasons for this are forward looking to pkgbase:
       * /sbin/init is a special binary; try not to replace it with
         every package update because an rc script was touched.
         (a follow-up commit will make init its own package)
       * having rc in its own place will allow more easy replacement
         of the rc framework with alternatives, such as openrc.
      
      Discussed with:		brd (during BSDCam), kmoore
      Requested by:		cem, bz
      PR:			231522
      Approved by:		re (gjb)
      0696600c
  5. 28 Jul, 2018 1 commit
  6. 20 Jul, 2018 1 commit
    • Ian Lepore's avatar
      Automatically run ntpd as non-root when possible. · d11f4dfd
      Ian Lepore authored
      Ntpd needs only a subset of full root privileges to do its job. Specifically
      it needs the ability to manipulate system time, and to re-bind to a
      privileged UDP port after interface changes. The mac_ntpd(4) policy module
      (see r336525) can grant these privs.
      
      These changes detect the availability of mac_ntpd(4). If enabled, and if the
      ntpd configuration is fairly vanilla, it automatically runs ntpd as the
      non-root user 'ntpd' (uid 123). "Vanilla" means the config doesn't include
      command line or ntp.conf options changing the location of files or using any
      files/dirs likely to be inaccessible to user ntpd.  Ntpd can still run as
      non-root when using such options, but the admin must ensure all required
      files and dirs are accessible, and then set ntpd_user=ntpd in rc.conf.
      
      Note that these changes also address PR 199127 by using the command_args
      technique suggested in the patch. They also tangentially address PR 113552,
      which is primarily about inconsistent filenames in documentation, but some
      of the inconsistancy was caused by old code in rc.d/ntpd which is leftover
      from the intial import from netbsd. There was code to do chroot setup which
      required the use of the netbsd clockctl(4) device; that code never had any
      effect on freebsd, because we lack that device and don't build ntpd with the
      options that would allow using it.
      
      PR:		113552 199127
      Relnotes:	yes
      Differential Revision:	https://reviews.freebsd.org/D16050
      d11f4dfd
  7. 28 Jun, 2018 2 commits
  8. 23 Jun, 2018 1 commit
    • Ian Lepore's avatar
      Use 'mv -f' in rc.d/ntpd to avoid spuriously halting the boot. · 6014f3c4
      Ian Lepore authored
      The final 'mv' to install a fetched leap-list file can fail (due to a
      readonly fs, or schg flags, for example), and that leads to mv(1)
      prompting the user, stopping the boot process.  Instead, use mv -f
      to supress the prompting, and if verbose mode is on, emit a warning
      that the existing file cannot be replaced.
      
      PR:		219255
      6014f3c4
  9. 09 Jan, 2018 1 commit
    • Cy Schubert's avatar
      USNO and possibly others have misinterpreted the maining of the · da7a237f
      Cy Schubert authored
      leapseconds last-update field and incorrectly increment it when changing
      the file even though the leapsecond data has not changed. For instance,
      if a leapsecond file is obtained from USNO, when it expires it will not
      be replaced by a newer file from other sources because it has an
      incorrect later last-update (version).
      
      This corrects r304780.
      
      PR:		225029
      Submitted by:	ian
      MFC after:	3 days
      da7a237f
  10. 28 Nov, 2017 1 commit
  11. 19 Oct, 2017 1 commit
    • Cy Schubert's avatar
      Anticongestion refinements for ntpd rc script. This reverts r324681 · dde76442
      Cy Schubert authored
      and checks if ntp leapfile needs fetching before entering into the
      anticongestion sleep.
      
      Unfortunately some ports still use their own sleeps so, this commit
      doesn't address the complete problem which is compounded by every
      port that uses its own anticongestion mechanism.
      
      Discussed with:		asomers
      dde76442
  12. 25 Aug, 2016 4 commits
  13. 25 May, 2016 1 commit
  14. 23 Apr, 2016 1 commit
  15. 11 Feb, 2016 1 commit
  16. 27 Jan, 2016 1 commit
  17. 26 Jan, 2016 1 commit
    • Cy Schubert's avatar
      Add support for automatic leap-second file updates. · b5bdbd04
      Cy Schubert authored
      The working copy of leapfile resides in /var/dbntpd.leap-seconds.list.
      /etc/ntp/leap-seconds (periodically updated from ftp://time.nist.gov/pub/
      or ftp://tycho.usno.navy.mil/pub/ntp/) contains the master copy should
      automatic leapfile updates be disabled (default).
      
      Automatic leapfile updates are fetched from $ntp_leapfile_sources,
      defaulting to https://www.ietf.org/timezones/data/leap-seconds.list,
      within $ntp_leapfile_expiry_days (default 30 days) from leap-seconds
      file expiry. Automatic updates can be enabled by setting
      $daily_ntpd_leapfile_enable="YES" in periodic.conf. To avoid congesting
      the ntp leapfile source the automatic update randomized by default but
      can be disabled through daily_ntpd_avoid_congestion="NO" in
      periodic.conf.
      
      Suggested by:	des
      Reviewed by:	des, roberto, dwmalone, ian, cperciva, glebius, gjb
      MFC after:	1 week
      X-MFC with:	r289421, r293037
      b5bdbd04
  18. 11 Sep, 2012 1 commit
    • David E. O'Brien's avatar
      Simply things so that "#REQUIRE: FILESYSTEMS" means the file · 8801556b
      David E. O'Brien authored
      systems are fully "ready to go".
      
      'FILESYSTEMS' states: "This is a dummy dependency, for services which
      require file systems to be mounted before starting."  However, we have
      'var' which is was run after 'FILESYSTEMS' and can mount /var if it
      already isn't mounted.  Furthermore, several scripts cannot use /var
      until 'cleanvar' has done its thing.  Thus "FILESYSTEMS" hasn't really
      meant all critical file systems are fully usable.
      8801556b
  19. 14 Jan, 2012 1 commit
    • Doug Barton's avatar
      Prepare for the removal of set_rcvar() by changing the rcvar= · 801c4383
      Doug Barton authored
      assignments to the literal values it would have returned.
      
      The concept of set_rcvar() was nice in theory, but the forks
      it creates are a drag on the startup process, which is especially
      noticeable on slower systems, such as embedded ones.
      
      During the discussion on freebsd-rc@ a preference was expressed for
      using ${name}_enable instead of the literal values. However the
      code portability concept doesn't really apply since there are so
      many other places where the literal name has to be searched for
      and replaced. Also, using the literal value is also a tiny bit
      faster than dereferencing the variables, and every little bit helps.
      801c4383
  20. 10 Mar, 2010 1 commit
  21. 30 May, 2009 1 commit
  22. 29 Jan, 2009 1 commit
  23. 27 Jan, 2009 1 commit
  24. 19 Oct, 2008 1 commit
  25. 16 Jul, 2008 1 commit
    • Doug Barton's avatar
      Add the shutdown KEYWORD to those scripts that start persistent services · 04f0f225
      Doug Barton authored
      to allow them to do a "clean" shutdown.
      
      I purposely avoided making changes to network-related stuff since the
      system shutting down is pretty conclusive, and there may be complicated
      dependencies on the network that I would rather not try to unravel.
      
      I also skipped kerberos-related stuff for the reasons above, and
      because I have no way to test it.
      04f0f225
  26. 12 May, 2008 1 commit
  27. 18 Apr, 2006 1 commit
  28. 21 Dec, 2005 1 commit
    • Doug Barton's avatar
      Several users have commented (via filing PRs) that having ntp* depend · 27c4192a
      Doug Barton authored
      on devfs is useful so that a hardware time device can start with its
      necessary device nodes already in place. While this ordering happens
      as a side effect currently in HEAD, and the PRs were generally fixed
      via upgrades, etc; it's better to make it explicit.
      
      While I'm here, ntpd should REQUIRE ntpdate, rather than ntpdate
      using BEFORE: ntpd.
      27c4192a
  29. 16 Jan, 2005 1 commit
  30. 07 Oct, 2004 1 commit
  31. 14 Sep, 2004 1 commit
    • Sean Chittenden's avatar
      Stop using ntpdate(1) in our startup proceedure. Replace ntpdate(1) with · 0050f9ec
      Sean Chittenden authored
      calls to ntpd -g.  ntpd is noticably slower than ntpdate, but is also more
      accurate.  This removes the nasty hackery in rc.d/ntpdate that would parse
      out ntp servers from /etc/ntp.conf (ntpd knows how to read its own config
      file).  By default, ntpd *will* sync with its listed time servers.  To
      turn this off so that ntpd does not sync, ntpd_sync_on_start="NO" can be
      added to /etc/rc.conf.  If ntpd is not enabled (the default), then time is
      not synced on startup.  ntpdate's use has been depreciated by the ntpd
      authors for quite some time so this change shouldn't be unexpected.
      
      Suggested by:	des
      Approved by:	roberto (resident ntp guru)
      0050f9ec
  32. 08 Mar, 2004 1 commit
  33. 17 Jan, 2004 2 commits
  34. 12 Oct, 2002 1 commit
    • Jens Schweikhardt's avatar
      Fix style bugs: · 14308510
      Jens Schweikhardt authored
      * Space -> tabs conversion.
      * Removed blanks before semicolon in "if ... ; then".
      * Proper indentation of misindented lines.
      * Put a full stop after some comments.
      * Removed whitespace at end of line.
      
      Approved by:	silence from gordon
      14308510
  35. 06 Sep, 2002 1 commit