Skip to content

Commit

Permalink
fix(vpnsecure): allow empty OpenVPN user+password
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Sep 11, 2022
1 parent aa53436 commit 8f04a05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions internal/configuration/settings/openvpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,13 @@ func (o OpenVPN) validate(vpnProvider string) (err error) {
}

isCustom := vpnProvider == providers.Custom
isUserRequired := !isCustom && vpnProvider != providers.VPNSecure

if !isCustom && *o.User == "" {
if isUserRequired && *o.User == "" {
return ErrOpenVPNUserIsEmpty
}

passwordRequired := !isCustom &&
passwordRequired := isUserRequired &&
(vpnProvider != providers.Ivpn || !ivpnAccountID.MatchString(*o.User))

if passwordRequired && *o.Password == "" {
Expand Down
5 changes: 4 additions & 1 deletion internal/provider/utils/openvpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ func OpenVPNConfig(provider OpenVPNProviderSettings,
lines.add("suppress-timestamps") // do not log timestamps, the Gluetun logger takes care of it
lines.add("dev", settings.Interface)
lines.add("verb", fmt.Sprint(*settings.Verbosity))
lines.add("auth-user-pass", openvpn.AuthConf)
lines.add("proto", connection.Protocol)
lines.add("remote", connection.IP.String(), fmt.Sprint(connection.Port))

if *settings.User != "" {
lines.add("auth-user-pass", openvpn.AuthConf)
}

if !provider.AuthToken {
lines.add("pull-filter", "ignore", `"auth-token"`) // prevent auth failed loops
}
Expand Down

0 comments on commit 8f04a05

Please sign in to comment.