@@ -78,6 +78,9 @@ const char* GUAC_RDP_CLIENT_ARGS[] = {
7878 "console-audio" ,
7979 "server-layout" ,
8080 "security" ,
81+ "auth-pkg" ,
82+ "kdc-url" ,
83+ "kerberos-cache" ,
8184 "ignore-cert" ,
8285 "cert-tofu" ,
8386 "cert-fingerprints" ,
@@ -296,6 +299,28 @@ enum RDP_ARGS_IDX {
296299 */
297300 IDX_SECURITY ,
298301
302+ /**
303+ * The authentication package to use based on the underlying FreeRDP support
304+ * for alternatives to NTML. Currently FreeRDP2 only supports NTLM, while
305+ * FreeRDP3 introduces support for Kerberos and continues to support NTLM.
306+ * The default is to negotiate between guacd and the remote server.
307+ */
308+ IDX_AUTH_PKG ,
309+
310+ /**
311+ * When kerberos authentication is in use, the URL of the KDC server to use
312+ * for ticket validation. If not specified, guacd will use the underlying
313+ * system's kerberos configuration.
314+ */
315+ IDX_KDC_URL ,
316+
317+ /**
318+ * When kerberos authentication is in use, the path to the kerberos ticket
319+ * cache, relative to GUACAMOLE_HOME. If not specified, the default system
320+ * cache of the underlying system on which guacd is running will be used.
321+ */
322+ IDX_KERBEROS_CACHE ,
323+
299324 /**
300325 * "true" if validity of the RDP server's certificate should be ignored,
301326 * "false" or blank if invalid certificates should result in a failure to
@@ -832,6 +857,30 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
832857 settings -> security_mode = GUAC_SECURITY_ANY ;
833858 }
834859
860+ /* Use kerberos authentication */
861+ if (strcmp (argv [IDX_AUTH_PKG ], "kerberos" ) == 0 ) {
862+ guac_user_log (user , GUAC_LOG_INFO , "Authentication package: Kerberos" );
863+ settings -> auth_pkg = GUAC_AUTH_PKG_KERBEROS ;
864+ }
865+
866+ else if (strcmp (argv [IDX_AUTH_PKG ], "ntlm" ) == 0 ) {
867+ guac_user_log (user , GUAC_LOG_INFO , "Authentication package: NTLM" );
868+ settings -> auth_pkg = GUAC_AUTH_PKG_NTLM ;
869+ }
870+
871+ else {
872+ guac_user_log (user , GUAC_LOG_INFO , "No authentication package requested, defaulting to negotiate." );
873+ settings -> auth_pkg = GUAC_AUTH_PKG_ANY ;
874+ }
875+
876+ /* Set KDC URL */
877+ settings -> kdc_url = guac_user_parse_args_string (user , GUAC_RDP_CLIENT_ARGS ,
878+ argv , IDX_KDC_URL , NULL );
879+
880+ /* Set Kerberos cache */
881+ settings -> kerberos_cache = guac_user_parse_args_string (user ,
882+ GUAC_RDP_CLIENT_ARGS , argv , IDX_KERBEROS_CACHE , NULL );
883+
835884 /* Set hostname */
836885 settings -> hostname =
837886 guac_user_parse_args_string (user , GUAC_RDP_CLIENT_ARGS , argv ,
@@ -1410,6 +1459,8 @@ void guac_rdp_settings_free(guac_rdp_settings* settings) {
14101459 guac_mem_free (settings -> timezone );
14111460 guac_mem_free (settings -> username );
14121461 guac_mem_free (settings -> printer_name );
1462+ guac_mem_free (settings -> kdc_url );
1463+ guac_mem_free (settings -> kerberos_cache );
14131464
14141465 /* Free channel name array */
14151466 if (settings -> svc_names != NULL ) {
@@ -1692,6 +1743,29 @@ void guac_rdp_push_settings(guac_client* client,
16921743
16931744 }
16941745
1746+ /* Set the authentication package to use. */
1747+ switch (guac_settings -> auth_pkg ) {
1748+
1749+ case GUAC_AUTH_PKG_NTLM :
1750+ freerdp_settings_set_string (rdp_settings , FreeRDP_AuthenticationPackageList , "ntlm,!kerberos" );
1751+ break ;
1752+
1753+ case GUAC_AUTH_PKG_KERBEROS :
1754+ freerdp_settings_set_string (rdp_settings , FreeRDP_AuthenticationPackageList , "!ntlm,kerberos" );
1755+ break ;
1756+
1757+ case GUAC_AUTH_PKG_ANY :
1758+ freerdp_settings_set_string (rdp_settings , FreeRDP_AuthenticationPackageList , "ntlm,kerberos" );
1759+ break ;
1760+
1761+ }
1762+
1763+ if (guac_settings -> kdc_url != NULL )
1764+ freerdp_settings_set_string (rdp_settings , FreeRDP_KerberosKdcUrl , guac_strdup (guac_settings -> kdc_url ));
1765+
1766+ if (guac_settings -> kerberos_cache != NULL )
1767+ freerdp_settings_set_string (rdp_settings , FreeRDP_KerberosCache , guac_strdup (guac_settings -> kerberos_cache ));
1768+
16951769 /* Security */
16961770 freerdp_settings_set_bool (rdp_settings , FreeRDP_Authentication , !guac_settings -> disable_authentication );
16971771 freerdp_settings_set_bool (rdp_settings , FreeRDP_IgnoreCertificate , guac_settings -> ignore_certificate );
@@ -1941,6 +2015,29 @@ void guac_rdp_push_settings(guac_client* client,
19412015
19422016 }
19432017
2018+ /* Set the authentication package preferences */
2019+ switch (guac_settings -> auth_pkg ) {
2020+
2021+ case GUAC_AUTH_PKG_NTLM :
2022+ rdp_settings -> AuthenticationPackageList = "ntlm,!kerberos" ;
2023+ break ;
2024+
2025+ case GUAC_AUTH_PKG_KERBEROS :
2026+ rdp_settings -> AuthenticationPackageList = "!ntlm,kerberos" ;
2027+ break ;
2028+
2029+ case GUAC_AUTH_PKG_ANY :
2030+ rdp_settings -> AuthenticationPackageList = "ntlm,kerberos" ;
2031+ break ;
2032+
2033+ }
2034+
2035+ /* Kerberos KDC URL */
2036+ rdp_settings -> KerberosKdcUrl = guac_strdup (guac_settings -> kdc_url );
2037+
2038+ /* Kerberos ticket cache */
2039+ rdp_settings -> KerberosCache = guac_strdup (guac_settings -> kerberos_cache );
2040+
19442041 /* Security */
19452042 rdp_settings -> Authentication = !guac_settings -> disable_authentication ;
19462043 rdp_settings -> IgnoreCertificate = guac_settings -> ignore_certificate ;
0 commit comments