From 972bbf69c5bfb81e1c9a09e2726cddc16613cac5 Mon Sep 17 00:00:00 2001 From: Remy Mudingay <remy.mudingay@esss.se> Date: Sat, 15 Jun 2019 12:42:23 +0200 Subject: [PATCH] simplified upstream server declaration and ability to disable filters --- README.md | 23 +++++++++++++---------- defaults/main.yml | 11 +++++++++-- templates/tinyproxy.conf | 12 +++++------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index cb9c7e0..72ad556 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,19 @@ tinyproxy_listen_address: [default: 0.0.0.0] tinyproxy_port: [default: 8888] #Define a list of urls (http) and domains (https) that clients can access (whitelist) -tinyproxy_urls: +tinyproxy_urls: [] + +#Enable upstream proxy +tinyproxy_upstream: false + +#Provide list of upstream proxies +tinyproxy_upstream_proxies: [] + - address: + port: + url: + +#Enable or disable URL Filtering rules +tinyproxy_filter: true #Setup Tinyproxy filtering rules tinyproxy_filtering: @@ -60,15 +72,6 @@ tinyproxy_filtering: default_deny: On case_sensitive: Off -#List of upstream proxies to use -tinyproxy_upstream_proxies: [default: []] - -#Address of upstream proxy in form host:port -tinyproxy_upstream_proxies.{n}.address: [required]: - -#Optional URLs for which we want to use upstream proxy for. -tinyproxy_upstream_proxies.{n}.url: [optional]: - ``` Example playbook diff --git a/defaults/main.yml b/defaults/main.yml index 5fdceee..b19c669 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -15,12 +15,19 @@ tinyproxy_listen_addresses: - 0.0.0.0 tinyproxy_port: 8888 -tinyproxy_upstream_proxies: [] - tinyproxy_connect_ports: [] tinyproxy_urls: [] +tinyproxy_upstream: false + +tinyproxy_upstream_proxies: + - address: proxy.com + port: 8080 + url: local.domain + +tinyproxy_filter: true + tinyproxy_filtering: filter: "/etc/tinyproxy/filter" urls: "On" diff --git a/templates/tinyproxy.conf b/templates/tinyproxy.conf index 2282cd4..1a720c3 100644 --- a/templates/tinyproxy.conf +++ b/templates/tinyproxy.conf @@ -37,7 +37,7 @@ Allow {{ subnet }} Deny {{ subnet }} {% endfor %} -{% if tinyproxy_filtering is defined %} +{% if tinyproxy_filter %} Filter "{{ tinyproxy_filtering.filter }}" FilterURLs {{ tinyproxy_filtering.urls }} FilterExtended {{ tinyproxy_filtering.extended }} @@ -45,12 +45,10 @@ FilterCaseSensitive {{ tinyproxy_filtering.case_sensitive }} FilterDefaultDeny {{ tinyproxy_filtering.default_deny }} {% endif %} -{% if tinyproxy_upstream_proxies is defined %} - {% for proxy in tinyproxy_upstream_proxies %} -Upstream {{ proxy.address }} {% if proxy.url is defined %} {{ proxy.url }} {% endif %} - - {% endfor %} - +{% if tinyproxy_upstream %} +{% for proxy in tinyproxy_upstream_proxies %} +Upstream {{ proxy.address }}:{{ proxy.port }} {% if proxy.url is defined %} "{{ proxy.url }}" {% endif %} +{% endfor %} {% endif %} ViaProxyName "tinyproxy" -- GitLab