Fix: only use and write auth file if user is set

- Apply to custom openvpn configuration without username
This commit is contained in:
Quentin McGaw (desktop)
2021-06-14 14:25:37 +00:00
parent c63ae3f3af
commit 582c6d1c43
2 changed files with 9 additions and 5 deletions

View File

@@ -80,7 +80,9 @@ func modifyCustomConfig(lines []string, username string,
modified = append(modified, "pull-filter ignore \"auth-token\"") // prevent auth failed loop
modified = append(modified, "auth-retry nointeract")
modified = append(modified, "suppress-timestamps")
modified = append(modified, "auth-user-pass "+constants.OpenVPNAuthConf)
if settings.User != "" {
modified = append(modified, "auth-user-pass "+constants.OpenVPNAuthConf)
}
modified = append(modified, "verb "+strconv.Itoa(settings.Verbosity))
if len(settings.Cipher) > 0 {
modified = append(modified, utils.CipherLines(settings.Cipher, settings.Version)...)