dockerguacamole

Apache Guacamole on docker won't authenticate with mysql


I've followed the instructions here, and have guacd, guacamole, and mysql running in separate containers, linked together. I'm pretty confident I have the configurations correct, and as a test I started a plain ubuntu container, installed mysql-client, and connected to the mysql container:

PS > docker exec -it ubuntu bash
root@f31a3436f297:/# mysql -h test-mysql -u guacamole_user -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 8.0.32 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use guacamole_db;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+---------------------------------------+
| Tables_in_guacamole_db                |
+---------------------------------------+
| guacamole_connection                  |
| guacamole_connection_attribute        |
| guacamole_connection_group            |
| guacamole_connection_group_attribute  |
| guacamole_connection_group_permission |
| guacamole_connection_history          |
| guacamole_connection_parameter        |
| guacamole_connection_permission       |
| guacamole_entity                      |
| guacamole_sharing_profile             |
| guacamole_sharing_profile_attribute   |
| guacamole_sharing_profile_parameter   |
| guacamole_sharing_profile_permission  |
| guacamole_system_permission           |
| guacamole_user                        |
| guacamole_user_attribute              |
| guacamole_user_group                  |
| guacamole_user_group_attribute        |
| guacamole_user_group_member           |
| guacamole_user_group_permission       |
| guacamole_user_history                |
| guacamole_user_password_history       |
| guacamole_user_permission             |
+---------------------------------------+
23 rows in set (0.00 sec)

mysql>

However, visiting localhost:8080/guacamole results in this:

guacamole error 1

In the guacamole container logs, I see this:

2023-03-16 16:42:29 16:42:29.866 [http-nio-8080-exec-6] WARN  o.a.g.e.AuthenticationProviderFacade - The "mysql" authentication provider has encountered an internal error which will halt the authentication process. If this is unexpected or you are the developer of this authentication provider, you may wish to enable debug-level logging. If this is expected and you wish to ignore such failures in the future, please set "skip-if-unavailable: mysql" within your guacamole.properties.
2023-03-16 16:42:29 16:42:29.869 [http-nio-8080-exec-6] ERROR o.a.g.rest.RESTExceptionMapper - Unexpected internal error: 
2023-03-16 16:42:29 ### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
2023-03-16 16:42:29 
2023-03-16 16:42:29 The last packet successfully received from the server was 63 milliseconds ago.  The last packet sent successfully to the server was 62 milliseconds ago.
2023-03-16 16:42:29 ### The error may exist in org/apache/guacamole/auth/jdbc/user/UserMapper.xml
2023-03-16 16:42:29 ### The error may involve org.apache.guacamole.auth.jdbc.user.UserMapper.selectOne
2023-03-16 16:42:29 ### The error occurred while executing a query
2023-03-16 16:42:29 ### Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
2023-03-16 16:42:29 
2023-03-16 16:42:29 The last packet successfully received from the server was 63 milliseconds ago.  The last packet sent successfully to the server was 62 milliseconds ago.

From some quick googling, it seems like Communications link failure may be a vague approximation of the error, but I'm stuck where to look next. The mysql container shows nothing in the logs at the time of the guacamole error.

Things I've tried, with no success:


Solution

  • Had the same problem, solved that by adding

          - MYSQL_DRIVER=mysql
          - MYSQL_SSL_MODE=disabled
    

    to the environment of the guacamole container in the docker-compose.yml.

    Hope this helps.