Restructured Documentation
Automatic Documentation Deployment / Sync Docs to https://kb.bunny-lab.io (push) Successful in 8s
Automatic Documentation Deployment / Sync Docs to https://kb.bunny-lab.io (push) Successful in 8s
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
---
|
||||
tags:
|
||||
- Apache Guacamole
|
||||
- Docker
|
||||
---
|
||||
|
||||
## Purpose
|
||||
HTML5-based Remote Access Broker for SSH, RDP, and VNC. Useful for remote access into an environment.
|
||||
|
||||
### Docker Compose Stack
|
||||
=== "docker-compose.yml"
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
app:
|
||||
image: jasonbean/guacamole
|
||||
ports:
|
||||
- 8080:8080
|
||||
volumes:
|
||||
- /srv/containers/guacamole:/config
|
||||
environment:
|
||||
- OPT_MYSQL=Y
|
||||
- OPT_MYSQL_EXTENSION=N
|
||||
- OPT_SQLSERVER=N
|
||||
- OPT_LDAP=N
|
||||
- OPT_DUO=N
|
||||
- OPT_CAS=N
|
||||
- OPT_TOTP=Y # (1)
|
||||
- OPT_QUICKCONNECT=N
|
||||
- OPT_HEADER=N
|
||||
- OPT_SAML=N
|
||||
- PUID=99
|
||||
- PGID=100
|
||||
- TZ=America/Denver # (2)
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
docker_network:
|
||||
ipv4_address: 192.168.5.43
|
||||
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: docker_network
|
||||
docker_network:
|
||||
external: true
|
||||
```
|
||||
|
||||
1. Enable this if you want multi-factor authentication enabled. Must be set BEFORE the container is initially deployed. Cannot be added retroactively.
|
||||
2. Set to your own timezone.
|
||||
|
||||
=== "docker-compose.yml (OpenID / Keycloak Integration)"
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
app:
|
||||
image: jasonbean/guacamole
|
||||
ports:
|
||||
- 8080:8080
|
||||
volumes:
|
||||
- /srv/containers/apache-guacamole:/config
|
||||
environment:
|
||||
- OPT_MYSQL=Y
|
||||
- OPT_MYSQL_EXTENSION=N
|
||||
- OPT_SQLSERVER=N
|
||||
- OPT_LDAP=N
|
||||
- OPT_DUO=N
|
||||
- OPT_CAS=N
|
||||
- OPT_TOTP=N
|
||||
- OPT_QUICKCONNECT=N
|
||||
- OPT_HEADER=N
|
||||
- OPT_SAML=N
|
||||
- OPT_OIDC=Y # Enable OpenID Connect
|
||||
- OIDC_ISSUER=${OPENID_REALM_URL} # Your Keycloak realm URL
|
||||
- OIDC_CLIENT_ID=${OPENID_CLIENT_ID} # Client ID for Guacamole in Keycloak
|
||||
- OIDC_CLIENT_SECRET=${OPENID_CLIENT_SECRET} # Client Secret for Guacamole in Keycloak
|
||||
- OIDC_REDIRECT_URI=${OPENID_REDIRECT_URI} # Redirect URI for Guacamole
|
||||
- PUID=99
|
||||
- PGID=100
|
||||
- TZ=America/Denver
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
docker_network:
|
||||
ipv4_address: 192.168.5.43
|
||||
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: docker_network
|
||||
docker_network:
|
||||
external: true
|
||||
```
|
||||
|
||||
1. You cannot enable TOTP / Multi-factor authentication if you have OpenID configured. This is just a known issue.
|
||||
2. Set to your own timezone.
|
||||
|
||||
### Environment Variables
|
||||
=== ".env"
|
||||
|
||||
```sh
|
||||
N/A
|
||||
```
|
||||
|
||||
=== ".env (OpenID / Keycloak Integration)"
|
||||
|
||||
```yaml
|
||||
OPENID_REALM_URL=https://auth.bunny-lab.io/realms/master
|
||||
OPENID_CLIENT_ID=apache-guacamole
|
||||
OPENID_CLIENT_SECRET=<YOUR-CLIENT-ID-SECRET>
|
||||
OPENID_REDIRECT_URI=http://remote.bunny-lab.io
|
||||
```
|
||||
|
||||
## Reverse Proxy Configuration
|
||||
=== "Traefik"
|
||||
|
||||
```yaml
|
||||
http:
|
||||
routers:
|
||||
apache-guacamole:
|
||||
entryPoints:
|
||||
- websecure
|
||||
tls:
|
||||
certResolver: letsencrypt
|
||||
service: apache-guacamole
|
||||
rule: Host(`remote.bunny-lab.io`)
|
||||
|
||||
services:
|
||||
apache-guacamole:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: http://192.168.5.43:8080
|
||||
passHostHeader: true
|
||||
```
|
||||
|
||||
=== "NGINX"
|
||||
|
||||
```yaml
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name remote.bunny-lab.io;
|
||||
client_max_body_size 0;
|
||||
ssl on;
|
||||
location / {
|
||||
proxy_pass http://192.168.5.43:8080;
|
||||
proxy_buffering off;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Related Documentation
|
||||
- [Docker Network Prerequisite](<../../Containers/Docker/Create the Docker Network.md>) — The configuration references the external `docker_network`; prepare it on the intended Docker host.
|
||||
- [Related Networking and Access Documentation](<../../../reference/Networking and Access/index.md>) — Find the connected deployments, procedures, and references for this subject.
|
||||
@@ -0,0 +1,115 @@
|
||||
---
|
||||
tags:
|
||||
- Firefox
|
||||
- Docker
|
||||
---
|
||||
|
||||
## Purpose
|
||||
Sometimes you just want an instance of Firefox running on an Alpine Linux container, that has persistence (Extensions, bookmarks, history, etc) outside of the container (with bind-mapped folders). This is useful for a number of reasons, but insecure by default, so you have to protect it behind something like a [Keycloak Server](<../../Identity and Certificates/Keycloak/Deploy Keycloak.md>) so it is not misused.
|
||||
|
||||
## Keycloak Authentication Sequence
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant User
|
||||
participant Traefik as Traefik Reverse Proxy
|
||||
participant Keycloak
|
||||
participant RockyLinux as Rocky Linux VM
|
||||
participant FirewallD as FirewallD
|
||||
participant Alpine as Alpine Container
|
||||
|
||||
User->>Traefik: Access https://work-environment.bunny-lab.io
|
||||
Traefik->>Keycloak: Redirect to Authenticate against Work Realm
|
||||
User->>Keycloak: Authenticate
|
||||
Keycloak->>User: Authorization Cookie Stored on Internet Browser
|
||||
User->>Traefik: Pass Authorization Cookie to Traefik
|
||||
Traefik->>RockyLinux: Traefik Forwards Traffic to Rocky Linux VM
|
||||
RockyLinux->>FirewallD: Traffic Passes Local Firewall
|
||||
FirewallD->>RockyLinux: Filter traffic (Port 5800)
|
||||
FirewallD->>Alpine: Allow Traffic from Traefik
|
||||
Alpine->>User: WebUI Access to Firefox Work Environment Granted
|
||||
```
|
||||
|
||||
## Docker Configuration
|
||||
```yaml title="docker-compose.yml"
|
||||
version: '3'
|
||||
services:
|
||||
firefox:
|
||||
image: jlesage/firefox # Docker image for Firefox
|
||||
environment:
|
||||
- TZ=America/Denver # Timezone setting
|
||||
- DARK_MODE=1 # Enable dark mode
|
||||
- WEB_AUDIO=1 # Enable web audio
|
||||
- KEEP_APP_RUNNING=1 # Keep the application running
|
||||
ports:
|
||||
- "5800:5800" # Port mapping for VNC WebUI
|
||||
volumes:
|
||||
- /srv/containers/firefox:/config:rw # Persistent storage for configuration
|
||||
restart: always # Always restart the container in case of failure
|
||||
network_mode: host # Use the host network
|
||||
```
|
||||
|
||||
```yaml title=".env"
|
||||
N/A
|
||||
```
|
||||
|
||||
## Local Firewall Hardening
|
||||
It is important, due to how this browser just allows anyone to access it, to lock it down to only allow access to the SSH port and port 5800 to specifically-allowed devices, in this case, the Traefik Reverse Proxy. This ensures that it only allows the proxy to communicate with Firefox's container, keeping it securely protected behind Keycloak's middware in Traefik.
|
||||
|
||||
These rules will drop all traffic by default, allow port 22, and restrict access to port 5800.
|
||||
|
||||
```sh
|
||||
# Set the default zone to drop
|
||||
sudo firewall-cmd --set-default-zone=drop
|
||||
|
||||
# Create a new zone named custom-trusted
|
||||
sudo firewall-cmd --permanent --new-zone=traefik-proxy
|
||||
|
||||
# Allow traffic to port 5800 only from 192.168.5.29 in the traefik-proxy zone
|
||||
sudo firewall-cmd --permanent --zone=traefik-proxy --add-source=192.168.5.29
|
||||
sudo firewall-cmd --permanent --zone=traefik-proxy --add-port=5800/tcp
|
||||
|
||||
# Allow SSH traffic on port 22 from any IP in the drop zone
|
||||
sudo firewall-cmd --permanent --zone=drop --add-service=ssh
|
||||
|
||||
# Reload FirewallD to apply the changes
|
||||
sudo firewall-cmd --reload
|
||||
```
|
||||
|
||||
## Traefik Reverse Proxy Configuration
|
||||
If the container does not run on the same host as Traefik, you will need to manually add configuration to Traefik's dynamic config file, outlined below.
|
||||
|
||||
```yaml
|
||||
http:
|
||||
routers:
|
||||
work-environment:
|
||||
entryPoints:
|
||||
- websecure
|
||||
tls:
|
||||
certResolver: letsencrypt
|
||||
service: work-environment
|
||||
rule: Host(`work-environment.bunny-lab.io`)
|
||||
middlewares:
|
||||
- work-environment # Referencing the Keycloak Server
|
||||
|
||||
services:
|
||||
work-environment:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: http://192.168.5.4:5800
|
||||
passHostHeader: true
|
||||
# # Adding forwardingTimeouts to set the send and read timeouts to 1 hour (3600 seconds)
|
||||
# forwardingTimeouts:
|
||||
# dialTimeout: "3600s"
|
||||
# responseHeaderTimeout: "3600s"
|
||||
```
|
||||
|
||||
## Firefox Special Configurations
|
||||
Due to the nature of how this is deployed, you need to make some additional configurations to the Firefox settings after-the-fact. Some of this could be automated with environment variables at deployment time, but for now will be handled manually.
|
||||
|
||||
- **Install Power Tabs Extension**: This extension is useful for keeping things organized.
|
||||
- **Install Merge All Windows Extension**: At times, you may misclick somewhere in the Firefox environment causing Firefox to open a new instance / window losing all of your tabs, and because there is no window manager, there is no way to alt+tab or switch between the instances of Firefox, effectively breaking your current session forcing you to re-open tabs. With this extension, you can merge all of the windows, collapsing them into one window, resolving the issue.
|
||||
- **Configure New Tab behavior**: If a new tab opens in a new window, it will absolutely throw everything into disarray, that is why all hyperlinks will be forced to open in a new tab instead of a new window. You can do this by navigating to `about:config` and setting the variable `browser.link.open_newwindow.restriction` to a value of `0`. [Original Reference Documentation](https://support.mozilla.org/en-US/questions/1066799)
|
||||
|
||||
## Related Documentation
|
||||
- [Related Networking and Access Documentation](<../../../reference/Networking and Access/index.md>) — Find the connected deployments, procedures, and references for this subject.
|
||||
- [Traefik Deployment](<../Reverse Proxies/Traefik.md>) — Prepare the reverse proxy before applying this page's routing configuration.
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
---
|
||||
tags:
|
||||
- Fedora
|
||||
- Linux
|
||||
- Desktop Environment
|
||||
- Workstation
|
||||
---
|
||||
|
||||
## Purpose
|
||||
You may find that you need to install an XFCE desktop environment or something into Fedora Server, if this is the case, for installing something like Rustdesk remote access, you can follow the steps below.
|
||||
|
||||
### Install and Configure XFCE
|
||||
We need to install XFCE and configure it to be the default environment when the server turns on.
|
||||
|
||||
```sh
|
||||
sudo dnf install @xfce-desktop-environment -y
|
||||
sudo systemctl set-default graphical.target
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
#### Install Rustdesk
|
||||
We need to install Rustdesk into the server.
|
||||
|
||||
```sh
|
||||
curl -L -o /tmp/rustdesk_installer.rpm https://github.com/rustdesk/rustdesk/releases/download/1.4.0/rustdesk-1.4.0-0.x86_64.rpm
|
||||
cd /tmp
|
||||
sudo yum install rustdesk_installer.rpm -y
|
||||
```
|
||||
|
||||
!!! info "Configure Rustdesk"
|
||||
You need to use a tool like "MobaXTerm" or "PuTTy" to leverage X11-Forwarding to allow you to run `rustdesk` in a GUI on your local workstation. From there, you need to configure the relay server information (if you are using a self-hosted Relay). This is also where you would set up a permanent password to the server and document the device ID number.
|
||||
|
||||
Be sure to check the box for "**Enable remote configuration modification**" when setting up Rustdesk.
|
||||
|
||||
### Configure Automatic Login
|
||||
For Rustdesk specifically, we have to configure XFCE to automatically login via SDDM then immediately lock the computer once it's logged in, so the XFCE session is running, allowing Rustdesk to connect to it.
|
||||
|
||||
**Create SDDM Config File**:
|
||||
|
||||
```sh
|
||||
sudo mkdir -p /etc/sddm.conf.d/
|
||||
sudo nano /etc/sddm.conf.d/autologin.conf
|
||||
```
|
||||
|
||||
```ini title="/etc/sddm.conf.d/autologin.conf"
|
||||
[Autologin]
|
||||
User=nicole
|
||||
Session=xfce.desktop
|
||||
```
|
||||
|
||||
!!! note "Determining Session Strings"
|
||||
If you're unsure of the correct session string, check what's available by typing `ls /usr/share/xsessions/`. You will be looking for something like `xfce.desktop`
|
||||
|
||||
### Configure Lock on Initial Login
|
||||
At this point, its not the most secure thing to just leave a server logged-in upon boot, so the following steps will instantly lock the server after logging in, allowing the XFCE session to persist so Rustdesk can attach to it for remote management of the server.
|
||||
|
||||
!!! warning "Not Functional Yet"
|
||||
I have tried implementing the below, but it seems to just ignore it and stay logged-in without locking the device. This needs to be troubleshot further.
|
||||
|
||||
```sh
|
||||
mkdir -p ~/.config/autostart
|
||||
nano ~/.config/autostart/xfce-lock.desktop
|
||||
```
|
||||
|
||||
```ini title="~/.config/autostart/xfce-lock.desktop"
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Exec=xfce4-screensaver-command -l
|
||||
Hidden=false
|
||||
NoDisplay=false
|
||||
X-GNOME-Autostart-enabled=true
|
||||
Name=Auto Lock
|
||||
Comment=Lock the screen on login
|
||||
```
|
||||
|
||||
Lastly, test that everything is working by rebooting the server.
|
||||
|
||||
```sh
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
## Related Documentation
|
||||
- [Related Networking and Access Documentation](<../../../reference/Networking and Access/index.md>) — Find the connected deployments, procedures, and references for this subject.
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
tags:
|
||||
- XRDP
|
||||
- Bash
|
||||
- Scripting
|
||||
- Linux
|
||||
---
|
||||
|
||||
## Purpose
|
||||
If you need to set up RDP access to a Linux environment, you will want to install XRDP. Once it is installed, you can leverage other tools such as Apache Guacamole to remotely connect to it.
|
||||
|
||||
```sh
|
||||
# Install and Start XRDP Service
|
||||
sudo dnf install epel-release -y
|
||||
sudo dnf install xrdp -y
|
||||
sudo systemctl enable --now xrdp
|
||||
|
||||
# Open Firewall Rules for RDP Traffic
|
||||
sudo firewall-cmd --permanent --add-port=3389/tcp
|
||||
sudo firewall-cmd --reload
|
||||
|
||||
# Configure Desktop Environment to Launch when you Login via RDP (Run as Non-Root User)
|
||||
# XFCE4 Desktop Environment
|
||||
echo "startxfce4" > ~/.Xclients
|
||||
chmod +x ~/.Xclients
|
||||
```
|
||||
|
||||
## Related Documentation
|
||||
- [Related Networking and Access Documentation](<../../../reference/Networking and Access/index.md>) — Find the connected deployments, procedures, and references for this subject.
|
||||
Reference in New Issue
Block a user