Skip to content

Commit

Permalink
move content to the new documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
thorstenkramm committed Jul 28, 2022
1 parent f5db82b commit b3d6ca2
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 149 deletions.
163 changes: 15 additions & 148 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,160 +1,27 @@
# Rport CLI (v1)

Rport CLI is a tool to help you managing [rport API](https://github.com/cloudradar-monitoring/rport) directly from your terminal.

## Installation

### As a compiled binary

Jump to [our release page](https://github.com/cloudradar-monitoring/rportcli/releases/tag/v0.0.1pre1) and download a binary for your host OS. Don't forget to download a corresponding md5 file as well.

# On MacOS
wget https://github.com/cloudradar-monitoring/rportcli/releases/download/v0.0.1pre1/rportcli-v0.0.1pre1-darwin-amd64.tar.gz

# On linux
wget https://github.com/cloudradar-monitoring/rportcli/releases/download/v0.0.1pre1/rportcli-v0.0.1pre1-linux-386.tar.gz

# On Windows
Just download https://github.com/cloudradar-monitoring/rportcli/releases/download/v0.0.1pre1/rportcli-v0.0.1pre1-windows-amd64.zip
Also download https://github.com/cloudradar-monitoring/rportcli/releases/download/v0.0.1pre1/rportcli-v0.0.1pre1-windows-amd64.zip.md5

Verify the checksum:

#On MacOS
curl -Ls https://github.com/cloudradar-monitoring/rportcli/releases/download/v0.0.1pre1/rportcli-v0.0.1pre1-darwin-amd64.tar.gz.md5 | sed 's:$: rportcli-v0.0.1pre1-darwin-amd64.tar.gz:' | md5sum -c

#On linux
curl -Ls https://github.com/cloudradar-monitoring/rportcli/releases/download/v0.0.1pre1/rportcli-v0.0.1pre1-linux-386.tar.gz.md5 | sed 's:$: rportcli-v0.0.1pre1-linux-386.tar.gz:' | md5sum -c

#On Windows assuming you're in the directory with the donwloaded file
CertUtil -hashfile rportcli-v0.0.1pre1-windows-amd64.zip MD5

#The output will be :
MD5 hash of tacoscript-0.0.4pre-windows-amd64.zip:
7103fcda170a54fa39cf92fe816833d1
CertUtil: -hashfile command completed successfully.

#Compare the command output to the contents of file rportcli-v0.0.1pre1-windows-amd64.zip.md5 they should match

_Note: if the checksums didn't match please skip the installation!_

Unpack and install the rportcli binary on your host machine

#On linux/MacOS
tar -xzvf rportcli-v0.0.1pre1-darwin-amd64.tar.gz
mv rportcli /usr/local/bin/rportcli
chmod +x /usr/local/bin/rportcli

For Windows

- Extract file contents

- Create a `RportCLI` folder in `C:\Program Files`

- Copy the rportcli.exe binary to `C:\Program Files\RportCLI`

- Double click on the rportcli.exe and allow it's execution

## Install as a go binary:

go get github.com/cloudradar-monitoring/rportcli

## Server Authentication

The rportcli requires authentication with the rportd server. The most straightforward
method is to use environment variables with an API token.

Alternatively a username and password can be specified again via environment variables.
However, if 2fa is enabled then this approach will not work, and it will be necessary to
use the config.json file and a authentication token (see below).

Finally, a username and password can be provided to the init command which then authorises
with the rportd server and saves a authentication token locally (to a config file). The authentication token
is valid for 30 days and will automatically be used by rportcli without further authentication.
The init command will need to be run again after the 30 days expires to reauthorise the user
and download a new authentication token.

_Note_

_RPORT_API_USER, RPORT_API_PASSWORD and RPORT_API_URL replace the previous RPORT_USER,
RPORT_PASSWORD and RPORT_SERVER_URL environment variables. Please update any scripts
accordingly. Support for RPORT_USER, RPORT_PASSWORD and RPORT_SERVER_URL will be removed
in a future release._

### Using RPORT_API_TOKEN

The easiest and most flexible way to authenticate with the rportd server is to use an API
token. Using RPORT_API_TOKEN will bypass 2 factor authentication, allowing the rport cli to
be used in automated scenarios.

Also, if using RPORT_API_TOKEN then the config file will be ignored completed, so the
RPORT_API_URL must be used.

For example

export RPORT_API_URL=http://localhost:3000
export RPORT_API_USER=admin
export RPORT_API_TOKEN=xxxxxxxx
#now you can run any rportcli command without config or 2fa
rportcli client list

_Note that it is not possible to use the init commmand (see below) when using an api token._

### Using RPORT_API_PASSWORD

For example

export RPORT_API_URL=http://localhost:3000
export RPORT_API_USER=admin
export RPORT_API_PASSWORD=foobaz
#now you can run any rportcli command without config
rportcli client list

The cli will complain if both the api token and the password are set. Please use one or the other.

### Using config.json and a cached Authentication Token

This method for authentication is useful when not using an API token but 2fa is enabled. The `init` command
will download an authentication token that will be cached in the config.json until expires. With a valid token
the user does not need to reauthenticate each use of the cli.

Rportcli looks for the config file at \$HOME/.config/rportcli/config.json (for Linux and MacOS) or C:\Users\<CurrentUserName>\.config\rportcli\config.json (for Windows).
If current user has no home folder, RportCli will look for a config file next to the current binary location.

You can override config path by providing env variable CONFIG_PATH, e.g.

CONFIG_PATH=/tmp/config.json rportcli init

You can generate config by running:

rportcli init

Rportcli will interactively ask for config options and validate the result:
You'll get request for following parameters:

**server address**

address of rport server, e.g. `http://localhost:3000`

**login**
[![License](https://img.shields.io/github/license/cloudradar-monitoring/rportcli?style=for-the-badge)](https://github.com/cloudradar-monitoring/rportcli/blob/main/LICENSE)
# Rport CLI (v1)

basic auth login to access rport server, e.g. `admin`
Rport CLI is a tool to help you managing your remote machines connected
to the [rport API](https://github.com/cloudradar-monitoring/rport) directly from your terminal.

**password**
The rport command line interface `rportcli` is a great addition to the rport server. Executing some tasks on the
command line can be much faster and more efficient than doing it on the web user interface.

basic auth password to access rport server, e.g. `foobaz`
Rportcli does not cover all functions of the user interface. On the other hand, you can do things on the command line,
you cannot do on the user interface.

You can skip the interactive wizard by providing parameters as cli options , e.g.
Integrates well with:

rportcli init -s http://localhost:3000 -l admin -p foobaz
![](https://img.shields.io/badge/Powershell-2CA5E0?style=for-the-badge&logo=powershell&logoColor=white)
![](https://img.shields.io/badge/GNU%20Bash-4EAA25?style=for-the-badge&logo=GNU%20Bash&logoColor=white)
![](https://img.shields.io/badge/GIT-E44C30?style=for-the-badge&logo=git&logoColor=white)

You can also use a hybrid variant, where e.g. user and server url are provided as config options and password as an environment variable.
## Documentation

rportcli init -s http://localhost:3000 -l admin
export RPORT_API_PASSWORD=foobaz
rportcli client list
[![documentation](https://img.shields.io/badge/Documentation-Read_Now-green?style=for-the-badge&logo=Gitbook)](https://cli.rport.io)

After the authentication token expires, it will be necessary to run `init` again to reauthorise and update the token.
Read the documentation on [https://cli.rport.io/](https://cli.rport.io/)

## Using the Cli

Expand Down
2 changes: 1 addition & 1 deletion docs/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
baseURL = 'http://example.org/'
baseURL = 'https://cli.rport.io/'
languageCode = 'en-us'
title = 'RPort CLI - work faster from the command line'
theme = "hugo-geekdoc"
Expand Down
8 changes: 8 additions & 0 deletions docs/content/get-started/01-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ $Env:PATH="$Env:PATH;C:\Program Files\rportcli\bin"
& rportcli --version
```

## Install as a go binary

If you have go installed, try the following

```shell
go get github.com/cloudradar-monitoring/rportcli
```

## Update

To update rportcli to the latest version, perform the above steps to overwrite your existing version
Expand Down
21 changes: 21 additions & 0 deletions docs/content/get-started/02-authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,22 @@ If you do that for the first time, you will be informed about the new configurat

Test the connection by executing `rportcli me`.

Rportcli looks for the config file at `\$HOME/.config/rportcli/config.json` (for Linux and macOS) or
`C:\Users\<CurrentUserName>\.config\rportcli\config.json` (for Windows).
If the current user has no home folder, RportCli will look for a config file next to the current binary location.

You can override config path by providing an environment variable CONFIG_PATH, e.g.
`CONFIG_PATH=/tmp/config.json rportcli init`.

## by API token

The easiest and most flexible way to authenticate with the rportd server is to use an API
token stored as environment variable. Using `RPORT_API_TOKEN` will bypass two-factor authentication,
allowing the rport cli to be used in automated scenarios.

Also, if using RPORT_API_TOKEN then the config file will be ignored completed, so the
`RPORT_API_URL` must be used.

If you have created an API token for your user account, put the following variables to your environment:
`RPORT_API_TOKEN`, `RPORT_API_URL`, `RPORT_API_USER`.

Expand All @@ -45,3 +59,10 @@ If you have created an API token for your user account, put the following variab
$env:RPORT_API_USER="john"
{{< /tab >}}
{{< /tabs >}}

## deprecation notes

`RPORT_API_USER`, `RPORT_API_PASSWORD` and `RPORT_API_URL` replace the previous `RPORT_USER`,
`RPORT_PASSWORD` and `RPORT_SERVER_URL` environment variables. Please update any scripts
accordingly. Support for `RPORT_USER`, `RPORT_PASSWORD` and `RPORT_SERVER_URL` will be removed
in a future release.

0 comments on commit b3d6ca2

Please sign in to comment.