Disable IPv6 support in squid on machines with no IPv6
[chef.git] / cookbooks / squid / recipes / default.rb
index fe5077bcd68a45bbac842349f5fb020978cc5b77..e3faae46be9c2cf15ca9fbace7964a4e28d4cb67 100644 (file)
@@ -85,6 +85,10 @@ systemd_tmpfile "/var/run/squid" do
   mode "0755"
 end
 
+address_families = %w[AF_UNIX AF_INET]
+
+address_families << "AF_INET6" unless node.interfaces(:family => :inet6).empty?
+
 systemd_service "squid" do
   description "Squid caching proxy"
   after ["network.target", "nss-lookup.target"]
@@ -98,6 +102,7 @@ systemd_service "squid" do
   private_devices true
   protect_system "full"
   protect_home true
+  restrict_address_families address_families
   restart "on-failure"
   timeout_sec 0
 end