root 1 year ago
commit
1e5c65cff6
4 changed files with 158 additions and 0 deletions
  1. 57 0
      README.md
  2. 1 0
      data/.gitignore
  3. 67 0
      docker-compose.yml
  4. 33 0
      initdb.sh

+ 57 - 0
README.md

@@ -0,0 +1,57 @@
+0. `cp .env.template .env` and update your hostname, portmapping and guacadmin password in `.env`
+
+
+1. Populate database PRIOR to first startup:
+Run `./initdb.sh` to create the database in mysql and update your guacadmin password from .env
+
+
+2. Browse http://localhost:8080/guacamole/
+   and login with login `guacadmin` and password set in .env 
+
+3. Settings - Connections
+   (All no described field can stay blank.)
+   - RDP (xrdp)
+     - Name = some freetext
+     - Protocol = RDP
+     - Parameters
+       - Hostname or IP
+       - Port =  3389
+       - Username
+       - Password
+       - Security mode: Any 
+   - RDP (Windows 10)
+     - Name = some freetext
+     - Protocol = RDP
+     - Parameters
+       - Hostname or IP
+       - Port =  3389
+       - Username
+       - Password
+       - Security mode = TLS
+       - Disable authentication = [x]
+       - Ignore server certificate = [x] 
+   - SSH
+     - Name = some freetext
+     - Protocol = SSH
+     - Parameters
+       - Hostname or IP
+       - Port =  3389
+       - Username
+       - Password
+       - Security mode: Any
+     - SFTP
+       - Enable SFTP
+
+4. Accessing other containers 
+Example:
+```
+  guacd:
+#   ...
+    networks:
+      - default
+      - terminalserver_default
+
+networks:
+  terminalserver_default:
+    external: true
+```

+ 1 - 0
data/.gitignore

@@ -0,0 +1 @@
+mysql/

+ 67 - 0
docker-compose.yml

@@ -0,0 +1,67 @@
+version: '2'
+services:
+
+  mysql:
+    # We have to use an old mysql version here as the driver in guacamole is outdated
+    image: mysql:8.0
+    container_name: mysql
+    hostname: mysql
+    restart: on-failure:3
+
+    environment:
+      MYSQL_ROOT_PASSWORD: Passw0rd!
+      MYSQL_DATABASE: guacamole
+      MYSQL_USER: guacamole
+      MYSQL_PASSWORD: guacamole
+    volumes:
+      - ./data/mysql:/var/lib/mysql
+    networks:
+      - default
+#    command:
+#      - "mysqld"
+#      - "--verbose"
+
+  guacd:
+    image: guacamole/guacd:1.4.0
+    container_name: guacd
+    hostname: guacd
+    restart: on-failure:3
+
+    depends_on:
+      - mysql
+    networks:
+      - default
+      - terminalserver_default
+
+  guacamole:
+    image: guacamole/guacamole:1.4.0
+    container_name: guacamole
+    hostname: guacamole
+    restart: on-failure:3    
+    ports:
+      - ${PORTMAPPING}
+    expose:
+      - 8080
+    depends_on:
+      - guacd
+      - mysql
+    environment:
+      GUACD_HOSTNAME: guacd
+      MYSQL_HOSTNAME: mysql
+      MYSQL_PORT: 3306
+      MYSQL_DATABASE: guacamole
+      MYSQL_USER: guacamole
+      MYSQL_PASSWORD: guacamole
+      VIRTUAL_HOST: ${HOSTNAME} 
+      LETSENCRYPT_HOST: ${HOSTNAME} 
+      LETSENCRYPT_EMAIL: webmaster@${HOSTNAME}
+    networks:
+      - default
+      - reverse-proxy_default
+
+
+networks:
+  reverse-proxy_default:
+    external: true
+  terminalserver_default:
+    external: true

+ 33 - 0
initdb.sh

@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Get query for DB creation
+docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --mysql > initdb.sql
+
+# Create query to update the guacadmin password
+cat >user.sql <<'EOL'
+SET @salt = UNHEX(SHA2(UUID(), 256));
+UPDATE guacamole_user
+  SET  password_salt = @salt, password_hash = UNHEX(SHA2(CONCAT('_PASSWORD_', HEX(@salt)), 256))
+     WHERE user_id = 1;
+EOL
+
+source .env
+sed -i user.sql -e "s/_PASSWORD_/$PASSWORD/g"
+
+# Start mysql and create database as it is up 
+docker-compose up -d mysql \
+  && docker cp initdb.sql mysql:/ \
+  && docker exec mysql \
+    sh -c "while [ ! -S /var/run/mysqld/mysqld.sock ] ; do sleep 2 && echo 'Wait for mysql to come up...'; done; sleep 5; echo 'go'" \
+  && docker exec mysql \
+    sh -c "mysql --verbose --user=guacamole --password=guacamole guacamole < /initdb.sql" \
+  && docker exec mysql \
+    sh -c "mysql --verbose --user=guacamole --password=guacamole guacamole -e 'show tables;'"
+
+# Update guacadmin password
+docker cp user.sql mysql:/ \
+  && docker exec mysql \
+    sh -c "mysql --verbose --user=guacamole --password=guacamole guacamole < /user.sql" \
+
+# Start guacamole
+docker-compose up -d