ベストプラクティス:SSHのiptablesファイアウォールルールの適用

ベストプラクティス:SSHのiptablesファイアウォールルールの適用

QA環境で使用する必要がありますiptables。リモートで変更する必要があります。一部の変更には、少数のSSHネットワークの無効化も含まれます。

SSH何らかの理由でサービスがブロックされた場合、ホストを再起動せずにアクセスを復元できるようにするためのベストプラクティスは何ですか?

私が計画しているいくつかの点は次のとおりです。

chkconfig iptables off 

これは、ホストを再起動する必要がないため、iptables起動が失敗するのを防ぐためです。

しかし、これはホストを再起動するときにホストを再起動せずに回復を可能にする何かを探しています。ところで、consoleサーバーでは機能しません。

どんな提案がありますか?

ベストアンサー1

それがiptables-apply目的です。 ~からマニュアルページ:

iptables-apply will  try  to  apply  a  new  rulesfile  (as  output  by
   iptables-save,  read by iptables-restore) or run a command to configure
   iptables and then prompt the user whether the changes are okay. If  the
   new  iptables  rules  cut the existing connection, the user will not be
   able to answer affirmatively. In this case, the script  rolls  back  to
   the previous working iptables rules after the timeout expires.

デフォルトのタイムアウトは10秒です。この時間が短すぎると、--timeout 3030秒後に確認が受信されない場合は、ルールをリセットするように変更できます。

おすすめ記事