Skip to content

Commit

Permalink
Merge branch 'feature/remmina-support' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
davidalger committed Jul 27, 2020
2 parents 3876fee + 38a710b commit 2db99cc
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

**Enhancements:**

* Added `warden vnc` command to launch VNC tunnel via SSH or (when installed) launch Remmina ([#116](https://github.com/davidalger/warden/pull/116) by @lbajsarowicz)
* Updated `warden env`, `warden svc` and `warden db` to print help text when called without any parameters specified

## Version [0.7.0](https://github.com/davidalger/warden/tree/0.7.0) (2020-07-22)
Expand Down
45 changes: 45 additions & 0 deletions commands/vnc.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_DIR} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!\033[0m" && exit 1

WARDEN_ENV_PATH="$(locateEnvPath)" || exit $?
loadEnvConfig "${WARDEN_ENV_PATH}" || exit $?

if [[ ${WARDEN_SELENIUM} -ne 1 ]] || [[ ${WARDEN_SELENIUM_DEBUG} -ne 1 ]]; then
fatal "The project environment must have WARDEN_SELENIUM and WARDEN_SELENIUM_DEBUG enabled to use this command"
fi

WARDEN_SELENIUM_INDEX=${WARDEN_PARAMS[0]:-1}
WARDEN_SELENIUM_VNC=${WARDEN_ENV_NAME}_${WARDEN_PARAMS[1]:-selenium-chrome}_${WARDEN_SELENIUM_INDEX}

if ! which remmina >/dev/null; then
EXPOSE_PORT=$((5900 + WARDEN_SELENIUM_INDEX))

echo "Connect with your VNC client to 127.0.0.1:${EXPOSE_PORT}"
echo " Password: secret"
echo "You can also use URL: vnc://127.0.0.1:${EXPOSE_PORT}/?VncPassword=secret"
ssh -N -L localhost:${EXPOSE_PORT}:${WARDEN_SELENIUM_VNC}:5900 tunnel.warden.test
else

cat > "${WARDEN_ENV_PATH}/.remmina" <<-EOF
[remmina]
name=${WARDEN_SELENIUM_VNC} Debug
proxy=
ssh_enabled=1
colordepth=8
server=${WARDEN_SELENIUM_VNC}
ssh_auth=3
quality=9
scale=1
ssh_username=user
password=.
disablepasswordstoring=0
viewmode=1
window_width=1200
window_height=780
ssh_server=tunnel.warden.test:2222
protocol=VNC
EOF

echo -e "Launching VNC session via Remmina. Password is \"\033[1msecret\"\033[0m"
remmina -c "${WARDEN_ENV_PATH}/.remmina"
fi
11 changes: 11 additions & 0 deletions commands/vnc.help
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_DIR} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!\033[0m" && exit 1

WARDEN_USAGE=$(cat <<EOF
\033[33mUsage:\033[0m
vnc [index]
\033[33mOptions:\033[0m
-h, --help Display this help menu
EOF
)

0 comments on commit 2db99cc

Please sign in to comment.