AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 957302
Accepted
IMTheNachoMan
IMTheNachoMan
Asked: 2019-03-08 20:37:11 +0800 CST2019-03-08 20:37:11 +0800 CST 2019-03-08 20:37:11 +0800 CST

在 Linux 服务器上保护/强化 ntp 客户端 - 配置文件

  • 772

我使用 NTP 客户端全新安装了 Debian。我获得了保护我的 NTP 客户端配置的设置。我知道如何将它们添加到/etc/ntp.conf文件中,但如果设置需要合并或覆盖,如果顺序很重要,或者如何处理重复设置,我不知道。

/etc/ntp.conf这是软件包附带的默认文件:

cat /etc/ntp.conf | egrep -v '^#|^$'
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
pool 0.debian.pool.ntp.org iburst
pool 1.debian.pool.ntp.org iburst
pool 2.debian.pool.ntp.org iburst
pool 3.debian.pool.ntp.org iburst
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
restrict 127.0.0.1
restrict ::1
restrict source notrap nomodify noquery

这些是我被告知要使用的设置:

#creates file to adjust the default system clock value after a service interruption/restart
driftfile /var/lib/ntp/drift

#access controls to reduce unwanted queries (kod)
#prevent alteration of configuration file (nomodify)
#prevent nptdc from being used for control message protocol traps (notrap)
#prevent peer queries (nopeer)
#prevent ntpq and ntpdc queries from being answered (noquery)

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

#restrict NTP access to localhost
restrict 127.0.0.1
restrict -6 ::1

#point to NIST time servers use fastest method to collect time
server time.nist.gov iburst

#point to localhost if access is lost to NTP servers/pools
fudge 127.127.1.0 stratum 10

#mitigates CVE-2013-5211
disable monitor

对于其中一些,例如driftfile,我发现它们需要被覆盖。我不确定剩下的那些。需要它们还是我要更换它们?如果我保留它们,顺序重要吗?

根据我的理解,这些是我知道基于合并默认选项和我提供的内容需要存在的设置:

# creates file to adjust the default system clock value after a service interruption/restart
driftfile /var/lib/ntp/drift

# access control configuration
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

# restrict NTP access to localhost
restrict 127.0.0.1
restrict -6 ::1

# point to NIST time servers use fastest method to collect time
server time.nist.gov iburst

# point to localhost if access is lost to NTP servers/pools
fudge 127.127.1.0 stratum 10

# mitigates CVE-2013-5211
disable monitor

这些是默认文件中的剩余设置,但我不确定如何处理它们:

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
restrict source notrap nomodify noquery
linux
  • 3 3 个回答
  • 2435 Views

3 个回答

  • Voted
  1. Best Answer
    Paul Gear
    2019-03-09T16:36:16+08:002019-03-09T16:36:16+08:00

    进一步补充 John Mahowald 的回答:您给出的推荐配置是旧的,不应该遵循。考虑到我们目前所知的 NTP 漏洞,Debian/Ubuntu 提供的默认配置旨在尽可能安全,您应该对其进行尽可能少的更改。

    建议的配置中唯一可能对您很重要的是 NIST 时间服务器的选择。如果你想使用它们,你应该使用pool指令而不是仅仅使用server. 如果服务器无响应或服务时间不长,该pool指令可以ntpd停止使用服务器,因此您几乎总是应该优先使用它而不是server.

    因此,总的来说,您可能会考虑添加到默认配置中的唯一内容是:

    pool time.nist.gov iburst
    

    除非您取消注释此行,否则您突出显示的统计信息行没有任何效果:

    #statsdir /var/log/ntpstats/
    

    最后一个非常重要,因为它使您能够使用池:

    restrict source notrap nomodify noquery
    

    您应该确保该线留在原位。

    • 2
  2. John Mahowald
    2019-03-09T05:38:11+08:002019-03-09T05:38:11+08:00

    如果您想要设置一整套指令,只需替换发行版的 ntp.conf。但是您不需要,因为它们具有同等的安全性:

    • 您的限制选项非常相似。Debian 明确使用 -4 来指示 IPv4 并施加速率限制。
    • CVE-2013-5211是一种使用 monlist 的放大攻击。Debian stretch 和更高版本的版本没有这个缺陷,而且他们的默认配置在几年前就已经缓解了这个缺陷。
    • 漂移文件的位置对安全性几乎没有影响。

    您建议的 NTP 配置的个人烦恼:

    地址以 127.127.1 开头的服务器。是无纪律的本地时钟。不推荐使用它,它不添加任何东西,迷惑人,孤儿模式更好。

    您无需使用 NIST Internet 时间服务即可获得可靠的时钟。如果你愿意,你可以,他们喜欢使用 time.nist.gov 全局负载平衡器。但是,NTP 池项目减轻了参考时钟的负担,并且在许多用例中都能充分发挥作用。

    • 1
  3. Tero Kilkanen
    2019-03-08T23:38:30+08:002019-03-08T23:38:30+08:00

    的内容driftfile不会添加/删除任何安全性,它只是 NTP 存储数据的位置。使用它的分布默认值。

    否则不需要所有遗漏的设置,它们是正常操作不需要的统计功能。

    • 0

相关问题

  • Linux 主机到主机迁移

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 如何在 Linux 下监控每个进程的网络 I/O 使用情况?

  • 在 RHEL4 上修改 CUPS 中的现有打印机设置

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve