Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,34 @@ component of our commercial offering for deploying and remotely [operating SaaS
3rd party enterprise infrastructure](https://gravitational.com/product).

For more info, drop us an email: [info@gravitational.com](mailto:info@gravitational.com)

## Building from source

Instructions below are for Ubuntu 17.04

Pre-requisites

1. Install golang >= 1.7: `sudo apt install golang-1.9`
- required for `context` (https://stackoverflow.com/a/42802790/4126114)
2. Verify version: `go version` (e.g. `go version go1.9.2 linux/amd64`)
3. Set `GOPATH`: `export GOPATH=$HOME/go`


To build the binaries

1. Clone this repository: `go get github.com/gravitational/teleconsole`
2. `cd $GOPATH/src/github.com/gravitational/teleconsole`
3. Install dependencies: `go get ./...` (add `-v` for higher verbosity)
4. Build binaries: `make`


To run tests

1. Install test dependencies: `get -t ./...`
2. Run tests: `make test`


To make a release

- `make release`
- check `Makefile` for more details
33 changes: 12 additions & 21 deletions lib/identity.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package lib

import (
"crypto/dsa"
"crypto/ecdsa"
"crypto/rsa"
"encoding/csv"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -35,7 +32,7 @@ import (
// and logs in using it.
//
// 2. A named identity uses a user-supplied SSH key, either via github handle
// or as a file (like ~/.ssh/id_rsa). Named identities private key never
// or as a file (like ~/.ssh/id_rsa.pub). Named identities private key never
// leaves the machine, but the joining party is supposed to have a private
// key on their machine to be able to join.
//
Expand Down Expand Up @@ -173,26 +170,20 @@ func loginFromFile(fp string) (*sshLogin, error) {
if err != nil {
return nil, trace.Wrap(err)
}
// parse the private key:
p, err := ssh.ParseRawPrivateKey(bytes)
if err != nil {
return nil, trace.Wrap(err)
}
// derive the public key from the private one:
var pubKey ssh.PublicKey = nil
switch pk := p.(type) {
case *rsa.PrivateKey:
pubKey, err = ssh.NewPublicKey(&pk.PublicKey)
case *dsa.PrivateKey:
pubKey, err = ssh.NewPublicKey(&pk.PublicKey)
case *ecdsa.PrivateKey:
pubKey, err = ssh.NewPublicKey(&pk.PublicKey)
default:
return nil, trace.Errorf("Unsupported SSH key format")
}
// parse the public key:
// https://godoc.org/golang.org/x/crypto/ssh#ParsePublicKey
pubKey, err := ssh.ParsePublicKey(bytes)
if err != nil {

// check if this was a private key and alert accordingly:
_, err := ssh.ParseRawPrivateKey(bytes)
if err == nil {
return nil, trace.Wrap(err, "Private keys are no longer supported. Check https://github.com/gravitational/teleconsole/issues/19 for more details")
}

return nil, trace.Wrap(err)
}

return &sshLogin{
Username: filepath.Base(fp),
Key: &client.Key{
Expand Down