{"id":27552983,"url":"https://github.com/w3labkr/sh-squid-proxy-installer","last_synced_at":"2026-04-30T13:34:13.222Z","repository":{"id":287198032,"uuid":"963897790","full_name":"w3labkr/sh-squid-proxy-installer","owner":"w3labkr","description":"Squid Proxy Installer is a simple script that sets up and configures a Squid proxy server on Ubuntu.","archived":false,"fork":false,"pushed_at":"2025-04-15T12:57:36.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T16:23:02.170Z","etag":null,"topics":["bash","proxy","sh","shell","squid"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/w3labkr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-10T11:32:29.000Z","updated_at":"2025-04-15T12:57:40.000Z","dependencies_parsed_at":"2025-04-12T11:35:54.858Z","dependency_job_id":null,"html_url":"https://github.com/w3labkr/sh-squid-proxy-installer","commit_stats":null,"previous_names":["w3labkr/sh-squid-proxy","w3labkr/sh-squid-proxy-installer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/w3labkr/sh-squid-proxy-installer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3labkr%2Fsh-squid-proxy-installer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3labkr%2Fsh-squid-proxy-installer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3labkr%2Fsh-squid-proxy-installer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3labkr%2Fsh-squid-proxy-installer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/w3labkr","download_url":"https://codeload.github.com/w3labkr/sh-squid-proxy-installer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/w3labkr%2Fsh-squid-proxy-installer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32466333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","proxy","sh","shell","squid"],"created_at":"2025-04-19T11:41:31.671Z","updated_at":"2026-04-30T13:34:13.193Z","avatar_url":"https://github.com/w3labkr.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Squid Proxy Installer\n\nThis project provides a script that automatically installs and configures a Squid proxy server on Ubuntu/Debian-based Linux systems. It supports username/password authentication, optional IP whitelisting, and HTTPS proxying via SSL-Bump. The script is production-ready and includes features for reliable and secure proxy operations.\n\n## Key Features\n\n- **Automated Installation:** Installs and configures Squid with authentication and SSL support.\n- **Customizable via Command-Line Flags:**\n  - `--port` / `-t`: Set HTTP proxy port (default: `3128`)\n  - `--https-port` / `-s`: Set HTTPS proxy port (default: `3129`)\n  - `--username` / `-u`: Set authentication username (default: `ghost`)\n  - `--password` / `-p`: Set authentication password (default: `123456`)\n  - `--whitelist` / `-w`: Comma-separated list of IPs that bypass authentication (default: `127.0.0.1`)\n- **Automatic Public IPv4 Detection:** Uses `curl -4 -s ifconfig.me` to display your server’s public IP.\n- **Log Management:** Uses logrotate to retain logs for 30 days.\n- **HTTP Header Stripping:** Improves anonymity by removing unnecessary HTTP headers.\n- **Automatic Service Recovery:** A cron job monitors and restarts Squid if it stops.\n- **HTTPS Proxy Support:** Generates a self-signed certificate and enables SSL proxying.\n\n## System Requirements\n\n- Ubuntu 20.04 / 22.04 / 24.04 or Debian-based system\n- Public IPv4 address (e.g., VPS or cloud instance)\n- Sudo privileges\n\n## Installation\n\n```bash\nsudo apt update \u0026\u0026 sudo apt install -y git\ngit clone https://github.com/w3labkr/sh-squid-proxy-installer.git\ncd sh-squid-proxy-installer\nchmod +x install.sh\n```\n\n## Usage\n\nYou can customize the installation using command-line options. If no options are provided, default values are used.\n\n### Command-Line Options\n\n| Option (long/short) | Description                                 | Default      |\n|---------------------|---------------------------------------------|--------------|\n| --port, -t          | HTTP proxy port                             | 3128         |\n| --https-port, -s    | HTTPS proxy port                            | 3129         |\n| --username, -u      | Authentication username                     | ghost        |\n| --password, -p      | Authentication password                     | 123456       |\n| --whitelist, -w     | Comma-separated list of IPs to whitelist    | 127.0.0.1    |\n\n**Example:**\n\n```bash\n./install.sh --port 3128 --https-port 3129 --username ghost --password '123456' --whitelist \"127.0.0.1,192.168.1.100\"\n# or\n./install.sh -t 3128 -s 3129 -u ghost -p '123456' -w \"127.0.0.1,192.168.1.100\"\n```\n\nDuring execution, the script automatically detects your server’s public IPv4 address and displays proxy connection details.\n\n## Post-Installation Configuration\n\nYou can update authentication details, modify the whitelist IPs, or change the proxy ports at any time.\n\n### Update Username / Password\n\n**To add a new user:**\n\n```bash\nsudo htpasswd /etc/squid/passwd newuser\n```\n\n**To change an existing user's password:**\n\n```bash\nsudo htpasswd /etc/squid/passwd ghost\n```\n\n*Changes are applied immediately without the need to restart Squid.*\n\n### Modify Whitelisted IPs\n\nEdit `/etc/squid/squid.conf` and update the `acl whitelist_ip src ...` line.  \nList multiple IPs as a space-separated list (as generated by the script):\n\n```conf\nacl whitelist_ip src 127.0.0.1 123.123.123.123 45.67.89.101\n```\n\nRestart Squid to apply changes:\n\n```bash\nsudo systemctl restart squid\n```\n\n### Change the Proxy Port\n\nEdit the following lines in `/etc/squid/squid.conf`:\n\n```conf\nhttp_port 3128\nhttps_port 3129 cert=/etc/squid/ssl_cert/squid.crt key=/etc/squid/ssl_cert/squid.key\n```\n\nRestart Squid:\n\n```bash\nsudo systemctl restart squid\n```\n\n## Example Usage\n\nUsing cURL\n\n```bash\ncurl -x http://ghost:123456@\u003cproxy_server_ip\u003e:3128 http://ipinfo.io\ncurl -k -x https://ghost:123456@\u003cproxy_server_ip\u003e:3129 https://ipinfo.io\n```\n\nUsing Python requests\n\n```python\nimport requests\n\nproxies = {\n    \"http\": \"http://ghost:123456@\u003cproxy_server_ip\u003e:3128\",\n    \"https\": \"https://ghost:123456@\u003cproxy_server_ip\u003e:3129\"\n}\n\nresponse = requests.get(\"http://ipinfo.io\", proxies=proxies)\nprint(response.text)\n```\n\n## Additional Information\n\n- **Log Management:** Log files are rotated and retained for 30 days via logrotate.\n- **Service Recovery:** A cron job checks Squid every 30 minutes and restarts it if needed.\n- **HTTPS Proxy Support:** The script sets up a self-signed certificate for SSL-Bump and enables a secure HTTPS proxy port.\n- **Public IP Auto-Detection:** The script retrieves your server’s public IPv4 address with `curl -4 -s ifconfig.me`.\n- **Script Exit:** The script ends with `exit 0` to indicate successful execution.\n\n## Auto Setup with Startup Script\n\nYou can use the following startup script on cloud platforms to automate installation:\n\n```bash\n#!/bin/bash\n\nsudo apt update \u0026\u0026 sudo apt install -y git\ncd /root || exit\ngit clone https://github.com/w3labkr/sh-squid-proxy-installer.git\ncd sh-squid-proxy-installer || exit\nchmod +x install.sh\n./install.sh -t 3128 -s 3129 -u ghost -p '123456' -w \"127.0.0.1\"\n```\n\nTest the Proxy Server\n\n```bash\ncurl -x http://ghost:123456@\u003cproxy_server_ip\u003e:3128 http://ipinfo.io\ncurl -k -x https://ghost:123456@\u003cproxy_server_ip\u003e:3129 https://ipinfo.io\n```\n\n## Troubleshooting\n\n- **Only Ubuntu/Debian Supported:** The script checks for `apt` and will exit if not found.\n- **Firewall:** Ensure your firewall allows inbound connections on the chosen proxy ports.\n- **Certificate Warnings:** The HTTPS proxy uses a self-signed certificate. Use `-k` with curl or configure your client to trust the certificate if needed.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).  \nFeel free to use and modify the script as needed.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw3labkr%2Fsh-squid-proxy-installer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fw3labkr%2Fsh-squid-proxy-installer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fw3labkr%2Fsh-squid-proxy-installer/lists"}