Fedora42 で pdns-recursor が起動しなくなった話
Fedora42 にアップグレードを行うと、次のエラーで pdns-recursor が起動しなくなった。
# journalctl -xeu pdns-recursor.service
4月 16 13:05:30 kaga.magic-object.com [127752]: PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it according to the terms of the GPL version 2.
4月 16 13:05:30 kaga.magic-object.com [127752]: msg="Processing main YAML settings" subsystem="config" level="0" prio="Notice" tid="0" ts="1744776330.557" path="/etc/pdns-recursor/recursor.conf"
4月 16 13:05:30 kaga.magic-object.com [127752]: msg="YAML config found, but error occurred processing it" error="invalid type: string \"allow-from=127.0.0.0/8, 192.168.0.0/16, ::1/128\", expected struct Recursorsettings at line 18 column 1" subsystem="config" level="0" prio="Error>
4月 16 13:05:30 kaga.magic-object.com [127752]: msg="Trying to read YAML from .yml or .conf failed, failing back to old-style config read" subsystem="config" level="0" prio="Warning" tid="0" ts="1744776330.558" configname="/etc/pdns-recursor/recursor.conf"
4月 16 13:05:30 kaga.magic-object.com [127752]: msg="Old-style settings syntax not enabled by default anymore. Use YAML or enable with --enable-old-settings on the command line" subsystem="config" level="0" prio="Error" tid="0" ts="1744776330.558" configname="/etc/pdns-recursor/re>
色々と調べてみると設定ファイル「/etc/pdns-recursor/recursor.conf」が ver 5.1 では YAML 形式優先、 ver 5.2 では強制的に YAML 形式と判定されて読み込まれていた結果だった。
参考:PowerDNS Recursor New Style (YAML) Settings
Fedora42 では pdns-recursor は ver 5.2 にアップグレードされた状態だった。
# dnf list installed pdns-recursor
リポジトリの更新を読み込み中:
Adoptium 100% | 13.9 KiB/s | 8.2 KiB | 00m01s
リポジトリを読み込みました。
インストール済みパッケージ
pdns-recursor.x86_64 5.2.0-2.fc42 fedora
「/etc/pdns-recursor/recursor.conf」を YAML 形式に変換
# cd /etc/pdns-recursor/
# rec_control show-yaml recursor.conf > recursor.yml
# mv recursor.conf recursor.conf.old-style
参考: Conversion of old-style settings to YAML format
PowerDNS Recursor を再起動
# systemctl restart pdns-recursor
YAML 形式の「/etc/pdns-recursor/recursor.yml」
# Start of converted recursor.yml based on /etc/pdns-recursor/recursor.conf
dnssec:
validation: off
incoming:
allow_from:
- 127.0.0.0/8
- 192.168.0.0/16
- ::1/128
listen:
- 0.0.0.0
- '::'
logging:
loglevel: 9
recursor:
forward_zones:
- zone: magic-object.mydns.jp
recurse: false
forwarders:
- 127.0.0.1:10053
- zone: magic-object.com
recurse: false
forwarders:
- 127.0.0.1:10053
forward_zones_recurse:
- zone: .
recurse: true
forwarders:
- 8.8.8.8
security_poll_suffix: ''
setgid: pdns-recursor
setuid: pdns-recursor
# Validation result: OK
# End of converted /etc/pdns-recursor/recursor.conf
#
YAML の文法
- 「:」で終わる項目は辞書型を表し、「-」で始まる行はリスト項目を表します。
- 「#」はコメントを表します。
- シングルクォート「’」やダブルクォート「”」でエスケープする事が出来ます。
- エスケープされた文字列には「\n」などのエスケープシーケンスが利用できます。
参考:https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html