Skip to content

qbee-cli command line tool and Go client module

License

Notifications You must be signed in to change notification settings

qbee-io/qbee-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qbee-cli

qbee-cli is a client library and a command line tool used to interact with qbee.io IoT/Linux device management platform.

Use as command line tool

Download the binary

Open the releases page, scroll down to Assets and download the latest version for your platform.

NOTE: The binary is not signed, so you might need to allow it to run in your system settings. For Windows, you need to add ".exe" to the binary name.

Build the binary

go build -o qbee-cli ./cmd

Providing credentials

Currently, the only way to provide credentials is through environmental variables: QBEE_EMAIL & QBEE_PASSWORD.

If your account is configured with two-factor authentication, you will either be prompted for which of your configured 2FA providers you want to use, or you can set the QBEE_2FA_CODE environment variable to provide a code for the Google provider directly.

Please remember to rotate your credentials regularly.

Run latest using Go

go run go.qbee.io/client/cmd@latest

Remote access using qbee-cli

export QBEE_EMAIL=<email>
export QBEE_PASSWORD=<password>

qbee-cli connect -d <deviceID> -t <target>[,<target> ...]

Where:

  • deviceID identifies to which device we want to connect (public key digest)
  • target defines a singe port forwarding target as [<localHost>:]<localPort>:<remoteHost>:<remotePort>
  • localHost is optional and defaults to localhost to only listen on the loopback interface
  • localPort is the local port on which tunnel will listen for connections/packets
  • remoteHost must be set to localhost
  • remotePort is the remote port on which tunnel will connect to on the device

Use as a Go module

package demo

import (
	"context"
	"log"
	"os"

	"go.qbee.io/client"
)

func main() {
	cli := client.New()
	ctx := context.Background()

	email := os.Getenv("QBEE_EMAIL")
	password := os.Getenv("QBEE_PASSWORD")

	if err := cli.Authenticate(ctx, email, password); err != nil {
		log.Fatalf("authentication failed: %v", err)
	}
}

Contributing

We welcome contributions to this project! Please see Contribution License Agreement for more information.