Skip to content

Commit bb55483

Browse files
author
Norkz
committed
✨ (env): add VNC password to .env.example
📄 (docs): update README with new images and scripts 🔧 (docker): update docker-compose files for VNC support 🗑️ (docker): remove install_nomachine.sh script 🔧 (scripts): modify auto-export-data.sh for improved functionality Add a new environment variable for VNC password in the .env.example file. Update the README to include new images and scripts for better documentation. Modify docker-compose files to support VNC connections, ensuring the application can be accessed remotely. Remove the obsolete install_nomachine.sh script to clean up the codebase. Enhance the auto-export-data.sh script for improved functionality and clarity. ✨ (docker): add helper function to ensure 1Password window is active 🔧 (unlock_more_easily): improve template matching with scaling 🔧 (dockerfile): install VNC server and expose necessary ports 🔧 (package): bump version to 1.0.5 Add a helper function in the script to ensure the 1Password window is active. Improve the template matching function to try multiple scales for better accuracy. Update the Dockerfile to install a VNC server and expose the necessary ports for remote access. Increment the package version to reflect these changes.
1 parent 3140cde commit bb55483

13 files changed

+90
-77
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ BACKUP_ONE_PASS_ONEPASSWORD_EMAIL='[email protected]'
88
BACKUP_ONE_PASS_ONEPASSWORD_SECRET_KEY='your_secret_key'
99
BACKUP_ONE_PASS_ONEPASSWORD_PASSWORD='your_password'
1010
BACKUP_ONE_PASS_ONEPASSWORD_TOTP_SECRET='your_TOTP_secret'
11-
COMPOSE_BAKE=true
11+
BACKUP_ONE_PASS_VNC_PASSWORD='xxx'
12+
COMPOSE_BAKE=true

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ Created by NorkzYT with 💛
111111
- [button_template_white.png](./docker/images/button_template_white.png)
112112
- [save_button_template.png](./docker/images/save_button_template.png)
113113
- [slash_folder_template.png](./docker/images/slash_folder_template.png)
114+
- [unlock-more-easily-text.png](./docker/images/unlock-more-easily-text.png)
114115
- [**scripts**](./docker/scripts)
115116
- [auto-export-data.sh](./docker/scripts/auto-export-data.sh)
116117
- [auto-login-1password.sh](./docker/scripts/auto-login-1password.sh)
@@ -122,6 +123,7 @@ Created by NorkzYT with 💛
122123
- [monitor_export_complete_image.py](./docker/scripts/monitor_export_complete_image.py)
123124
- [monitor_logo_image.py](./docker/scripts/monitor_logo_image.py)
124125
- [quit-1password.sh](./docker/scripts/quit-1password.sh)
126+
- [unlock_more_easily.py](./docker/scripts/unlock_more_easily.py)
125127
- [docker-compose.dev.yml](./docker-compose.dev.yml)
126128
- [docker-compose.yml](./docker-compose.yml)
127129
- [dockerfile](./dockerfile)

docker-compose.dev.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ services:
1515
- ONEPASSWORD_SECRET_KEY=${BACKUP_ONE_PASS_ONEPASSWORD_SECRET_KEY:?error}
1616
- ONEPASSWORD_PASSWORD=${BACKUP_ONE_PASS_ONEPASSWORD_PASSWORD:?error}
1717
- ONEPASSWORD_TOTP_SECRET=${BACKUP_ONE_PASS_ONEPASSWORD_TOTP_SECRET:?error}
18+
- VNC_PASSWORD=${BACKUP_ONE_PASS_VNC_PASSWORD:?error}
19+
# DEBUG Purposes:
1820
ports:
19-
- "14000:4000" # NoMachine Remote desktop access w/protocol "NX"—(Only for development).
21+
- "6080:6080" # noVNC HTML5 interface (access via browser)—noVNC Connection endpoint http://<IPv4>:6080/vnc.html
22+
- "5900:5900" # raw VNC (optional)
2023
volumes:
2124
- /dev/shm:/dev/shm # Shared memory
2225
- /run/dbus/system_bus_socket:/host/run/dbus/system_bus_socket

docker-compose.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
backuponepass:
3-
image: norkz/backuponepass:1.0.4
3+
image: norkz/backuponepass:1.0.5
44
container_name: backuponepass
55
hostname: backuponepass
66
environment:
@@ -14,8 +14,11 @@ services:
1414
- ONEPASSWORD_SECRET_KEY=${BACKUP_ONE_PASS_ONEPASSWORD_SECRET_KEY:?error}
1515
- ONEPASSWORD_PASSWORD=${BACKUP_ONE_PASS_ONEPASSWORD_PASSWORD:?error}
1616
- ONEPASSWORD_TOTP_SECRET=${BACKUP_ONE_PASS_ONEPASSWORD_TOTP_SECRET:?error}
17+
- VNC_PASSWORD=${BACKUP_ONE_PASS_VNC_PASSWORD:?error}
18+
# DEBUG Purposes:
1719
# ports:
18-
# - "14000:4000" # NoMachine Remote desktop access (Only for development)
20+
# - "6080:6080" # noVNC HTML5 interface (access via browser)—noVNC Connection endpoint http://<IPv4>:6080/vnc.html
21+
# - "5900:5900" # raw VNC (optional)
1922
volumes:
2023
- /dev/shm:/dev/shm # Shared memory
2124
- /run/dbus/system_bus_socket:/host/run/dbus/system_bus_socket
@@ -30,4 +33,3 @@ networks:
3033
proxy:
3134
driver: bridge
3235
external: true
33-

docker/1password_cron.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
# -------------------------------------------------------------
3+
34
### Automation Steps (Cron Triggered)
45

56
# Auto-login steps

docker/1password_start.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ if ! pgrep -x "Xvfb" >/dev/null; then
2424
sleep 2
2525
fi
2626

27-
# Disable screen blanking and power management to avoid black screen in NoMachine
28-
echo "Disabling screen blanking and DPMS..."
29-
DISPLAY=:99 xset s off
30-
DISPLAY=:99 xset s noblank
31-
3227
# -------------------------------------------------------------
3328
### Launch 1Password Immediately
3429
echo "Starting 1Password Automation Script..."
@@ -51,4 +46,4 @@ else
5146
fi
5247
fi
5348

54-
echo "1Password launched successfully. The display should now be active for NoMachine."
49+
echo "1Password launched successfully."

docker/config/entrypoint.sh

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ chown -R "$USER":"$USER" /home/$USER/.config/1Password
2020
apt-get update && apt-get install -y ntpdate
2121
ntpdate -s time.nist.gov
2222

23-
# Start DBus and noMachine
23+
# Start DBus (x11docker or external display provider must mount the DBus socket)
2424
if [ ! -S /host/run/dbus/system_bus_socket ]; then
2525
echo "DBus socket not found. Please ensure it is mounted correctly."
2626
exit 1
2727
fi
2828
/etc/init.d/dbus start
29-
/etc/NX/nxserver --startup
3029

3130
# Export environment variables for cron with proper escaping
3231
printenv | grep -vE "^(UID|GID|no_proxy)" | while IFS='=' read -r key value; do
@@ -42,7 +41,7 @@ export XDG_RUNTIME_DIR="/tmp/runtime-$USER"
4241
mkdir -p $XDG_RUNTIME_DIR
4342
chmod 700 $XDG_RUNTIME_DIR
4443

45-
# Start the virtual display (Xvfb) immediately
44+
# Optionally start Xvfb if DISPLAY is not provided (x11docker or host may supply the display)
4645
if [ -z "$DISPLAY" ]; then
4746
export DISPLAY=:99
4847
echo "DISPLAY set to $DISPLAY"
@@ -51,9 +50,30 @@ fi
5150
if ! pgrep -x "Xvfb" >/dev/null; then
5251
echo "Starting Xvfb on display $DISPLAY..."
5352
Xvfb $DISPLAY -screen 0 1920x1080x24 &
54-
sleep 2 # Give Xvfb time to start
53+
sleep 2
5554
fi
5655

56+
# --- Start VNC server for display sharing with password ---
57+
# Check if VNC_PASSWORD is set in the environment (provided from .env file)
58+
if [ -z "$VNC_PASSWORD" ]; then
59+
echo "VNC_PASSWORD environment variable not set. Exiting for security reasons."
60+
exit 1
61+
fi
62+
63+
echo "Storing VNC password..."
64+
# Store the VNC password (hashed) in /tmp/vnc_pass using x11vnc's built-in mechanism.
65+
x11vnc -storepasswd "$VNC_PASSWORD" /tmp/vnc_pass
66+
67+
echo "Starting x11vnc with password authentication..."
68+
# Start x11vnc on the current DISPLAY, allowing unlimited reconnections (-forever),
69+
# using the stored password (-rfbauth), and listening on all interfaces.
70+
x11vnc -display $DISPLAY -forever -rfbauth /tmp/vnc_pass -listen 0.0.0.0 -xkb &
71+
72+
echo "Starting noVNC (websockify)..."
73+
# Start websockify to convert the VNC connection (port 5900) to WebSockets on port 6080.
74+
# --web points to the directory containing the noVNC HTML files (typically /usr/share/novnc)
75+
websockify --web=/usr/share/novnc 6080 localhost:5900 &
76+
5777
# Redirect cron logs to container stdout
5878
CRON_LOG=/var/log/cron.log
5979
touch $CRON_LOG
@@ -82,4 +102,4 @@ elif [ -n "$BACKUP_SCHEDULE" ]; then
82102
fi
83103

84104
# Keep the container running and logging
85-
tail -f $CRON_LOG /usr/NX/var/log/nxserver.log
105+
tail -f $CRON_LOG

docker/config/install_nomachine.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

docker/scripts/auto-export-data.sh

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
#!/bin/bash
22

3-
echo "Ensuring display remains active..."
4-
# Reinforce that blanking/DPMS is off before proceeding
5-
DISPLAY=:99 xset s off
6-
DISPLAY=:99 xset s noblank
7-
8-
echo "Ensuring 1Password window is active..."
9-
# Try to find the 1Password window and raise it
10-
WINDOW_ID=$(xdotool search --onlyvisible --name "1Password")
11-
if [ -n "$WINDOW_ID" ]; then
12-
echo "1Password window found (ID: $WINDOW_ID). Activating..."
13-
xdotool windowactivate "$WINDOW_ID"
14-
xdotool windowraise "$WINDOW_ID"
15-
sleep 1
16-
else
17-
echo "Warning: 1Password window not found. Proceeding..."
18-
fi
19-
203
echo "Starting auto-export-data script..."
214

225
echo "Opening the export menu..."
@@ -58,22 +41,22 @@ sleep 1
5841
### Non-Headless
5942

6043
# Go into the file directory to then save and start export process
61-
python3 /backuponepass/scripts/click_export_location.py
44+
# python3 /backuponepass/scripts/click_export_location.py
6245

6346
# -------------------------------------------------------------
6447

65-
### Headless
48+
# ### Headless
6649

67-
# echo "Navigating to the address bar to type the save location..."
68-
# xdotool key Ctrl+l
69-
# sleep 1
50+
echo "Navigating to the address bar to type the save location..."
51+
xdotool key Ctrl+l
52+
sleep 1
7053

71-
# echo "Typing the save location path..."
72-
# xdotool type "/backuponepass/data"
73-
# sleep 1
54+
echo "Typing the save location path..."
55+
xdotool type "/backuponepass/data"
56+
sleep 1
7457

75-
# echo "Confirming the save location..."
76-
# xdotool key Return
58+
echo "Confirming the save location..."
59+
xdotool key Return
7760

7861
# -------------------------------------------------------------
7962

docker/scripts/functions.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
#!/bin/bash
22

3+
# Helper function to ensure the 1Password window is active
4+
ensure_window_active() {
5+
WINDOW_ID=$(xdotool search --onlyvisible --name "1Password" | head -n 1)
6+
if [ -n "$WINDOW_ID" ]; then
7+
echo "Re-focusing 1Password window (ID: $WINDOW_ID)..."
8+
# Use windowfocus instead of windowactivate
9+
xdotool windowfocus "$WINDOW_ID"
10+
xdotool windowraise "$WINDOW_ID"
11+
else
12+
echo "Warning: 1Password window not found during reactivation."
13+
fi
14+
}
15+
316
# Function to enter 2FA code
417
enter_2fa() {
518
echo "Attempting to generate and enter 2FA code..."

0 commit comments

Comments
 (0)