Portable build framework for OpenNTPD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
4.5 KiB

  1. 1. Prerequisites
  2. ----------------
  3. You will need an entropy (randomness) source. If your OS has arc4random or
  4. getentropy then that is ideal. Otherwise, OpenNTPD will use its builtin
  5. arc4random implementation, which is also part of the LibreSSL project.
  6. 2. Building / Installation
  7. --------------------------
  8. If you have checked this source using Git, follow these initial steps to
  9. prepare the source tree for building:
  10. 1. ensure you have the following packages installed:
  11. automake, autoconf, git, libtool, bison
  12. 2. run './autogen.sh' to prepare the source tree for building
  13. or run './dist.sh' to prepare a tarball.
  14. To install OpenNTPD with default options:
  15. ./configure
  16. make
  17. make install
  18. This will install the OpenNTPD binary in /usr/local/sbin, configuration
  19. files in /usr/local/etc. To specify a different installation prefix,
  20. use the --prefix option to configure:
  21. ./configure --prefix=/opt
  22. make
  23. make install
  24. Will install OpenNTPD in /opt/{etc,sbin}. You can also override
  25. specific paths, for example:
  26. ./configure --prefix=/opt --sysconfdir=/etc/ntp
  27. make
  28. make install
  29. This will install the binaries in /opt/sbin, but will place the
  30. configuration files in /etc/ntp.
  31. OpenNTPD always uses Privilege Separation (ie the majority of the
  32. processing is done as a chroot'ed, unprivileged user).
  33. This requires that a user, group and directory to be created for it.
  34. The user should not be permitted to log in, and its home directory
  35. should be owned by root and be mode 755.
  36. If you do "make install", the Makefile will create the directory with
  37. the correct permissions and will prompt you for the rest if required.
  38. If, however, you need to perform all of these tasks yourself (eg if you
  39. are moving the built binaries to another system) then you will need to
  40. do something like the following (although the exact commands required
  41. for creating the user and group are system dependant):
  42. On most Linux and BSD systems, something like should work:
  43. groupadd _ntp
  44. useradd -g _ntp -s /sbin/nologin -d /var/empty -c 'OpenNTP daemon' _ntp
  45. mkdir -p /var/empty
  46. chown 0 /var/empty
  47. chgrp 0 /var/empty
  48. chmod 0755 /var/empty
  49. /var/empty here is a chroot directory used by ntpd for privilege separation of
  50. the DNS and NTP processes. This directory should not contain any files, must be
  51. owned by root, and must not be group or world-writable.
  52. NOTE:
  53. If you installed a previous OpenNTPD release and created a /var/empty/ntp
  54. directory, please delete the /var/empty/ntp directory and adjust the _ntp
  55. user's home directory to point to /var/empty instead.
  56. This is important because, if you have any other daemons that also use
  57. /var/empty as a home directory, they will all have an empty privilege
  58. separation directory.
  59. As of OS X 10.10, something like this should work similarly
  60. (thanks to jasper@ for suggesting)
  61. dscl . create /Users/_ntp
  62. dscl . create /Users/_ntp UserShell /sbin/nologin
  63. # Prevent user from showing up on the login screen
  64. dscl . delete /Users/_ntp AuthenticationAuthority
  65. # Arbitrarily chosen UID that was free
  66. dscl . create /Users/_ntp UniqueID 400
  67. dscl . create /Users/_ntp PrimaryGroupID 400
  68. dscl . create /Users/_ntp RealName "OpenNTPD user"
  69. dseditgroup -o create _ntp
  70. dscl . append /Groups/_ntp GroupMembership _ntp
  71. There are a few options to the configure script in addition to the ones
  72. provided by autoconf itself:
  73. --with-privsep-user=[user]
  74. Specify unprivileged user used for privilege separation. The default
  75. is "_ntp".
  76. --with-privsep-path=path
  77. ntpd will always use the home directory of the privsep user
  78. to chroot to, but specifying this parameter will change the
  79. post-installation checks and instructions to match the specified path.
  80. --with-cacert=[path]
  81. Specify the CA certificate location for HTTPS constraint validation.
  82. Defaults to /etc/ssl/certs/ca-certificates.crt
  83. If you need to pass special options to the compiler or linker, you
  84. can specify these as environment variables before running ./configure.
  85. For example:
  86. CFLAGS="-O2 " LDFLAGS="-s" ./configure
  87. 3. Configuration
  88. ----------------
  89. The runtime configuration files are installed by in ${prefix}/etc or
  90. whatever you specified as your --sysconfdir (/usr/local/etc by default).
  91. If no configuration file exists, the default one is used. The default
  92. configuration file uses a selection of publicly accessible "pool" servers
  93. (see http://support.ntp.org/bin/view/Servers/NTPPoolServers)
  94. 4. Problems?
  95. ------------
  96. If you experience problems compiling, installing or running OpenNTPD,
  97. please report the problem to the address in the README.md file.