Skip to content

Command line utility to interact programmatically with Apache Guacamole

License

Notifications You must be signed in to change notification settings

CowDogMoo/guacinator

Repository files navigation

Guacinator

License Go Report Card 🚨 CodeQL Analysis 🚨 Semgrep Analysis Pre-Commit

Guacinator Logo

Guacinator is a command line utility to interact programmatically with Apache Guacamole.


Table of Contents


Getting Started

  1. Download and install the gh cli tool.

  2. Clone the repo:

    gh repo clone CowDogMoo/guacinator
    cd guacinator
  3. Get latest guacinator release:

    OS="$(uname | python3 -c 'print(open(0).read().lower().strip())')"
    ARCH="$(uname -a | awk '{ print $NF }')"
    gh release download -p "*${OS}_${ARCH}.tar.gz"
    tar -xvf *tar.gz

Dependencies

  • Install asdf:

    git clone https://github.com/asdf-vm/asdf.git ~/.asdf
  • Install and use asdf plugins to manage go, python, and ruby for this project:

    source .asdf

    Alternatively, you can pick and choose which plugins to install:

    # Employ asdf for this project's python:
    source .asdf python
  • Install pre-commit:

    python3 -m pip install --upgrade pip
    python3 -m pip install pre-commit
  • Install Mage:

    go install github.com/magefile/mage@latest

Usage

  • Compile guacinator (if not using downloaded release):

    go build
  • Create a new VNC connection in Guacamole:

    GUAC_URL=https://guacamole.techvomit.xyz
    CONNECTION_NAME=test-connection
    GUAC_USER=guacadmin
    GUAC_PW=guacadmin
    VNC_IP="$(kubectl get service -o wide | grep ubuntu-vnc | awk '{print $3}')"
    VNC_PW="$(kubectl exec -it deployments/ubuntu -- zsh -c 'vncpwd \
      /home/ubuntu/.vnc/passwd' | awk -F ' ' '{print $2}')"
    
    ./guacinator guacamole -u "${GUAC_USER}" -p "${GUAC_PW}" -l "${GUAC_URL}" \
      --connection "${CONNECTION_NAME}" --vnc-ip "${VNC_IP}" --vnc-pw "${VNC_PW}"
  • Update the guacadmin user's password in Guacamole:

    GUAC_URL=https://guacamole.techvomit.xyz
    GUAC_USER=guacadmin
    # Default unless changed
    GUAC_PW=guacadmin
    NEW_GUAC_PW=s1cknewpassword
    
    ./guacinator guacamole -u "${GUAC_USER}" -p "${GUAC_PW}" -l "${GUAC_URL}" \
      --guacadmin-pw "${NEW_GUAC_PW}"
  • Create a new Guacamole admin user:

    GUAC_URL=https://guacamole.techvomit.xyz
    GUAC_USER=guacadmin
    # Default password for the new account will be this:
    GUAC_PW=guacadmin
    NEW_GUAC_ADMIN=guacadmindos
    
    ./guacinator guacamole -u "${GUAC_USER}" -p "${GUAC_PW}" -l "${GUAC_URL}" \
      --new-admin "${NEW_GUAC_ADMIN}"
  • Delete a Guacamole user:

    GUAC_URL=https://guacamole.techvomit.xyz
    GUAC_USER=guacadmin
    GUAC_PW=guacadmin
    USER_TO_DELETE=someuser
    
    ./guacinator guacamole -u "${GUAC_USER}" -p "${GUAC_PW}" -l "${GUAC_URL}" \
    --delete-user "${USER_TO_DELETE}"

For Contributors and Developers

If you're a developer or contributor looking to work on Guacinator, follow these additional setup steps:

  1. Clone the repository and navigate to the project root:

    gh repo clone CowDogMoo/guacinator
    cd guacinator
  2. Install the dependencies:

    mage InstallDependencies