Hash 如何使用SHA哈希认证构建chrony?

Hash 如何使用SHA哈希认证构建chrony?,hash,md5,sha,ntp,Hash,Md5,Sha,Ntp,我正在尝试为嵌入式linux系统构建chorny。我目前能够编译、运行和同步时间。我还可以使用MD5启用身份验证,这同样有效 我不知道如何启用SHA哈希。在生成包时使用它,但在“配置”中没有相应的选项。以前有人这样做过吗 谢谢 如果我将chrony.keys文件中的哈希类型设置为SHA1,则这是输出: root@gsdm:~# chronyd -d 2000-01-08T00:54:56Z chronyd version 2.2 starting (+CMDMON +NTP +REFCLOCK

我正在尝试为嵌入式linux系统构建chorny。我目前能够编译、运行和同步时间。我还可以使用MD5启用身份验证,这同样有效

我不知道如何启用SHA哈希。在生成包时使用它,但在“配置”中没有相应的选项。以前有人这样做过吗

谢谢

如果我将chrony.keys文件中的哈希类型设置为SHA1,则这是输出:

root@gsdm:~# chronyd -d 
2000-01-08T00:54:56Z chronyd version 2.2 starting (+CMDMON +NTP +REFCLOCK +RTC -PRIVDROP -SCFILTER -SECHASH +ASYNCDNS +IPV6 -DEBUG)
2000-01-08T00:54:56Z Unknown hash function in key 12
2000-01-08T00:54:56Z Initial frequency 1.355 ppm
当我运行./configure-h时,我得到以下结果:

`configure' configures this package to adapt to many kinds of systems.

Usage: ./configure [OPTION]...

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=/home/user'.

For better control, use the options below.
  --disable-readline     Disable line editing support
  --without-readline     Don't use GNU readline even if it is available
  --without-editline     Don't use editline even if it is available
  --readline-dir=DIR     Specify parent of readline include and lib directories
  --readline-inc-dir=DIR Specify where readline include directory is
  --readline-lib-dir=DIR Specify where readline lib directory is
  --with-ncurses-library=DIR Specify where ncurses lib directory is
  --disable-sechash      Disable support for hashes other than MD5
  --without-nss          Don't use NSS even if it is available
  --without-tomcrypt     Don't use libtomcrypt even if it is available
  --disable-cmdmon       Disable command and monitoring support
  --disable-ntp          Disable NTP support
  --disable-refclock     Disable reference clock support
  --disable-phc          Disable PHC refclock driver
  --disable-pps          Disable PPS refclock driver
  --disable-ipv6         Disable IPv6 support
  --disable-rtc          Don't include RTC even on Linux
  --disable-privdrop     Disable support for dropping root privileges
  --without-libcap       Don't use libcap even if it is available
  --enable-scfilter      Enable support for system call filtering
  --without-seccomp      Don't use seccomp even if it is available
  --disable-asyncdns     Disable asynchronous name resolving
  --disable-forcednsretry Don't retry on permanent DNS error
  --with-ntp-era=SECONDS Specify earliest assumed NTP time in seconds
                         since 1970-01-01 [50*365 days ago]
  --with-user=USER       Specify default chronyd user [root]
  --with-hwclockfile=PATH Specify default path to hwclock(8) adjtime file
  --with-sendmail=PATH   Path to sendmail binary [/usr/lib/sendmail]
  --enable-debug         Enable debugging support

Fine tuning of the installation directories:
  --sysconfdir=DIR       chrony.conf location [/etc]
  --bindir=DIR           user executables [EPREFIX/bin]
  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  --datarootdir=DIR      data root [PREFIX/share]
  --infodir=DIR          info documentation [DATAROOTDIR/info]
  --mandir=DIR           man documentation [DATAROOTDIR/man]
  --docdir=DIR           documentation root [DATAROOTDIR/doc/chrony]
  --localstatedir=DIR    modifiable single-machine data [/var]
  --chronysockdir=DIR    location for chrony sockets [LOCALSTATEDIR/run/chrony]
  --chronyvardir=DIR     location for chrony data [LOCALSTATEDIR/lib/chrony]

Overriding system detection when cross-compiling:
  --host-system=OS       Specify system name (uname -s)
  --host-release=REL     Specify system release (uname -r)
  --host-machine=CPU     Specify machine (uname -m)

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  CPPFLAGS    C preprocessor flags, e.g. -I<include dir> if you have
              headers in a nonstandard directory <include dir>
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
“configure”配置此软件包以适应多种系统。
用法:./configure[选项]。。。
括号中指定了选项的默认值。
配置:
-h、 --帮助显示此帮助并退出
安装目录:
--prefix=prefix在prefix中安装与体系结构无关的文件
[/usr/local]
--exec prefix=EPREFIX在EPREFIX中安装与体系结构相关的文件
[前缀]
默认情况下,“make install”将安装中的所有文件
`/usr/local/bin'、`/usr/local/lib'等。您可以指定
除使用“---prefix”的“/usr/local”之外的安装前缀,
例如“--prefix=/home/user”。
为了更好地控制,请使用以下选项。
--禁用readline禁用行编辑支持
--如果没有readline,即使GNU readline可用,也不要使用它
--如果没有editline,请不要使用editline,即使它可用
--readline dir=dir指定readline include和lib目录的父目录
--readline inc dir=dir指定readline include目录的位置
--readline lib dir=dir指定readline lib目录的位置
--使用ncurses library=DIR指定ncurses lib目录的位置
--禁用sechash禁用对MD5以外的哈希的支持
--如果没有nss,即使nss可用,也不要使用
--如果没有tomcrypt,即使libtomcrypt可用,也不要使用它
--禁用cmdmon禁用命令和监视支持
--禁用ntp禁用ntp支持
--禁用参考时钟禁用参考时钟支持
--禁用phc禁用phc参考时钟驱动程序
--禁用pps禁用pps参考时钟驱动程序
--禁用-ipv6禁用ipv6支持
--禁用rtc即使在Linux上也不包括rtc
--禁用privdrop禁用对删除根权限的支持
--如果没有libcap,即使libcap可用,也不要使用它
--启用scfilter启用对系统调用筛选的支持
--没有seccomp,不要使用seccomp,即使它可用
--禁用异步DNS禁用异步名称解析
--禁用强制DNS重试不重试永久DNS错误
--ntp era=秒时,以秒为单位指定最早假定的ntp时间
自1970-01-01[50*365天前]
--with user=user指定默认的chronyd用户[root]
--使用hwclockfile=PATH指定hwclock(8)adjtime文件的默认路径
--with sendmail=sendmail二进制文件的路径[/usr/lib/sendmail]
--启用调试启用调试支持
安装目录的微调:
--sysconfdir=DIR chrony.conf位置[/etc]
--bindir=DIR用户可执行文件[EPREFIX/bin]
--sbindir=DIR系统管理可执行文件[EPREFIX/sbin]
--datarootdir=DIR数据根[前缀/共享]
--infodir=DIR信息文档[DATAROOTDIR/info]
--mandir=DIR-man文档[DATAROOTDIR/man]
--docdir=DIR文档根目录[DATAROOTDIR/doc/chrony]
--localstatedir=DIR可修改的单机数据[/var]
--chronysockdir=chrony套接字的目录位置[LOCALSTATEDIR/run/chrony]
--chronyvardir=chrony数据的DIR位置[LOCALSTATEDIR/lib/chrony]
交叉编译时重写系统检测:
--主机系统=操作系统指定系统名称(uname-s)
--主机版本=REL指定系统版本(uname-r)
--主机=CPU指定机器(uname-m)
一些有影响的环境变量:
CC编译器命令
CFLAGS C编译器标志
CPPC标志预处理器标志,例如-I,如果有
非标准目录中的标题
LDFLAGS链接器标志,例如,-L,如果在
非标准目录
使用这些变量覆盖“配置”所做的选择或帮助
查找具有非标准名称/位置的库和程序非常困难。

安全哈希需要
tomcrypt
NSS
,如果系统上存在这些库中的任何一个,则默认情况下将在配置时启用

没有
configure
选项来启用它们,但有一些选项可以禁用它们:

--disable-sechash      Disable support for hashes other than MD5
--without-nss          Don't use NSS even if it is available
--without-tomcrypt     Don't use libtomcrypt even if it is available
chrony输出第一行中的
-SECHASH
表示在配置时禁用了安全哈希选项,或者(更有可能)您没有安装必要的库。

-SECHASH
表示不使用Nettle、NSS或libtomcrypt编译的chrony版本,因此如果您想使用SHA密钥,可以通过源代码安装
在Alpine 3.8中,我安装了
nettle dev
库:

apk add nettle-dev
./configure
... ...
Checking for nettle : Yes
Features : +CMDMON +NTP +REFCLOCK +RTC -PRIVDROP -SCFILTER -SIGND +ASYNCDNS -READLINE +SECHASH +IPV6 -DEBUG
Creating Makefile
Creating doc/Makefile
Creating test/unit/Makefile

make install
这些特性显示SECHASH已启用。 所以这个版本确实支持SHA1

apk add nettle-dev
./configure
... ...
Checking for nettle : Yes
Features : +CMDMON +NTP +REFCLOCK +RTC -PRIVDROP -SCFILTER -SIGND +ASYNCDNS -READLINE +SECHASH +IPV6 -DEBUG
Creating Makefile
Creating doc/Makefile
Creating test/unit/Makefile

make install