diff --git a/.circleci/config.yml b/.circleci/config.yml index bcce089..0136fdb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,9 +2,9 @@ version: 2 jobs: build: - working_directory: /go/src/github.com/resin-io/sshproxy + working_directory: /go/src/github.com/balena-io/sshproxy docker: - - image: golang:1.10.2 + - image: golang:1.11.2 steps: - checkout - run: diff --git a/Makefile b/Makefile index d7f032b..346d33d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -USERNAME ?= resin-io +USERNAME ?= balena-io PROJECT ?= sshproxy -PACKAGE ?= resin +PACKAGE ?= balena EXECUTABLE ?= sshproxy VERSION := $(shell git describe --abbrev=0 --tags) BUILD_PLATFORMS ?= darwin/amd64 linux/386 linux/arm linux/arm64 linux/amd64 @@ -14,7 +14,7 @@ dep: lint-dep: dep go get github.com/kisielk/errcheck - go get github.com/golang/lint/golint + go get golang.org/x/lint/golint go get golang.org/x/tools/cmd/goimports lint: lint-dep diff --git a/README.md b/README.md index 18dfb90..2eb55d1 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # sshproxy -[![GoDoc](https://godoc.org/github.com/resin-io/sshproxy?status.svg)](https://godoc.org/github.com/resin-io/sshproxy) -[![Go Report Card](https://goreportcard.com/badge/github.com/resin-io/sshproxy)](https://goreportcard.com/report/github.com/resin-io/sshproxy) -[![CircleCI](https://circleci.com/gh/resin-io/sshproxy.png?style=shield)](https://circleci.com/gh/resin-io/sshproxy) +[![GoDoc](https://godoc.org/github.com/balena-io/sshproxy?status.svg)](https://godoc.org/github.com/balena-io/sshproxy) +[![Go Report Card](https://goreportcard.com/badge/github.com/balena-io/sshproxy)](https://goreportcard.com/report/github.com/balena-io/sshproxy) +[![CircleCI](https://circleci.com/gh/balena-io/sshproxy.png?style=shield)](https://circleci.com/gh/balena-io/sshproxy) sshproxy is a simple ssh server library exposing an even simpler API. Authentication is handled by providing a ServerConfig, allowing diff --git a/resin/README.md b/balena/README.md similarity index 82% rename from resin/README.md rename to balena/README.md index 212fbc7..e874d23 100644 --- a/resin/README.md +++ b/balena/README.md @@ -1,6 +1,6 @@ -# sshproxy/resin +# sshproxy/balena -A "resin-ready" binary, requiring minimal configuration. +A "balena-ready" binary, requiring minimal configuration. Configuration is possible via commandline flags, environment variables and config files. @@ -19,8 +19,8 @@ they can all be set via commandline, environment or config file. | Name | Commandline | Environment | Config | |--------------------|-----------------------------|-------------------------------|----------------------| -| API Host | `--apihost` `-H` | `RESIN_API_HOST` | `apihost` | -| API Port | `--apiport` `-P` | `RESIN_API_PORT` | `apiport` | +| API Host | `--apihost` `-H` | `BALENA_API_HOST` | `apihost` | +| API Port | `--apiport` `-P` | `BALENA_API_PORT` | `apiport` | | API Key | `--apikey` `-K` | `SSHPROXY_API_KEY` | `apikey` | | Dir | `--dir` `-d` | `SSHPROXY_DIR` | | | Port | `--port` `-p` | `SSHPROXY_PORT` | `port` | @@ -35,9 +35,9 @@ they can all be set via commandline, environment or config file. ``` Usage of sshproxy: -E, --allow-env Pass environment from client to shell (default: false) (warning: security implications) - -H, --apihost string Resin API Host (default "api.resin.io") - -K, --apikey string Resin API Key (required) - -P, --apiport string Resin API Port (default "443") + -H, --apihost string Balena API Host (default "api.balena-cloud.com") + -K, --apikey string Balena API Key (required) + -P, --apiport string Balena API Port (default "443") -b, --auth-failed-banner string Path to template displayed after failed authentication -d, --dir string Work dir, holds ssh keys and sshproxy config (default "/etc/sshproxy") -m, --max-auth-tries int Maximum number of authentication attempts per connection (default 0; unlimited) @@ -57,18 +57,18 @@ The 'auth failed banner' is a template rendered and displayed to the user after ## Example Usage ``` -% go get github.com/resin-io/sshproxy/resin +% go get github.com/balena-io/sshproxy/balena % export SSHPROXY_DIR=$(mktemp -d /tmp/sshproxy.XXXXXXXX) % echo -e '#!/usr/bin/env bash\nenv' > ${SSHPROXY_DIR}/shell.sh && chmod +x ${SSHPROXY_DIR}/shell.sh SSHPROXY_PORT=2222 \ SSHPROXY_API_KEY=... \ - go run ${GOPATH}/src/github.com/resin-io/sshproxy/resin/main.go + go run ${GOPATH}/src/github.com/balena-io/sshproxy/balena/main.go ... % ssh -o 'StrictHostKeyChecking=no' \ -o 'UserKnownHostsFile=/dev/null' \ - resin@localhost -p2222 -- some command + balena@localhost -p2222 -- some command Warning: Permanently added '[localhost]:2222' (RSA) to the list of known hosts. -SSH_USER=resin +SSH_USER=balena PWD=... LANG=en_GB.UTF-8 SHLVL=1 @@ -81,5 +81,5 @@ _=/usr/bin/env The `Makefile` in the project root contains all necessary rules for linting, testing and building sshproxy packages. Building via a Docker image can be achieved with, for example: -`docker run --rm -v $PWD:/go/src/github.com/resin-io/sshproxy golang make -C /go/src/github.com/resin-io/sshproxy lint test release`. +`docker run --rm -v $PWD:/go/src/github.com/balena-io/sshproxy golang make -C /go/src/github.com/balena-io/sshproxy lint test release`. diff --git a/resin/auth.go b/balena/auth.go similarity index 98% rename from resin/auth.go rename to balena/auth.go index 0eab552..1f3a0bc 100644 --- a/resin/auth.go +++ b/balena/auth.go @@ -1,5 +1,5 @@ /* -Copyright 2017 Resin.io +Copyright 2017 Balena Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import ( "strings" "text/template" - "github.com/resin-io/pinejs-client-go" + "github.com/balena-io/pinejs-client-go" "golang.org/x/crypto/ssh" ) diff --git a/resin/main.go b/balena/main.go similarity index 89% rename from resin/main.go rename to balena/main.go index 8c49b1c..c132fd4 100644 --- a/resin/main.go +++ b/balena/main.go @@ -1,5 +1,5 @@ /* -Copyright 2017 Resin.io +Copyright 2017 Balena Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. */ -// A "resin-ready" binary which handles authentication via resin api, +// A "balena-ready" binary which handles authentication via balena api, // requiring minimal configuration. // -// See https://github.com/resin-io/sshproxy/tree/master/resin#readme +// See https://github.com/balena-io/sshproxy/tree/master/balena#readme package main import ( @@ -29,8 +29,8 @@ import ( "runtime" "syscall" + "github.com/balena-io/sshproxy" "github.com/getsentry/raven-go" - "github.com/resin-io/sshproxy" "github.com/spf13/pflag" "github.com/spf13/viper" "golang.org/x/crypto/ssh" @@ -39,9 +39,9 @@ import ( var version string func init() { - pflag.CommandLine.StringP("apihost", "H", "api.resin.io", "Resin API Host") - pflag.CommandLine.StringP("apiport", "P", "443", "Resin API Port") - pflag.CommandLine.StringP("apikey", "K", "", "Resin API Key (required)") + pflag.CommandLine.StringP("apihost", "H", "api.balena-cloud.com", "Balena API Host") + pflag.CommandLine.StringP("apiport", "P", "443", "Balena API Port") + pflag.CommandLine.StringP("apikey", "K", "", "Balena API Key (required)") pflag.CommandLine.StringP("dir", "d", "/etc/sshproxy", "Work dir, holds ssh keys and sshproxy config") pflag.CommandLine.IntP("port", "p", 22, "Port the ssh service will listen on") pflag.CommandLine.StringP("shell", "s", "shell.sh", "Path to shell to execute post-authentication") @@ -59,10 +59,10 @@ func init() { if err := viper.BindPFlags(pflag.CommandLine); err != nil { return err } - if err := viper.BindEnv("apihost", "RESIN_API_HOST"); err != nil { + if err := viper.BindEnv("apihost", "BALENA_API_HOST"); err != nil { return err } - if err := viper.BindEnv("apiport", "RESIN_API_PORT"); err != nil { + if err := viper.BindEnv("apiport", "BALENA_API_PORT"); err != nil { return err } if err := viper.BindEnv("apikey", "SSHPROXY_API_KEY"); err != nil { @@ -113,7 +113,7 @@ func main() { // API Key is required if viper.GetString("apikey") == "" { - fmt.Fprintln(os.Stderr, "Error: Resin API Key is required.") + fmt.Fprintln(os.Stderr, "Error: Balena API Key is required.") pflag.Usage() os.Exit(2) } diff --git a/sshproxy.go b/sshproxy.go index 7883af3..fadcc56 100644 --- a/sshproxy.go +++ b/sshproxy.go @@ -1,5 +1,5 @@ /* -Copyright 2017 Resin.io +Copyright 2017 Balena Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ import ( "syscall" "time" - "github.com/resin-io-modules/gexpect/pty" + "github.com/balena-io-modules/gexpect/pty" "golang.org/x/crypto/ssh" )