@@ -27,6 +27,8 @@ type providerCredentials struct {
2727type openvpnCredentials struct {
2828 Username string
2929 Password string
30+ Key string
31+ Cert string
3032}
3133
3234type wireguardCredentials struct {
@@ -76,10 +78,12 @@ func validateCredentials(providerNameToCredentials map[string]providerCredential
7678
7779func validateOpenvpnCredentials (provider string , creds * openvpnCredentials ) error {
7880 switch {
79- case creds .Username == "" :
81+ case creds .Username == "" && creds . Password != "" :
8082 return fmt .Errorf ("provider %q openvpn credentials are missing the username" , provider )
81- case creds .Password == "" :
83+ case creds .Password == "" && creds . Username != "" :
8284 return fmt .Errorf ("provider %q openvpn credentials are missing the password" , provider )
85+ case creds .Username == "" && creds .Password == "" && creds .Key == "" && creds .Cert == "" :
86+ return fmt .Errorf ("provider %q openvpn credentials are missing the username and password" , provider )
8387 }
8488 return nil
8589}
@@ -147,6 +151,8 @@ func buildOpenvpnEnv(creds *openvpnCredentials) []string {
147151 return []string {
148152 "OPENVPN_USER=" + creds .Username ,
149153 "OPENVPN_PASSWORD=" + creds .Password ,
154+ "OPENVPN_KEY=" + creds .Key ,
155+ "OPENVPN_CERT=" + creds .Cert ,
150156 }
151157}
152158
@@ -220,6 +226,11 @@ func formatCredentialForDump(provider, vpnType string,
220226 builder .WriteString ("\n " )
221227 builder .WriteString ("password: " )
222228 builder .WriteString (providerCredentials .OpenVPN .Password )
229+ builder .WriteString ("\n key: " )
230+ builder .WriteString (providerCredentials .OpenVPN .Key )
231+ builder .WriteString ("\n cert: " )
232+ builder .WriteString (providerCredentials .OpenVPN .Cert )
233+ builder .WriteString ("\n " )
223234 case vpnTypeWireGuard :
224235 if providerCredentials .WireGuard == nil {
225236 return "" , fmt .Errorf ("no wireguard credentials found for provider %q" , provider )
0 commit comments