systemd-analyze は systemctl edit による変更を検出しません。

systemd-analyze は systemctl edit による変更を検出しません。

私はLynis監査のアドバイスに従ってUbuntu 20.04の既存のシステムサービスを強化しましたsystemd-analyzesystemctl edit変更に使用したいが検出できsystemd-analyzeず、サービスファイルを直接編集した場合にのみ検出します。 /etc/systemd/system/をリンクする方法はありますか?私のサービス.service.d/結果をデフォルトのサービスファイルに追加することで、systemd-analyze変更がわかりますか?

逆に私がすることは次のとおりです。

sudo lynis audit system

苦情は次のとおりです。

[+] Boot and services
------------------------------------
...
  - Check running services (systemctl)                        [ DONE ]
        Result: found 42 running services
  - Check enabled services at boot (systemctl)                [ DONE ]
        Result: found 70 enabled services
  - Check startup files (permissions)                         [ OK ]
  - Running 'systemd-analyze security'
   ...
        - accounts-daemon.service:                            [ UNSAFE ]
...
  Suggestions (24):
  ----------------------------
  * Consider hardening system services [BOOT-5264] 
    - Details  : Run '/usr/bin/systemd-analyze security SERVICE' for each service
      https://cisofy.com/lynis/controls/BOOT-5264/
...

だから、次のコマンドを実行します。

systemd-analyze security accounts-daemon.service

以下を出力します。

  NAME                                                        DESCRIPTION                       >
✗ PrivateNetwork=                                             Service has access to the host's network  >
✗ User=/DynamicUser=                                          Service runs as root user                 >
...
→ Overall exposure level for accounts-daemon.service: 9.6 UNSAFE 

ベストアンサー1

おすすめ記事