{"canonical_url":"https://engineer.company/ja/portfolio/hardened-ssh-to-24-validated-directives/","content_markdown":"# SSHの24設定項目を検証・堅牢化\n\nSSHの24設定項目を、候補ファイル、統合済み設定、デーモン自身の読み戻しによる3段階で検証するよう堅牢化。読み戻しによって、稼働中のサーバーが24項目のうち2項目を黙って上書きしていたことを検出した。\n\n9月 2026\n\n**状況.** SSHは自社ホストへの唯一の対話的な入口で、何か月も正常終了してきた自動化ロールが設定していた。2026年9月のアクセスレポートがデーモン自身の実効設定を読み、毎回書き込んでいた設定と2項目が違うことを見つけた。\n\n**課題.** 何か月も見えなかった差をなくすため、リポジトリの主張でなくデーモンが確認する堅牢化にする必要があった。\n\n**行動.** 原因は順序だった。OSはドロップインより先にコメント解除済みの既定値を置き、該当2項目は先勝ちだった。OS提供元のファイルより前に並ぶ接頭辞へ変える修正は、1文字規模であり、誰も見ようとしないため壊れたままになりやすい変更だった。周辺に毎回3段階の検証を構築した。導入前の候補ファイルを構文検査して不正設定を渡さず、導入後は統合済み設定を確認し、最後にデーモンの実効値を読み戻して24項目を検証する。書いても上書きされれば失敗する。デーモンが実装しなくなった2項目は、書くだけでは念入りに見えるだけなので意図的に除外した。\n\n**結果.** SSHの状態はリポジトリの主張でなくデーモンの回答になった。その違いは仮説でなく、検査時点ですでに2項目あった。効果を見られない収束処理は安全策を検証しておらず、設定名の文字列検索は、書いたことしか証明しない。\n\n---\n\n- 役割: セキュリティエンジニア\n- カテゴリー: [インフラ](https://platform.engineer.company/ja/categories/infrastructure/), [自動化・CI/CD](https://platform.engineer.company/ja/categories/automation/), [Linux・サーバー](https://platform.engineer.company/ja/categories/linux/), [セキュリティ](https://platform.engineer.company/ja/categories/security/), [テスト・品質保証](https://platform.engineer.company/ja/categories/testing/), [システム管理](https://platform.engineer.company/ja/categories/system-administration/)\n- サービス: [コードによるインフラ管理](https://platform.engineer.company/ja/services/infrastructure-as-code/), [システム管理](https://platform.engineer.company/ja/services/system-administration/), [セキュリティ・アクセス管理](https://platform.engineer.company/ja/services/security-access/)\n\n\u003chttps://engineer.company/ja/portfolio/hardened-ssh-to-24-validated-directives/\u003e\n","date_modified":"2026-11-12T05:34:23Z","description":"SSHの状態はリポジトリの主張でなくデーモンの回答になった。その違いは仮説でなく、検査時点ですでに2項目あった。効果を見られない収束処理は安全策を検証しておらず、設定名の文字列検索は、書いたことしか証明しない。","formats":{"gemtext":"https://platform.engineer.company/ja/portfolio/hardened-ssh-to-24-validated-directives/index.gmi","gopher":"https://platform.engineer.company/ja/portfolio/hardened-ssh-to-24-validated-directives/gophermap","html":"https://platform.engineer.company/ja/portfolio/hardened-ssh-to-24-validated-directives/","json":"https://platform.engineer.company/ja/portfolio/hardened-ssh-to-24-validated-directives/index.json","markdown":"https://platform.engineer.company/ja/portfolio/hardened-ssh-to-24-validated-directives/index.md","pdf":"https://platform.engineer.company/ja/portfolio/hardened-ssh-to-24-validated-directives/index.pdf"},"kind":"page","language":"ja","title":"SSHの24設定項目を検証・堅牢化","url":"https://platform.engineer.company/ja/portfolio/hardened-ssh-to-24-validated-directives/","version":1}