Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for authenticated proxies #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,30 @@ class { '::squid3':
}
```

Password protected proxy (basic authentication):
```puppet
class { "::squid3":
template => "short",
auth_required => true,
config => {
"auth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/squid.passwd",
"auth_param basic realm proxy",
"acl authenticated proxy_auth REQUIRED",
"http_access allow authenticated",
"http_access deny all",
}
}

file { "/etc/squid/squid.passwd":
ensure => file,
source => "puppet:///modules/profiles/squid.passwd",
owner => "root",
group => "squid",
mode => "0640",
notify => Service["squid"],
}
```
Here, we have installed the password file we built with `htpasswd` to the squid
directory and have updated squid to use it with the `ncsa_auth` program (this
is a centos box). The `auth_required` attribute disables the rules allowing
`localnet` access in squid.conf.
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
$config_hash = {},
$refresh_patterns = [],
$template = 'long',
$auth_required = false,
) inherits ::squid3::params {

$use_template = $template ? {
Expand Down
2 changes: 2 additions & 0 deletions templates/squid.conf.long.erb
Original file line number Diff line number Diff line change
Expand Up @@ -789,11 +789,13 @@ http_access <%= line %>
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
<% if not @auth_required -%>
http_access allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all
<% end %>

# TAG: adapted_http_access
# Allowing or Denying access based on defined access lists
Expand Down
2 changes: 2 additions & 0 deletions templates/squid.conf.short.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ acl <%= line %>
<% @http_access.each do |line| -%>
http_access <%= line %>
<% end -%>
<% if not @auth_required -%>
http_access allow localnet
http_access allow localhost
http_access deny all
<% end -%>

# user-defined icp_access
<% @icp_access.each do |line| -%>
Expand Down