Skip to content

Commit

Permalink
Merge pull request #36 from balena-io/update-go
Browse files Browse the repository at this point in the history
Rename and Update to Go v1.11.2
  • Loading branch information
wrboyce authored Nov 20, 2018
2 parents 2fc9ff4 + e1ba5f9 commit 9448877
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
24 changes: 12 additions & 12 deletions resin/README.md → balena/README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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` |
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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`.

4 changes: 2 additions & 2 deletions resin/auth.go → balena/auth.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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"
)

Expand Down
20 changes: 10 additions & 10 deletions resin/main.go → balena/main.go
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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 (
Expand All @@ -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"
Expand All @@ -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")
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions sshproxy.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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"
)

Expand Down

0 comments on commit 9448877

Please sign in to comment.