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

Fix Proxy requiring Authentication usage #137

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lenaing
Copy link

@lenaing lenaing commented Mar 8, 2023

Hello there,

This PR intends to fix proxy requiring authentication usage and wrong documentation about it.

I could not find a way to use proxy requiring an authentication with preemptive authentication enabled, even in a simple out-of-this-PR context.

Java is not my main language so there may be a more elegant / efficient way to fix this issue.

Kind regards,

Tested against both authenticated and unauthenticaded Squid

mysquid.conf

auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwords
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 24 hours
auth_param basic casesensitive off
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_access deny all
dns_v4_first on
forwarded_for delete
via off
http_port 3128

Running the Squids

docker run -e TZ=UTC -p 3129:3128 ubuntu/squid:5.2-22.04_beta
docker run -e TZ=UTC -v /path/to/mysquid.conf:/etc/squid/squid.conf -v /path/to/mysquidpasswords:/etc/squid/passwords -p 3128:3128 ubuntu/squid:5.2-22.04_beta

Tests

pipeline {
    agent any

    stages {
        stage('Test') {
            steps {
                // No proxy
                httpRequest url: 'https://httpbin.org/'
                httpRequest url: 'https://httpbin.org/basic-auth/user/passwd', authentication: 'httpbin'
                // Proxy without authentication
                httpRequest url: 'https://httpbin.org/', httpProxy: 'http://127.0.0.1:3129'
                httpRequest url: 'https://httpbin.org/basic-auth/user/passwd', authentication: 'httpbin', httpProxy: 'http://127.0.0.1:3129'
                // Proxy with authentication
                httpRequest url: 'https://httpbin.org/', httpProxy: 'http://127.0.0.1:3128',  proxyAuthentication: 'proxy-auth'
                httpRequest url: 'https://httpbin.org/basic-auth/user/passwd', authentication: 'httpbin', httpProxy: 'http://127.0.0.1:3128',  proxyAuthentication: 'proxy-auth'
            }
        }
    }
}

@lenaing lenaing requested a review from a team as a code owner March 8, 2023 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant