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.

114 lines
3.7 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, you can use the builtin arc4random
  5. implementation or the one built into LibreSSL.
  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
  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/ntp -c 'OpenNTP daemon' _ntp
  45. mkdir -p /var/empty/ntp
  46. chown 0 /var/empty/ntp
  47. chgrp 0 /var/empty/ntp
  48. chmod 0755 /var/empty/ntp
  49. As of OS X 10.10, something this this should work similarly
  50. (thanks to jasper@ for suggesting)
  51. dscl . create /Users/_ntp
  52. dscl . create /Users/_ntp UserShell /sbin/nologin
  53. # Prevent user from showing up on the login screen
  54. dscl . delete /Users/_ntp AuthenticationAuthority
  55. # Arbitrarily chosen UID that was free
  56. dscl . create /Users/_ntp UniqueID 400
  57. dscl . create /Users/_ntp PrimaryGroupID 400
  58. dscl . create /Users/_ntp RealName "OpenNTPD user"
  59. dseditgroup -o create _ntp
  60. dscl . append /Groups/_ntp GroupMembership _ntp
  61. There are a few options to the configure script in addition to the ones
  62. provided by autoconf itself:
  63. --with-privsep-user=[user]
  64. Specify unprivileged user used for privilege separation. The default
  65. is "_ntp".
  66. --with-privsep-path=path
  67. Normally ntpd will always use the home directory of the privsep user
  68. to chroot to, however use of this option will cause ntpd to always
  69. use the specified directory.
  70. If you need to pass special options to the compiler or linker, you
  71. can specify these as environment variables before running ./configure.
  72. For example:
  73. CFLAGS="-O2 " LDFLAGS="-s" ./configure
  74. 3. Configuration
  75. ----------------
  76. The runtime configuration files are installed by in ${prefix}/etc or
  77. whatever you specified as your --sysconfdir (/usr/local/etc by default).
  78. If no configuration file exists, the default one is used. The default
  79. configuration file uses a selection of publicly accessible "pool" servers
  80. (see http://support.ntp.org/bin/view/Servers/NTPPoolServers)
  81. 4. Problems?
  82. ------------
  83. If you experience problems compiling, installing or running OpenNTPD,
  84. please report the problem to the address in the README file.