LoginSignup
5
0

More than 3 years have passed since last update.

「unbound.int.conf? HAHAHA そんなのあるわけ無いじゃんwwwww」

Last updated at Posted at 2020-12-02

はじめに

FreeBSD Advent Calendar 2020 の3日目の記事です。
Q:「どんな記事があるの」
A:「↑のリンクを踏んでみるといいよ!」

概要

みなさんは /etc/default/rc.conf や rc.d の中にあるスクリプトをざっくり読んで『ほほう、こういう設定の書き方もできるかー』と思って /etc/rc.conf に書いたことありませんか? きっとおすすめはしないでしょうけどこんなこと書いた自分はやりました、ハイ。
今回は local_unbound の FreeBSD 的設定をちょっと変えようと思って踏んづけてしまったネタです。ギャフン

つまるところどういうことだってばよ?

  • 『あなたこういう設定の書き方もできるのね!』(CV:坂本千夏さん)
  • よし、local_unbound の /etc/rc.conf に書ける設定をちょっと変えてみよう
  • 『unbound.int.conf? HAHAHA そんなのあるわけ無いじゃんwwwww』←イマココ

きっかけ

「unbound と local_unbound は(設定次第で)共存できるよ」とどこかで見かけた1ので今日までやってきてましたが「設定ファイルも出来る限り同じ場所のものを読めるようにしたい」と思ってやってみることにしました。
普通だったら「ここまでやらんでも・・・w」と思うところですがいつものように中の人の「面白そうだったので」精神が

[root@localhost ~]# vi /etc/rc.conf

…
local_unbound_enable="YES"
local_unbound_config="/etc/unbound/unbound.int.conf"
unbound_enable="YES"
unbound_config="/etc/unbound/unbound.ext.conf"
…

[root@localhost ~]# mv /etc/unbound/unbound.conf /etc/unbound/unbound.int.conf

上のように「ファイル名を置き換えて rc.conf にも設定ファイルの場所を指し示したしさぁ動かしてみよう」としたら

[root@localhost ~]# service local_unbound restart
Stopping local_unbound.
Waiting for PIDS: 61070.
Starting local_unbound.
Waiting for nameserver to start...[1605954873] unbound-control[61124:0] error: Could not open /var/unbound/unbound.conf: No such file or directory
[1605954873] unbound-control[61124:0] fatal error: could not read config file
.[1605954874] unbound-control[61127:0] error: Could not open /var/unbound/unbound.conf: No such file or directory
[1605954874] unbound-control[61127:0] fatal error: could not read config file
.[1605954875] unbound-control[61130:0] error: Could not open /var/unbound/unbound.conf: No such file or directory
[1605954875] unbound-control[61130:0] fatal error: could not read config file
.[1605954876] unbound-control[61133:0] error: Could not open /var/unbound/unbound.conf: No such file or directory
[1605954876] unbound-control[61133:0] fatal error: could not read config file
.[1605954877] unbound-control[61136:0] error: Could not open /var/unbound/unbound.conf: No such file or directory
[1605954877] unbound-control[61136:0] fatal error: could not read config file
 giving up
[root@localhost ~]# 

このように設定ファイルが見つからないと怒られました。

どうにかしてみた

[root@localhost rc.d]# diff local_unbound local_unbound.bak
103c103
<   until "${command}-control" ${local_unbound_flags} status | grep -q "is running" ; do
---
>   until "${command}-control" status | grep -q "is running" ; do

スクリプトを見ながら「なんであっちには flags が宣言されているのにこっちは記載がないんだろう・・・」と思って追記しました。

結果

[root@localhost ~]# service local_unbound restart
Stopping local_unbound.
Waiting for PIDS: 61465.
Starting local_unbound.
Waiting for nameserver to start... good
[root@localhost ~]# 

ヨシ!2

ぼやき

ちなみに FreeBSD のバージョンを上げるとまた元のファイルに戻ると思うのでどなたか英語でプレゼンして本家のリポジトリにマージくれたりしないですかねー(他力本願


  1. そのどこかのサイトのことが遠い記憶になって行方不明になって出てきませんでした。 

  2. 現場猫 - ニコ百 

5
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
0