website/integrations/infrastructure/apache-guacamole/index.mdx
import TabItem from "@theme/TabItem"; import Tabs from "@theme/Tabs";
Apache Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH.
The following placeholders are used in this guide:
guacamole.company is the FQDN of the Guacamole installation.authentik.company is the FQDN of the authentik installation.:::info This documentation lists only the settings that you need to change from their default values. Be aware that any changes other than those explicitly mentioned in this guide could cause issues accessing your application. :::
To support the integration of Apache Guacamole with authentik, you need to create an application/provider pair in authentik.
Strict redirect URI to https://guacamole.company/. If you have configured Apache Tomcat to run Apache Guacamole on a subpath, you will need to update this value accordingly.It is recommended to create an admin account in Guacamole before configuring Single Sign-On to simplify the process. Create a user in Guacamole using the same username as in authentik and grant them admin permissions. This step is important to avoid losing access to the Guacamole admin settings, as you may need to revert your changes without it.
:::warning
You can configure Apache Guacamole to use either the sub or preferred_username as the UID field under user-name-attribute. When using preferred_username as the user identifier, ensure that the Allow users to change username setting is disabled to prevent authentication issues. The sub option uses a unique, stable identifier for the user, while preferred_username uses the username configured in authentik.
:::
<Tabs
defaultValue="docker"
values={[
{ label: 'Docker', value: 'docker' },
{ label: 'Standalone', value: 'standalone' },
]}>
<TabItem value="docker">
Docker containers are typically configured using environment variables. To ensure proper integration, add the following variables to your .env file:
```yaml showLineNumbers
OPENID_AUTHORIZATION_ENDPOINT=https://authentik.company/application/o/authorize/
OPENID_CLIENT_ID=<Client ID from authentik>
OPENID_ISSUER=https://authentik.company/application/o/<application_slug>/
OPENID_JWKS_ENDPOINT=https://authentik.company/application/o/<application_slug>/jwks/
OPENID_REDIRECT_URI=https://guacamole.company/
OPENID_USERNAME_CLAIM_TYPE=preferred_username
OPENID_ENABLED=true
```
You must also add one of the following variables, depending on your desired behaviour:
- To automatically redirect all unauthenticated users, add the following:
```yaml
EXTENSION_PRIORITY=openid
```
- Alternatively, to present unauthenticated users with a login screen, add the following:
```yaml
EXTENSION_PRIORITY=*,openid
```
:::tip Older versions of Apache Guacamole (pre v1.6)
In older versions of Apache Guacamole, the OPENID_ENABLED=true, EXTENSION_PRIORITY=openid or EXTENSION_PRIORITY=*,openid are not required.
:::
Additionally, ensure your guacamole.properties file (typically located in /etc/guacamole/) includes the following line. This setting allows environment variables to be evaluated before static configuration files:
```yaml
enable-environment-properties: true
```
```yaml showLineNumbers title="/etc/guacamole/guacamole.properties"
openid-authorization-endpoint=https://authentik.company/application/o/authorize/
openid-client-id=<Client ID from authentik>
openid-issuer=https://authentik.company/application/o/<application_slug>/
openid-jwks-endpoint=https://authentik.company/application/o/<application_slug>/jwks/
openid-redirect-uri=https://guacamole.company/
openid-username-claim-type=preferred_username
openid-enabled=true
```
You must also add one of the following settings depending on your desired behaviour:
- To automatically redirect all unauthenticated users, add the following:
```yaml
extension-priority=openid
```
- Alternatively, to present unauthenticated users with a login screen, add the following:
```yaml
extension-priority=*,openid
```
:::tip Older versions of Apache Guacamole (pre v1.6)
In older versions of Apache Guacamole, the openid-enabled=true, extension-priority=openid or extension-priority=*,openid are not required.
:::
When using a self-signed certificate, it is necessary to incorporate the certificate of the corresponding Certificate Authority into both the /etc/ssl/certs/ca-certificates.crt file and the /opt/java/openjdk/lib/security/cacerts keystore on your Apache Guacamole host. This ensures that the self-signed certificate is trusted by both the system and the Java runtime environment used by Guacamole.
/etc/ssl/certs/ca-certificates.crt:::info This section depends on the operating system hosting Apache Guacamole. :::
Copy the certificate of the Certificate Authority (e.g. <CA_certificate>.crt) to the /usr/local/share/ca-certificates/ directory on the Apache Guacamole host. Ensure that the file extension is .crt.
To add the certificate as trusted in /etc/ssl/certs/ca-certificates.crt, use the following command:
update-ca-certificates
Copy the certificate of the Certificate Authority (e.g. <CA_certificate>.crt) to the /usr/syno/etc/security-profile/ca-bundle-profile/ca-certificates/ directory on the Synology host. Ensure that the filetype is .crt.
To add the certificate as trusted in /etc/ssl/certs/ca-certificates.crt, use the following command:
update-ca-certificates.sh
/opt/java/openjdk/lib/security/cacertsTo export the certificate of the Certificate Authority, use the following command on the Certificate Authority host:
openssl pkcs12 -export -in <CA_certificate>.crt -inkey <CA_certificate>.key -out <CA_certificate>.p12 -passout pass:<password>
To import the certificate to the /opt/java/openjdk/lib/security/cacerts keystore on the Apache Guacamole host, use the following command:
keytool -importkeystore -srckeystore <CA_certificate>.p12 -srcstoretype PKCS12 -keystore /opt/java/openjdk/lib/security/cacerts -deststorepass <destination_store_password> -noprompt -srcstorepass <password>
:::tip Older versions of Apache Guacamole (pre v1.6)
In older versions of Apache Guacamole, the keystore was located at /opt/java/openjdk/jre/lib/security/cacerts. If using an older version, update the command accordingly.
:::
:::info More information on the keytool command can be found in the Oracle documentation. :::
To verify that authentik is correctly configured with Apache Guacamole, log out and log back in through authentik. You should notice a new button appearing at the bottom left of the login page.