@@ -89,6 +89,7 @@ struct WOLFSSHD_CONFIG {
8989 byte permitRootLogin :1 ;
9090 byte permitEmptyPasswords :1 ;
9191 byte authKeysFileSet :1 ; /* if not set then no explicit authorized keys */
92+ byte useSystemCA :1 ;
9293};
9394
9495int CountWhitespace (const char * in , int inSz , byte inv );
@@ -350,6 +351,7 @@ enum {
350351 OPT_TRUSTED_USER_CA_KEYS = 21 ,
351352 OPT_PIDFILE = 22 ,
352353 OPT_BANNER = 23 ,
354+ OPT_TRUSTED_SYSTEM_CA_KEYS = 24 ,
353355};
354356enum {
355357 NUM_OPTIONS = 24
@@ -378,6 +380,7 @@ static const CONFIG_OPTION options[NUM_OPTIONS] = {
378380 {OPT_FORCE_CMD , "ForceCommand" },
379381 {OPT_HOST_CERT , "HostCertificate" },
380382 {OPT_TRUSTED_USER_CA_KEYS , "TrustedUserCAKeys" },
383+ {OPT_TRUSTED_SYSTEM_CA_KEYS , "TrustedSystemCAKeys" },
381384 {OPT_PIDFILE , "PidFile" },
382385 {OPT_BANNER , "Banner" },
383386};
@@ -1021,6 +1024,9 @@ static int HandleConfigOption(WOLFSSHD_CONFIG** conf, int opt,
10211024 /* TODO: Add logic to check if file exists? */
10221025 ret = wolfSSHD_ConfigSetUserCAKeysFile (* conf , value );
10231026 break ;
1027+ case OPT_TRUSTED_SYSTEM_CA_KEYS :
1028+ ret = wolfSSHD_ConfigSetSystemCA (* conf , value );
1029+ break ;
10241030 case OPT_PIDFILE :
10251031 ret = SetFileString (& (* conf )-> pidFile , value , (* conf )-> heap );
10261032 break ;
@@ -1309,6 +1315,44 @@ char* wolfSSHD_ConfigGetHostCertFile(const WOLFSSHD_CONFIG* conf)
13091315 return ret ;
13101316}
13111317
1318+
1319+ /* getter function for if using system CAs
1320+ * return 1 if true and 0 if false */
1321+ int wolfSSHD_ConfigGetSystemCA (const WOLFSSHD_CONFIG * conf )
1322+ {
1323+ if (conf != NULL ) {
1324+ return conf -> useSystemCA ;
1325+ }
1326+ return 0 ;
1327+ }
1328+
1329+
1330+ /* setter function for if using system CAs
1331+ * 'yes' if true and 'no' if false
1332+ * returns WS_SUCCESS on success */
1333+ int wolfSSHD_ConfigSetSystemCA (WOLFSSHD_CONFIG * conf , const char * value )
1334+ {
1335+ int ret = WS_SUCCESS ;
1336+
1337+ if (conf != NULL ) {
1338+ if (WSTRCMP (value , "yes" ) == 0 ) {
1339+ wolfSSH_Log (WS_LOG_INFO , "[SSHD] System CAs enabled" );
1340+ conf -> useSystemCA = 1 ;
1341+ }
1342+ else if (WSTRCMP (value , "no" ) == 0 ) {
1343+ wolfSSH_Log (WS_LOG_INFO , "[SSHD] System CAs disabled" );
1344+ conf -> useSystemCA = 0 ;
1345+ }
1346+ else {
1347+ wolfSSH_Log (WS_LOG_INFO , "[SSHD] System CAs unexpected flag" );
1348+ ret = WS_FATAL_ERROR ;
1349+ }
1350+ }
1351+
1352+ return ret ;
1353+ }
1354+
1355+
13121356char * wolfSSHD_ConfigGetUserCAKeysFile (const WOLFSSHD_CONFIG * conf )
13131357{
13141358 char * ret = NULL ;
0 commit comments