Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dmi3mis/1e7dc9c5d423ab588d555f0a2c399f26 to your computer and use it in GitHub Desktop.
Save dmi3mis/1e7dc9c5d423ab588d555f0a2c399f26 to your computer and use it in GitHub Desktop.

Revisions

  1. dmi3mis revised this gist Mar 10, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    cat /etc/httpd/conf.d/domain.tld.conf
    cat /etc/httpd/conf.d/guac.dmi3lab.online.conf
    <VirtualHost *:80>
    ServerName domain.tld
    ServerName guac.dmi3lab.online

    RewriteEngine On
    RewriteCond %{HTTPS} off
  2. dmi3mis revised this gist Mar 10, 2024. 1 changed file with 51 additions and 0 deletions.
    51 changes: 51 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    cat /etc/httpd/conf.d/domain.tld.conf
    <VirtualHost *:80>
    ServerName domain.tld

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    RewriteCond %{SERVER_NAME} =guac.dmi3lab.online
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    </VirtualHost>

    <VirtualHost *:443>
    ServerName guac.dmi3lab.online

    # Reverse proxy based on https://httpd.apache.org/docs/current/mod/mod_proxy_wstunnel.html
    RewriteEngine On
    ProxyPreserveHost On
    AllowEncodedSlashes NoDecode

    ProxyPass / http://192.168.1.55:8080/ nocanon
    ProxyPassReverse / http://192.168.1.55:8080/

    RewriteCond %{HTTP:Upgrade} websocket [NC]
    RewriteCond %{HTTP:Connection} upgrade [NC]
    RewriteCond %{THE_REQUEST} "^[a-zA-Z]+ /(.*) HTTP/\d+(\.\d+)?$"
    RewriteRule .? "ws://localhost:8080/%1" [P,L]

    # Enable h2, h2c and http1.1
    Protocols h2 h2c http/1.1

    # Solves slow upload speeds caused by http2
    H2WindowSize 5242880

    # TLS
    SSLEngine on
    SSLProtocol -all +TLSv1.2 +TLSv1.3
    SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305
    SSLHonorCipherOrder off
    SSLSessionTickets off
    SSLCertificateFile /etc/letsencrypt/live/guac.dmi3lab.online/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/guac.dmi3lab.online/privkey.pem

    # Disable HTTP TRACE method.
    TraceEnable off
    <Files ".ht*">
    Require all denied
    </Files>

    # Support big file uploads
    LimitRequestBody 0
    </VirtualHost>
  3. dmi3mis revised this gist Dec 8, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Set Up Apache Guacamole With Podman.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ podman pod create \
    mkdir -p "guacamole-db/docker-entrypoint-initdb.d"
    chcon -t container_file_t -R $(pwd)/guacamole-db
    chown mysql:mysql -R $(pwd)/guacamole-db
    chown 27:27 -R $(pwd)/guacamole-db
    # files are scanned in order
    # create the user and database first and initialize it next
  4. dmi3mis revised this gist Dec 8, 2023. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions Set Up Apache Guacamole With Podman.md
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,9 @@ podman pod create \
    # the directory the database container will scan for initialization scripts
    mkdir -p "guacamole-db/docker-entrypoint-initdb.d"
    chcon -t container_file_t -R $(pwd)/guacamole-db
    chown mysql:mysql -R $(pwd)/guacamole-db
    # files are scanned in order
    # create the user and database first and initialize it next
    # localhost doesn't work for the user with podman; must be 127.0.0.1
    @@ -45,6 +48,7 @@ podman run -d \
    --name=YOUR_GUACD_CONTAINER_NAME \
    --pod=YOUR_POD_NAME \
    --restart unless-stopped \
    -e GUACD_LOG_LEVEL=debug \
    docker.io/guacamole/guacd
    ```

    @@ -63,6 +67,7 @@ podman run -d \
    -e MYSQL_PASSWORD=YOUR_GUACAMOLE_PASSWORD \
    -e GUACD_HOSTNAME=127.0.0.1 \
    -e GUACD_PORT=4822 \
    -e WEBAPP_CONTEXT=ROOT \
    --restart unless-stopped \
    docker.io/guacamole/guacamole
    ```
  5. @christopher-baek christopher-baek created this gist Feb 23, 2022.
    68 changes: 68 additions & 0 deletions Set Up Apache Guacamole With Podman.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,68 @@
    ## Create a pod to hold containers

    ```
    podman pod create \
    --name YOUR_POD_NAME \
    -p 8080:8080
    ```

    ## Create database initialization scripts

    ```
    # the directory the database container will scan for initialization scripts
    mkdir -p "guacamole-db/docker-entrypoint-initdb.d"
    # files are scanned in order
    # create the user and database first and initialize it next
    # localhost doesn't work for the user with podman; must be 127.0.0.1
    echo "CREATE USER 'YOUR_GUACAMOLE_USERNAME'@'127.0.0.1' IDENTIFIED BY 'YOUR_GUACAMOLE_PASSWORD';" > guacamole-db/docker-entrypoint-initdb.d/01_initdb.sql
    echo "CREATE DATABASE YOUR_GUACAMOLE_DATABASE_NAME;" >> guacamole-db/docker-entrypoint-initdb.d/01_initdb.sql
    echo "GRANT ALL PRIVILEGES ON YOUR_GUACAMOLE_DATABASE_NAME.* TO 'YOUR_GUACAMOLE_USERNAME'@'127.0.0.1';" >> guacamole-db/docker-entrypoint-initdb.d/01_initdb.sql
    echo "USE YOUR_GUACAMOLE_DATABASE_NAME;" > guacamole-db/docker-entrypoint-initdb.d/02_initdb.sql
    podman run --rm docker.io/guacamole/guacamole /opt/guacamole/bin/initdb.sh --mysql >> guacamole-db/docker-entrypoint-initdb.d/02_initdb.sql
    ```

    ## Create the database

    ```
    # the directory the database stores its data in
    mkdir guacamole-db/data
    podman run -d \
    --name=YOUR_DATABASE_CONTAINER_NAME \
    --pod=YOUR_POD_NAME \
    -e MARIADB_ROOT_PASSWORD=YOUR_DATABASE_ROOT_PASSWORD \
    -v $(pwd)/guacamole-db/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d \
    -v $(pwd)/guacamole-db/data:/var/lib/mysql \
    --restart unless-stopped \
    docker.io/mariadb:latest
    ```

    ## Start guacd

    ```
    podman run -d \
    --name=YOUR_GUACD_CONTAINER_NAME \
    --pod=YOUR_POD_NAME \
    --restart unless-stopped \
    docker.io/guacamole/guacd
    ```

    ## Start guacamole

    ```
    # must specify database and guacd params to connect within a pod
    # must use 127.0.0.1, not localhost
    podman run -d \
    --name=YOUR_GUACAMOLE_WEBAPP_CONTAINER_NAME \
    --pod=YOUR_POD_NAME \
    -e MYSQL_HOSTNAME=127.0.0.1 \
    -e MYSQL_PORT=3306 \
    -e MYSQL_DATABASE=YOUR_GUACAMOLE_DATABASE_NAME \
    -e MYSQL_USER=YOUR_GUACAMOLE_USERNAME \
    -e MYSQL_PASSWORD=YOUR_GUACAMOLE_PASSWORD \
    -e GUACD_HOSTNAME=127.0.0.1 \
    -e GUACD_PORT=4822 \
    --restart unless-stopped \
    docker.io/guacamole/guacamole
    ```