RaspAPのメモ

RaspAP 2.8.6

 

Ad blocking

Ad blocking is enabled and active for clients connected to your AP.

なのだが、イマイチ適用されてない気がするので設定を確認してみる。

 

Manual installationのAd blockingを見てみると、

sudo cp /tmp/hostnames.txt /etc/raspap/adblock

sudo cp /tmp/domains.txt /etc/raspap/adblock

と書いているので、/etc/raspap/adblock/を見てみると、ちゃんとhostnames.txtとdomains.txtはある。

 

RaspAPのAd Blocking管理画面に、

This option adds conf-file and addn-hosts to the dnsmasq configuration.

と書いてあるので、/etc/dnsmasq.confを見てみるが、どうもそれらしい記述がないので、

conf-file=/etc/raspap/adblock/domains.txt

addn-hosts=/etc/raspap/adblock/hostnames.txt

を書き足しておく。

 

でまあ、FAQを参照すると、

Can I automatically update RaspAP's adblock lists?

In a typical setup, you may use the Ad blocking management page to manually update these lists. Alternatively, this user-contributed script will automatically fetch the latest blocklists on the schedule of your choosing (for example, daily, weekly, etc.) and reload dnsmasq. Credit to DanielLester83.

とのことなので、自動化するのに

Automated Adblock Updates

を使わせてもらって少し修正、crontab -e。

  • # sleep $(shuf -i 0-3600 -n1) #0-3600の範囲からシャッフルした1つめを取り出して待機はしなくてよいかな
  • service dnsmasq reload > /bin/systemctl restart dnsmasq #serviceとsystemctlには違いがあるのだろうが、systemctlを使うようにしている

 

ところでRaspAPのad blockingはdnsmasqのホストベース、ドメインベースの機能と分かった。であるならば、自動化してしまうとRaspAPでやる必要は必ずしもない訳で、他もそうならいっそのことと、

How do I uninstall RaspAP?

cd /var/www/html

sudo installers/uninstall.sh

途中systemctl disableができないとエラーが出たが、すでに止めてあるのでshから#してdone