Debian · Linux utilities · Security

使用較為安全的 Chrony 來替換 ntpd 以完成 NTP 校時的工作

之前文章分享了使用 ntpd 進行 NTP 時間校時, 但是如果想要使用更安全的工具來完成 NTP 校時的工作, 則可以考慮使用 Chrony [1].

Chrony 開源專案由 Redhat 開發, 並由 Linux foundation project – Core Infrastructure Initiative (CII) [2] 資助. 當初 CII 在決定資助 Chrony 前, 曾經對市面上常見的三個 NTP 開源專案 – ntpd, ntpsec, 以及 Chrony 進行整體性的資安審查評估 [3]. 由下圖可得知, Chrony 是相對較為安全的開源專案.

chart.png

src: https://www.coreinfrastructure.org/wp-content/uploads/sites/6/2018/04/chart.png


Chrony 主要含有兩隻程式

  • chronyd – 提供同步時間的系統服務 (daemon)
  • chronyc – 以 command-line 方式與 chronyd 溝通以及設定.

設定檔位於 /etc/chrony/chrony.conf, 詳細內容可見 man chrony.conf

基本的功能如下:

1. 確認同步來源狀態 – chronyc activity

2019-10-11_234551.png

2. 確認時間同步狀態 – chronyc tracking

2019-10-11_233901.png

3. 立即更新時間 – chronyc makestep

4. 搭配 gpsd 來進行校時 

Chrony 跟 ntpd 一樣, 可搭配 gpsd 來進行時間校時. 詳細設定請見這裡.
由於 chronyd & chronyc 的 manpage 寫的相當詳盡, 更多詳細用法可直接參考內部說明.


References:

[1] https://chrony.tuxfamily.org/

[2] https://www.coreinfrastructure.org/grants/

[3] https://www.coreinfrastructure.org/blogs/securing-network-time/

發表迴響