mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-09 20:29:23 +02:00
fix(openvpn): bundle provider CA certificates in one block (#3258)
This commit is contained in:
@@ -175,8 +175,8 @@ func OpenVPNConfig(provider OpenVPNProviderSettings,
|
||||
lines.add("setenv", envKey, envValue)
|
||||
}
|
||||
|
||||
for _, ca := range provider.CAs {
|
||||
lines.addLines(WrapOpenvpnCA(ca))
|
||||
if len(provider.CAs) > 0 {
|
||||
lines.addLines(WrapOpenvpnCAs(provider.CAs))
|
||||
}
|
||||
if provider.CRLVerify != "" {
|
||||
lines.addLines(WrapOpenvpnCRLVerify(provider.CRLVerify))
|
||||
@@ -268,13 +268,20 @@ func defaultStringSlice(value, defaultValue []string) (
|
||||
}
|
||||
|
||||
func WrapOpenvpnCA(certificate string) (lines []string) {
|
||||
return []string{
|
||||
"<ca>",
|
||||
"-----BEGIN CERTIFICATE-----",
|
||||
certificate,
|
||||
"-----END CERTIFICATE-----",
|
||||
"</ca>",
|
||||
return WrapOpenvpnCAs([]string{certificate})
|
||||
}
|
||||
|
||||
func WrapOpenvpnCAs(certificates []string) (lines []string) {
|
||||
lines = append(lines, "<ca>")
|
||||
for _, certificate := range certificates {
|
||||
lines = append(lines,
|
||||
"-----BEGIN CERTIFICATE-----",
|
||||
certificate,
|
||||
"-----END CERTIFICATE-----",
|
||||
)
|
||||
}
|
||||
lines = append(lines, "</ca>")
|
||||
return lines
|
||||
}
|
||||
|
||||
func WrapOpenvpnCert(clientCertificate string) (lines []string) {
|
||||
|
||||
Reference in New Issue
Block a user