@@ -106,10 +106,21 @@ def verify(ocserv):
106
106
if (
107
107
'local' in ocserv ['authentication' ]['mode' ]
108
108
and 'radius' in ocserv ['authentication' ]['mode' ]
109
+ or
110
+ 'local' in ocserv ['authentication' ]['mode' ]
111
+ and 'cert' in ocserv ['authentication' ]['mode' ]
112
+ or
113
+ 'radius' in ocserv ['authentication' ]['mode' ]
114
+ and 'cert' in ocserv ['authentication' ]['mode' ]
109
115
):
110
116
raise ConfigError (
111
- 'OpenConnect authentication modes are mutually-exclusive, remove either local or radius from your configuration '
117
+ 'OpenConnect authentication modes are mutually-exclusive. Only one of local, radius, or cert. '
112
118
)
119
+ if 'cert' in ocserv ['authentication' ]['mode' ]:
120
+ if 'cn' in ocserv ['authentication' ]['mode' ]['cert' ]:
121
+ ocserv ['authentication' ]['mode' ]['cert' ] = '2.5.4.3'
122
+ elif 'uid' in ocserv ['authentication' ]['mode' ]['cert' ]:
123
+ ocserv ['authentication' ]['mode' ]['cert' ] = '0.9.2342.19200300.100.1.1'
113
124
if 'radius' in ocserv ['authentication' ]['mode' ]:
114
125
if 'server' not in ocserv ['authentication' ]['radius' ]:
115
126
raise ConfigError (
@@ -202,6 +213,9 @@ def verify(ocserv):
202
213
raise ConfigError ('SSL certificate missing on OpenConnect config!' )
203
214
verify_pki_certificate (ocserv , ocserv ['ssl' ]['certificate' ])
204
215
216
+ if 'ca_certificate' not in ocserv ['ssl' ] and 'cert' in ocserv ['authentication' ]['mode' ]:
217
+ raise ConfigError ('CA certificate must be provided in certificate authentication mode!' )
218
+
205
219
if 'ca_certificate' in ocserv ['ssl' ]:
206
220
for ca_cert in ocserv ['ssl' ]['ca_certificate' ]:
207
221
verify_pki_ca_certificate (ocserv , ca_cert )
0 commit comments