shellgraph

Install the collector

Build the collector, copy it to the collector machine and log it in to the server.

Select the collector machine

Install the collector on a machine that can:

  • Connect to the target hosts with SSH, for example a jump host in the VLAN.
  • Connect to the server with HTTPS.

The collector runs on Linux and macOS, on amd64 and arm64. One collector machine can scan many VLANs.

Build

  1. Clone the repository and go to it.

    git clone https://git.rda.run/shellgraph/collector.git
    cd collector
    
  2. Build the binaries.

    make build
    

    The result is in bin/:

    bin/shellgraph-linux-amd64
    bin/shellgraph-linux-arm64
    bin/shellgraph-darwin-amd64
    bin/shellgraph-darwin-arm64
    
  3. Copy the binary for the collector machine to a directory in the PATH, with the name shellgraph.

    install -m 755 bin/shellgraph-linux-amd64 /usr/local/bin/shellgraph
    

To build for the current machine only, use make build-local. The result is bin/shellgraph.

To build the container image shellgraph:<version>, use make image. The image is for linux/amd64. For arm64, use make image ARCH=arm64. See Run in a container.

Log in to the server

  1. In the server UI, create a collector token. See Prepare an Environment.

  2. On the collector machine, run the login command that the UI shows.

    shellgraph login --server https://shellgraph.example.net --token <token>
    

The collector tests the token and writes the server URL and the token to its configuration file. For the location of the file, see Command line.

Run in a container

The image has the binary and the public CA certificates. It runs as the user 10001. The collector gets the SSH keys from the server, so the container needs only the server URL and the token.

  1. Put the server URL and the token in a file, for example /etc/shellgraph/collector.env.

    SHELLGRAPH_SERVER=https://shellgraph.example.net
    SHELLGRAPH_TOKEN=<token>
    
  2. Make the file readable only by root.

    chmod 600 /etc/shellgraph/collector.env
    
  3. Run a scan. The flags -it are necessary for the menus. With --env and --vlan, the scan does not show menus.

    podman run -it --rm --env-file /etc/shellgraph/collector.env shellgraph:<version> scan
    

You can also use shellgraph login in the container. Then mount a volume on /home/shellgraph/.config/shellgraph to keep the configuration file.

Protect the collector machine

The token can read the SSH keys of all VLANs.

  1. Make the collector machine accessible only to the operators.
  2. Make one token for each collector machine.
  3. If a machine is lost, revoke its token in the server UI.

Check the version

shellgraph version