diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml b/src/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml index f682733b5..a21b0fc0c 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml +++ b/src/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml @@ -160,6 +160,18 @@ true + + proxy.general.cache.local.cache_linux_packages + + checkbox + Enable or disable the caching of packages for linux distributions. This makes sense if you have multiple servers in your network and do not host your own package mirror. This will reduce internet traffic usage but increase disk access. + + + proxy.general.cache.local.cache_windows_updates + + checkbox + Enable or disable the caching of Windows updates. This makes sense if you don't have a WSUS server. If you can setup a WSUS server, this solution should be preferred. + diff --git a/src/opnsense/mvc/app/models/OPNsense/Proxy/Proxy.xml b/src/opnsense/mvc/app/models/OPNsense/Proxy/Proxy.xml index e8ce176e4..b7a02a61b 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Proxy/Proxy.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Proxy/Proxy.xml @@ -128,6 +128,14 @@ Specify a positive number of second-level subdirectories. Y + + 0 + Y + + + 0 + Y + @@ -204,8 +212,8 @@ Y - 0 - Y + 0 + Y N diff --git a/src/opnsense/service/templates/OPNsense/Proxy/squid.conf b/src/opnsense/service/templates/OPNsense/Proxy/squid.conf index 4b7096518..bdb47914c 100644 --- a/src/opnsense/service/templates/OPNsense/Proxy/squid.conf +++ b/src/opnsense/service/templates/OPNsense/Proxy/squid.conf @@ -311,6 +311,25 @@ coredump_dir /var/squid/cache # # Add any of your own refresh_pattern entries above these. # + +{% if helpers.exists('OPNsense.proxy.general.cache.local.cache_linux_packages') and OPNsense.proxy.general.cache.local.cache_linux_packages == '1' %} +# Linux package cache: +refresh_pattern pkg\.tar\.xz$ 0 20% 4320 refresh-ims +refresh_pattern d?rpm$ 0 20% 4320 refresh-ims +refresh_pattern deb$ 0 20% 4320 refresh-ims +refresh_pattern udeb$ 0 20% 4320 refresh-ims +refresh_pattern Packages\.bz2$ 0 20% 4320 refresh-ims +refresh_pattern Sources\.bz2$ 0 20% 4320 refresh-ims +refresh_pattern Release\.gpg$ 0 20% 4320 refresh-ims +refresh_pattern Release$ 0 20% 4320 refresh-ims +{% endif %} +{% if helpers.exists('OPNsense.proxy.general.cache.local.cache_windows_updates') and OPNsense.proxy.general.cache.local.cache_windows_updates == '1' %} +# http://wiki.squid-cache.org/SquidFaq/WindowsUpdate +refresh_pattern -i microsoft.com/.*\.(cab|exe|ms[i|u|f]|[ap]sf|wm[v|a]|dat|zip) 4320 80% 129600 reload-into-ims +refresh_pattern -i windowsupdate.com/.*\.(cab|exe|ms[i|u|f]|[ap]sf|wm[v|a]|dat|zip) 4320 80% 129600 reload-into-ims +refresh_pattern -i windows.com/.*\.(cab|exe|ms[i|u|f]|[ap]sf|wm[v|a]|dat|zip) 4320 80% 129600 reload-into-ims +{% endif %} + refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0