Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Allow passing auth file to authenticate with OpenVPN server #28

Merged
merged 1 commit into from
Jun 10, 2021
Merged

Allow passing auth file to authenticate with OpenVPN server #28

merged 1 commit into from
Jun 10, 2021

Conversation

Toanzzz
Copy link
Contributor

@Toanzzz Toanzzz commented Jun 6, 2021

Summary

This will allow usage with private VPN that required authentication by setting OPENVPN_AUTH_SECRET environment variable. It's value should match the name of the secret (NOT the file used by the secret)

The secret should point to a text file with username & password in separate line, as in the official docs:

--auth-user-pass [up]

Authenticate with server using username/password. upis a file containing username/password on 2 lines (Note: OpenVPN will only read passwords from a file if it has been built with the --enable-password-save configure option, or on Windows by defining ENABLE_PASSWORD_SAVE in config-win32.h).If up is omitted, username/password will be prompted from the console.

Example Usage

services:
  vpn:
    image: ghcr.io/wfg/openvpn-client
    cap_add: [NET_ADMIN]
    devices: [/dev/net/tun]
    environment:
      - HTTP_PROXY=on
      - SOCKS_PROXY=on
      - OPENVPN_AUTH_SECRET=ovpn_auth
    volumes: [~/local/vpn:/data/vpn]
    ports: ["1080:1080", "8080:8080"]
    secrets: [ovpn_auth]

secrets:
  ovpn_auth: { file: ./secrets/auth.txt }

TODO

  • Allow passing OPENVPN_USERNAME & OPENVPN_PASSWORD instead (maybe?)
  • Update docs

@wfg
Copy link
Owner

wfg commented Jun 6, 2021

@Toanzzz thanks, this looks good to me!

It looks like it would work without the OPENVPN_AUTH_SECRET variable, but have you tested it to be sure?

@Toanzzz
Copy link
Contributor Author

Toanzzz commented Jun 10, 2021

Yes I did test it myself, and it run just fine without that variable.

(Sorry for the late reply)

@wfg
Copy link
Owner

wfg commented Jun 10, 2021

Awesome! Thanks for the PR.

@wfg wfg merged commit 78637fc into wfg:master Jun 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants