@@ -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 ) {
@@ -1695,6 +1746,29 @@ void guac_rdp_push_settings(guac_client* client,
16951746
16961747 }
16971748
1749+ /* Set the authentication package to use. */
1750+ switch (guac_settings -> auth_pkg ) {
1751+
1752+ case GUAC_AUTH_PKG_NTLM :
1753+ freerdp_settings_set_string (rdp_settings , FreeRDP_AuthenticationPackageList , "ntlm,!kerberos" );
1754+ break ;
1755+
1756+ case GUAC_AUTH_PKG_KERBEROS :
1757+ freerdp_settings_set_string (rdp_settings , FreeRDP_AuthenticationPackageList , "!ntlm,kerberos" );
1758+ break ;
1759+
1760+ case GUAC_AUTH_PKG_ANY :
1761+ freerdp_settings_set_string (rdp_settings , FreeRDP_AuthenticationPackageList , "ntlm,kerberos" );
1762+ break ;
1763+
1764+ }
1765+
1766+ if (guac_settings -> kdc_url != NULL )
1767+ freerdp_settings_set_string (rdp_settings , FreeRDP_KerberosKdcUrl , guac_strdup (guac_settings -> kdc_url ));
1768+
1769+ if (guac_settings -> kerberos_cache != NULL )
1770+ freerdp_settings_set_string (rdp_settings , FreeRDP_KerberosCache , guac_strdup (guac_settings -> kerberos_cache ));
1771+
16981772 /* Security */
16991773 freerdp_settings_set_bool (rdp_settings , FreeRDP_Authentication , !guac_settings -> disable_authentication );
17001774 freerdp_settings_set_bool (rdp_settings , FreeRDP_IgnoreCertificate , guac_settings -> ignore_certificate );
@@ -1947,6 +2021,29 @@ void guac_rdp_push_settings(guac_client* client,
19472021
19482022 }
19492023
2024+ /* Set the authentication package preferences */
2025+ switch (guac_settings -> auth_pkg ) {
2026+
2027+ case GUAC_AUTH_PKG_NTLM :
2028+ rdp_settings -> AuthenticationPackageList = "ntlm,!kerberos" ;
2029+ break ;
2030+
2031+ case GUAC_AUTH_PKG_KERBEROS :
2032+ rdp_settings -> AuthenticationPackageList = "!ntlm,kerberos" ;
2033+ break ;
2034+
2035+ case GUAC_AUTH_PKG_ANY :
2036+ rdp_settings -> AuthenticationPackageList = "ntlm,kerberos" ;
2037+ break ;
2038+
2039+ }
2040+
2041+ /* Kerberos KDC URL */
2042+ rdp_settings -> KerberosKdcUrl = guac_strdup (guac_settings -> kdc_url );
2043+
2044+ /* Kerberos ticket cache */
2045+ rdp_settings -> KerberosCache = guac_strdup (guac_settings -> kerberos_cache );
2046+
19502047 /* Security */
19512048 rdp_settings -> Authentication = !guac_settings -> disable_authentication ;
19522049 rdp_settings -> IgnoreCertificate = guac_settings -> ignore_certificate ;
0 commit comments