CentOS7.8のfirewalldでエラー「Invalid option: 'AllowZoneDrifting=yes'」を検知した時の対処手順メモ
前回の記事で、CentOS7.8の再起動時にfirewalldでエラーメッセージ「Invalid option: 'AllowZoneDrifting=yes'」を検知したと書きました。
今回はその対処手順を記載します。
CentOS7.8でfirewalldのエラー「Invalid option: 'AllowZoneDrifting=yes'」を検知したときの対処手順を紹介します
この記事を書いている私は、某SIerに勤務しながら、
WEB系エンジニア・インフラエンジニアに憧れて、プログラミングおよびインフラ技術の勉強をしています。
私が実機で試したコマンドや画像を載せて書いています。
記事の信頼性担保に繋がると思います。
前回の記事
検知したエラーメッセージ
以下のエラーメッセージを検知していました。
/var/log/messages
Jun 14 10:36:40 SV-SATURN firewalld[818]: ERROR: Invalid option: 'AllowZoneDrifting=yes' Jun 14 10:36:56 SV-SATURN firewalld[18652]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabling it now. Jun 14 10:44:40 SV-SATURN firewalld[788]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabling it now.
/var/log/firewalld
2020-06-14 10:36:40 ERROR: Invalid option: 'AllowZoneDrifting=yes' 2020-06-14 10:36:56 WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabling it now. 2020-06-14 10:44:40 WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabling it now.
「AllowZoneDrifting=yes」となっているので、それを無効化してください、ということのようです
現在のfirewalldの状態を確認
firewall-cmd --state
[root@SV-SATURN ~]# firewall-cmd --state running
firewall-cmd --list-all-zones
[root@SV-SATURN ~]# firewall-cmd --list-all-zones block target: %%REJECT%% icmp-block-inversion: no interfaces: sources: services: ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: dmz target: default icmp-block-inversion: no interfaces: sources: services: ssh ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: drop target: DROP icmp-block-inversion: no interfaces: sources: services: ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: external target: default icmp-block-inversion: no interfaces: sources: services: ssh ports: protocols: masquerade: yes forward-ports: source-ports: icmp-blocks: rich rules: home target: default icmp-block-inversion: no interfaces: sources: services: dhcpv6-client mdns samba-client ssh ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: internal target: default icmp-block-inversion: no interfaces: sources: services: dhcpv6-client mdns samba-client ssh ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: managerzone (active) target: ACCEPT icmp-block-inversion: no interfaces: sources: 192.168.1.101/24 services: ssh ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: public (active) target: default icmp-block-inversion: no interfaces: ens192 sources: services: dhcpv6-client ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: trusted target: ACCEPT icmp-block-inversion: no interfaces: sources: services: ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: work target: default icmp-block-inversion: no interfaces: sources: services: dhcpv6-client ssh ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: [root@SV-SATURN ~]#
設定ファイル「firewalld.conf」の確認
cat /etc/firewalld/firewalld.conf
[root@SV-SATURN ~]# cat /etc/firewalld/firewalld.conf # firewalld config file # default zone # The default zone used if an empty zone string is used. # Default: public DefaultZone=public # Minimal mark # Marks up to this minimum are free for use for example in the direct # interface. If more free marks are needed, increase the minimum # Default: 100 MinimalMark=100 # Clean up on exit # If set to no or false the firewall configuration will not get cleaned up # on exit or stop of firewalld # Default: yes CleanupOnExit=yes # Lockdown # If set to enabled, firewall changes with the D-Bus interface will be limited # to applications that are listed in the lockdown whitelist. # The lockdown whitelist file is lockdown-whitelist.xml # Default: no Lockdown=no # IPv6_rpfilter # Performs a reverse path filter test on a packet for IPv6. If a reply to the # packet would be sent via the same interface that the packet arrived on, the # packet will match and be accepted, otherwise dropped. # The rp_filter for IPv4 is controlled using sysctl. # Default: yes IPv6_rpfilter=yes # IndividualCalls # Do not use combined -restore calls, but individual calls. This increases the # time that is needed to apply changes and to start the daemon, but is good for # debugging. # Default: no IndividualCalls=no # LogDenied # Add logging rules right before reject and drop rules in the INPUT, FORWARD # and OUTPUT chains for the default rules and also final reject and drop rules # in zones. Possible values are: all, unicast, broadcast, multicast and off. # Default: off LogDenied=off # AutomaticHelpers # For the secure use of iptables and connection tracking helpers it is # recommended to turn AutomaticHelpers off. But this might have side effects on # other services using the netfilter helpers as the sysctl setting in # /proc/sys/net/netfilter/nf_conntrack_helper will be changed. # With the system setting, the default value set in the kernel or with sysctl # will be used. Possible values are: yes, no and system. # Default: system AutomaticHelpers=system # AllowZoneDrifting # Older versions of firewalld had undocumented behavior known as "zone # drifting". This allowed packets to ingress multiple zones - this is a # violation of zone based firewalls. However, some users rely on this behavior # to have a "catch-all" zone, e.g. the default zone. You can enable this if you # desire such behavior. It's disabled by default for security reasons. # Note: If "yes" packets will only drift from source based zones to interface # based zones (including the default zone). Packets never drift from interface # based zones to other interfaces based zones (including the default zone). # Possible values; "yes", "no". Defaults to "yes". AllowZoneDrifting=yes
最後の行に、AllowZoneDrifting=yes
とあるので、
ここを変更します。
参考サイト
「firewalld.conf」のバックアップ
cp -p /etc/firewalld/firewalld.conf /etc/firewalld/firewalld.conf.original_bk
[root@SV-SATURN ~]# cp -p /etc/firewalld/firewalld.conf /etc/firewalld/firewalld.conf.original_bk [root@SV-SATURN ~]# ls -l /etc/firewalld/firewalld.conf* -rw-r--r-- 1 root root 2706 4月 7 23:37 /etc/firewalld/firewalld.conf -rw-r--r-- 1 root root 2706 4月 7 23:37 /etc/firewalld/firewalld.conf.original_bk
「firewalld.conf」の編集
vi /etc/firewalld/firewalld.conf
# AllowZoneDrifting # Older versions of firewalld had undocumented behavior known as "zone # drifting". This allowed packets to ingress multiple zones - this is a # violation of zone based firewalls. However, some users rely on this behavior # to have a "catch-all" zone, e.g. the default zone. You can enable this if you # desire such behavior. It's disabled by default for security reasons. # Note: If "yes" packets will only drift from source based zones to interface # based zones (including the default zone). Packets never drift from interface # based zones to other interfaces based zones (including the default zone). # Possible values; "yes", "no". Defaults to "yes". AllowZoneDrifting=no
最後の行を、AllowZoneDrifting=no
に変更しました。
firewalldの再起動
systemctl restart firewalld
systemctl status firewalld
[root@SV-SATURN ~]# systemctl restart firewalld [root@SV-SATURN ~]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since 日 2020-06-14 12:58:52 JST; 7s ago Docs: man:firewalld(1) Main PID: 9380 (firewalld) CGroup: /system.slice/firewalld.service mq9380 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid 6月 14 12:58:52 SV-SATURN systemd[1]: Starting firewalld - dynamic firewall daemon... 6月 14 12:58:52 SV-SATURN systemd[1]: Started firewalld - dynamic firewall daemon.
インフラエンジニアになるための勉強のやり方
私は、某SIerに勤務しながら、WEB系エンジニア・インフラエンジニアに憧れて、プログラミングおよびインフラ技術の勉強をしています。
現在の会社で直接担当している業務の中では、決まった技術しか触れないけれど、
「他にも将来役に立ちそうなインフラ技術を勉強したい」「働きながらでもできる効率的なインフラエンジニアの勉強方法を知りたい」と考えている方のために、
①おすすめの書籍と、②おススメのオンライン学習サイトを紹介します。
働きながら勉強するための、おススメの書籍と、オンラインで学習できるサイトの紹介です。
インフラエンジニアの勉強ができるおススメ書籍
朝の通勤時や帰宅時の電車の中や、社外打合せへの移動中などに勉強するなら、やはり書籍が一番だと思います。
インフラエンジニアの教科書
LINE社に創業時から在籍しているインフラエンジニア・プロマネの「佐野裕」さんの本です。 twitter.com
膨大なトラフィックをさばくLINE社にて構築・保守を行っている現役エンジニアが記すITインフラの必須知識と経験の数々! サーバ、OS、ネットワーク機器、データセンター、購買と商談、障害対応、大規模インフラ、成長するために必要なスキルなど、基礎知識から実践まで言及。 ITインフラの世界が理解できる珠玉の1冊!
インフラエンジニアの教科書 (C&R研究所) 佐野裕 |
1週間でLPICの基礎が学べる本
Linuxの資格「LPIC」の試験対策を初心者向けに書いた入門書です。
Linuxの資格として広く知られているLPICですが、あまり知識の無いまま試験対策を始める人も多いのではないでしょうか。しかし、試験対策書は試験範囲についてのみ解説しているものが多く、初心者が理解するのは困難です。本書は、初心者がスムーズに試験対策を行えるよう、事前に基礎固めを行うLinux入門書です。試験情報や模擬問題も掲載しているので、資格取得を視野に入れた効率的な基礎学習が行えます。
1週間でLPICの基礎が学べる本 第3版 徹底攻略シリーズ (インプレス) 中島能和 |
インフラエンジニアの勉強ができるオンライン学習サイト
Udemy (オンライン動画学習サイト)
Udemy(ユーデミー)は、オンラインで動画で学習できるサービスです。
ITエンジニア系の講座もたくさん公開されています。
Udemyの特徴
- ユーザー登録すれば、第1回の講座は無料で視聴できる
- 無料のコンテンツもある
- 過去に受講した人の人数や、受講した人の評価も表示されるので選びやすい
以上、読んでいただきありがとうございました。