@@ -106,10 +106,21 @@ def verify(ocserv):
106106            if  (
107107                'local'  in  ocserv ['authentication' ]['mode' ]
108108                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' ]
109115            ):
110116                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. ' 
112118                )
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' 
113124            if  'radius'  in  ocserv ['authentication' ]['mode' ]:
114125                if  'server'  not  in ocserv ['authentication' ]['radius' ]:
115126                    raise  ConfigError (
@@ -202,6 +213,9 @@ def verify(ocserv):
202213        raise  ConfigError ('SSL certificate missing on OpenConnect config!' )
203214    verify_pki_certificate (ocserv , ocserv ['ssl' ]['certificate' ])
204215
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+ 
205219    if  'ca_certificate'  in  ocserv ['ssl' ]:
206220        for  ca_cert  in  ocserv ['ssl' ]['ca_certificate' ]:
207221            verify_pki_ca_certificate (ocserv , ca_cert )
0 commit comments