A Golang-based HTTP proxy server that requires Google Apps authentication for access.
- HTTP/HTTPS proxy functionality
- Google OAuth2 authentication
- Session-based access control
- Automatic redirection to authentication for unauthenticated users
- Go 1.21 or later
- Google OAuth2 credentials (Client ID and Client Secret)
-
Clone the repository:
git clone <repository-url> cd enterprise-proxy-software
-
Install dependencies:
go mod tidy
-
Configure Google OAuth2:
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google+ API
- Create OAuth2 credentials (Web application)
- Set the redirect URI to your server URL +
/auth/callback(e.g.,https://your-domain.com/auth/callback)
-
Set up credentials (choose one method):
Method 1: Environment Variables
export GOOGLE_CLIENT_ID="your-client-id" export GOOGLE_CLIENT_SECRET="your-client-secret"
Method 2: CLI Arguments
./enterprise-proxy-software --client-id="your-client-id" --client-secret="your-client-secret"
-
Build and run:
go build -o enterprise-proxy-software ./src ./enterprise-proxy-software --server-url="https://your-domain.com"
The application supports the following command-line arguments:
--client-id: Google OAuth2 Client ID (can also be set viaGOOGLE_CLIENT_IDenv var)--client-secret: Google OAuth2 Client Secret (can also be set viaGOOGLE_CLIENT_SECRETenv var)--server-url: Server URL for OAuth redirect (default:http://localhost:8080)--port: Port to run the server on (default:8080)--version: Show version information--help: Show help information
# Run with CLI arguments
./enterprise-proxy-software \
--client-id="your-client-id" \
--client-secret="your-client-secret" \
--server-url="https://your-domain.com" \
--port="8080"
# Run with environment variables
export GOOGLE_CLIENT_ID="your-client-id"
export GOOGLE_CLIENT_SECRET="your-client-secret"
./enterprise-proxy-software --server-url="https://your-domain.com"
# Show version
./enterprise-proxy-software --version
# Show help
./enterprise-proxy-software --help- Docker and Docker Compose
-
Build the Docker image:
docker build -t enterprise-proxy . -
Run the container with environment variables:
docker run -p 8080:8080 \ -e GOOGLE_CLIENT_ID=your_client_id \ -e GOOGLE_CLIENT_SECRET=your_client_secret \ enterprise-proxy
-
Or run with CLI arguments:
docker run -p 8080:8080 enterprise-proxy \ --client-id="your_client_id" \ --client-secret="your_client_secret" \ --server-url="http://localhost:8080"
-
Create a
.envfile with your OAuth credentials:GOOGLE_CLIENT_ID=your_client_id GOOGLE_CLIENT_SECRET=your_client_secret SERVER_URL=http://localhost:8080 -
Start the services:
docker-compose up -d
-
Stop the services:
docker-compose down
Execute the Docker-based end-to-end tests:
cd tests/
bash test_docker.sh- Start the proxy server on port 8080
- Configure your browser to use
http://localhost:8080as proxy - Access any website - you'll be redirected to Google authentication
- After authentication, you can browse normally
This project uses GoReleaser for automated releases and versioning.
go build -o enterprise-proxy-software ./src-
Tag your release:
git tag v1.0.0 git push origin v1.0.0
-
GoReleaser will automatically create releases on GitHub with:
- Binaries for Linux, Windows, and macOS
- Version information embedded in the binary
- Changelog generation
The --version flag displays:
- Current version
- Git commit hash
- Build date
- Go version
- OS/Architecture
- Port: Configurable via
--portflag (default: 8080) - Server URL: Configurable via
--server-urlflag for OAuth redirects - Session Secret: Change the secret key in
main.gofor production - OAuth Credentials: Set via CLI args or environment variables
This project is licensed under the MIT License - see the LICENSE.txt file for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This is tasks automatization for xc
build the project into a dist folder
interactive: true
go mod tidy
go build -o dist/enterprise-proxy-software src/*.go
run the tests
interactive: true
cd tests/
bash run_e2e_tests.sh
run the docker-based tests
interactive: true
cd tests/
bash test_docker.sh
Deploys a new tag for the repo.
Specify major/minor/patch with VERSION
Env: PRERELEASE=0, VERSION=minor, FORCE_VERSION=0 Inputs: VERSION, PRERELEASE, FORCE_VERSION
# https://github.com/unegma/bash-functions/blob/main/update.sh
CURRENT_VERSION=`git describe --abbrev=0 --tags 2>/dev/null`
CURRENT_VERSION_PARTS=(${CURRENT_VERSION//./ })
VNUM1=${CURRENT_VERSION_PARTS[0]}
# remove v
VNUM1=${VNUM1:1}
VNUM2=${CURRENT_VERSION_PARTS[1]}
VNUM3=${CURRENT_VERSION_PARTS[2]}
if [[ $VERSION == 'major' ]]
then
VNUM1=$((VNUM1+1))
VNUM2=0
VNUM3=0
elif [[ $VERSION == 'minor' ]]
then
VNUM2=$((VNUM2+1))
VNUM3=0
elif [[ $VERSION == 'patch' ]]
then
VNUM3=$((VNUM3+1))
else
echo "Invalid version"
exit 1
fi
NEW_TAG="v$VNUM1.$VNUM2.$VNUM3"
# if command convco is available, use it to check the version
if command -v convco &> /dev/null
then
# if the version is a prerelease, add the prerelease tag
if [[ $PRERELEASE == '1' ]]
then
NEW_TAG=v$(convco version -b --prerelease)
else
NEW_TAG=v$(convco version -b)
fi
fi
# if $FORCE_VERSION is different to 0 then use it as the version
if [[ $FORCE_VERSION != '0' ]]
then
NEW_TAG=v$FORCE_VERSION
fi
echo Adding git tag with version ${NEW_TAG}
git tag ${NEW_TAG}
git push origin ${NEW_TAG}
Generate a changelog for the repo.
convco changelog > CHANGELOG.md
git add CHANGELOG.md
git commit -m "Update changelog"
git push
Releasing a new version into the repo.
goreleaser release --clean --skip sign
Releasing a new snapshot version into the repo.
goreleaser release --snapshot --skip sign --clean