IBM Support

QRadar: iptables 事象のトラブルシューティング

Troubleshooting


Problem

 iptables および ip6tables サービスのエラーは、管理対象ホストの追加、アプリケーションが開始しない、あるいは予期された動作が行われない、変更のデプロイのタイムアウト、プリテスト実行後にパッチの失敗といった事象を引き起こす可能性があります。
この技術情報では、QRadar® での iptables サービスの一般的な事象の特定および解決する手順をご案内します。

Symptom

症状は iptables サービスが呼び出されるプロセスによって異なります。一般的な症状は次のとおりです:
  • xtables.lock が存在する。
    注: このファイルは他のサービスを妨げる可能性がありますが、メッセージは同じです。
iptables.init[28455]: Another app is currently holding the xtables lock; still 1s 0us time ahead to have a chance to grab the lock...
iptables.init[28455]: Another app is currently holding the xtables lock. Perhaps you want to use the -w option?
iptables.init[28455]: [FAILED]
systemd[1]: iptables.service: main process exited, code=exited, status=1/FAILURE
  • iptables ファイル内の構文が正しくない。
Job for iptables.service failed because the control process exited with error code. See "systemctl status iptables.service" and "journalctl -xe" for details.

iptables.init[17589]: iptables: Applying firewall rules: iptables-restore: line 114 failed
iptables.init[17589]: [FAILED]
  • QRadar® パッチがエラーを報告する。
 [INFO](testmode) Running pretest 10/11: Check for invalid iptables rules
Unexpected error occurred while running /opt/qradar/bin/iptables_update.pl.
[ERROR](testmode) Patch pretest 'Check for invalid iptables rules' failed. (check_iptables_rules.sh)
[ERROR](testmode) Failed 1/11 pretests. Aborting the patch.
[ERROR](testmode) Failed pretests
[ERROR](testmode) Pre Patch Testing shows a configuration issue. Patching this host cannot continue.

Cause

 iptables サービスが失敗した状態となり、サービスを開始できません。iptables が開始しない最も一般的な原因は次のとおりです:
  1. xtables.lock が他のアプリケーションまたはサービスによって解除されなかった。 
  2. いずれかの iptables ファイル内の構文が正しくない。
  3. いずれかの iptables ファイル内で誤字脱字がある。
  4. いずれかの iptables ファイル内で空スペースなどの間違った文字がある。

Environment

QRadar® 7.3 と 7.4 の全バージョン

Diagnosing The Problem

 xtables.lock が他のアプリケーションまたはサービスによって解除されなかった。
この原因を診断するには、管理者は xtables.lock ファイルで報告された日付をチェックする必要があります。日付がオペレーティング・システムの実際の時刻と異なる場合、その日付は余分なファイルと見なされるため、削除する必要があります。
  1. xtables.lock の日付を確認してください。
     
    ls -l /run/xtables.lock
    -rw-------  1 root     root         0 Feb 19 02:49 xtables.lock
  2. OS 時刻に対して時刻を検証してください。
     
    date
    Tue May 18 18:47:58 EDT 2021
いずれかの iptables ファイル内に不正な構文、誤字脱字、および空白文字がある。
この原因を診断するには、管理者は不正な構文、誤字脱字、または空白文字が事象の原因であるかどうかを判別するため、エラーがあったことが報告された行をチェックする必要があります。
  1. サービスの更新およびサービスをメモしてください。
     
    /opt/qradar/bin/iptables_update.pl
    
    ERROR: There was an issue reloading iptables. Check /var/log/qradar-iptables.log for details.
  2. iptables サービスまたは ip6tables サービスのジャーナル・ログを確認し、競合する行をメモしてください。
     
    For IPv4 iptables service:
    journalctl -xu iptables -n 10 --no-pager
    
    For IPv6 iptables service
    journalctl -xu ip6tables -n 10 --no-pager
    
    Error message:
    iptables: Trying to reload firewall rules: iptables-restore: line 114 failed
    
  3. 行とその行が構成されているファイルを識別します。
     
    For IPv4 iptables service:
    cat -An /etc/sysconfig/iptables | grep -E 'From file|End file|<line number>' | grep <line number> -C 1
    
    For IPv6 iptables service:
    cat -An /etc/sysconfig/ip6tables | grep -E 'From file|End file|<line number>' | grep <line number> -C 1
例:
読みやすくするため、以下の例は /etc/sysconfig/iptables に対して実行します。管理者は /etc/sysconfig/ip6tables ファイル内で事象が発生した時に、類似する出力内容を確認できます。
競合する行が /opt/qradar/conf/iptables.post ファイルに構成されていることを示している 114 行目の誤字脱字( INPUT でなく IMPUT になっている)
 cat -An /etc/sysconfig/iptables | grep -E 'From file|End file|114' | grep 114 -C 1
   105  ### From file /opt/qradar/conf/iptables.post$
   114  -A IMPUT -p udp --dport 8001 -j REJECT$
   117  ### End file /opt/qradar/conf/iptables.post$
競合する行が /opt/qradar/conf/iptables.post ファイルに構成されていることを示している 117 行目の不正な文字( ^I )
cat -An /etc/sysconfig/iptables | grep -E 'From file|End file|117' | grep 117 -C 1
   105  ### From file /opt/qradar/conf/iptables.post$
   117  ^I $
   119  ### End file /opt/qradar/conf/iptables.post$
競合する行が /opt/qradar/conf/iptables.post ファイルに構成されていることを示している 116 行目の不正な形式( EOF が失われている)
cat -An /etc/sysconfig/ip6tables | grep -E 'From file|End file|116' | grep 116 -C 1 
   105  ### From file /opt/qradar/conf/iptables.post$
   116  -A OUTPUT -p udp --dport 8001 -j REJECT# END /opt/qradar/conf/iptables.post FILE$
   117  ### End file /opt/qradar/conf/iptables.post$

Resolving The Problem

原因に応じて、管理者は各々の修正アクションを実行する必要があります:

  1. xtables.lock が他のアプリケーションまたはサービスによって解放されなかった。
    1. xtables.lock の日付が実際の時刻と異なる場合、ファイルに影響を与えずに削除することができます。
       
      rm -fv /run/xtables.lock
    2. iptables および ip6tables サービスを再ロードするため、/opt/qradar/bin/iptables_update.pl スクリプトを実行します。
       
      /opt/qradar/bin/iptables_update.pl
  2. いずれかの iptables ファイル内に不正な構文および誤字脱字がある。

    注:
    以下のステップでは、例としてファイル /opt/qradar/conf/iptables.pre の 1 行目が使用されています。管理者は該当する環境のバックアップを行う必要があります。
    1. 管理者は Linux man ページで適切な構文を参照します。
      1. IPv4 iptables サービス
      2. IPv6 iptables サービス
         
    2. 既存のファイルをバックアップします。
       
      mkdir -p /store/IBM_Support/
      cp -fv /path/to/conflicting/file /store/IBM_Support/
      
      Example:
      cp -fv /opt/qradar/conf/iptables.pre /store/IBM_Support/
    3. ファイルを編集して、誤字脱字を修正してください。
       
      vi /opt/qradar/conf/iptables.pre
    4. iptables および ip6tables サービスを再ロードするため、/opt/qradar/bin/iptables_update.pl スクリプトを実行します。
       
      /opt/qradar/bin/iptables_update.pl
  3. いずれかの iptables ファイル内に不正な文字がある。

    ファイルから競合する行を削除する必要があります。

    注: 以下のステップでは、例としてファイル /opt/qradar/conf/iptables.pre の 1 行目が使用されています。管理者は該当する環境のバックアップを行う必要があります。
    1. 既存のファイルをバックアップします。
       
      mkdir -p /store/IBM_Support/
      cp -fv /path/to/conflicting/file /store/IBM_Support/
      
      Example:
      cp -fv /opt/qradar/conf/iptables.pre /store/IBM_Support/
    2. 競合するファイル内の行を確認してください。
       
      cat -An /opt/qradar/conf/iptables.pre
           1  ^I $
      
    3. ファイル内の行を削除します。
       
      sed -i '1d' /opt/qradar/conf/iptables.pre
    4. iptables および ip6tables サービスを再ロードするため、/opt/qradar/bin/iptables_update.pl スクリプトを実行します。
       
      /opt/qradar/bin/iptables_update.pl
結果:
iptables および ip6tables サービスは、iptables_update.pl スクリプトの実行後にエラーが報告されることなく開始します。
 
>>> Shutting down existing firewall...
/tmp/iptables.3898
/tmp/ip6tables.3898
>>> Beginning update...
 Writing out rules for web access...
>>> IPTables update complete. Reloading firewall...
>>> Done!
>>> IP6Tables update complete. Reloading firewall...
>>> Done!
Finished starting ipv6
Done iptables update.
iptables および ip6tables サービスが開始しない事象が発生し続ける場合は、QRadar サポートへご連絡ください。

Document Location

Worldwide

[{"Type":"SW","Line of Business":{"code":"LOB24","label":"Security Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSBQAC","label":"IBM Security QRadar SIEM"},"ARM Category":[{"code":"a8m0z000000cwtNAAQ","label":"Deployment"}],"ARM Case Number":"","Platform":[{"code":"PF016","label":"Linux"}],"Version":"All Version(s)"}]

Document Information

Modified date:
13 August 2021

UID

ibm16469693