Commit Graph
105 Commits
Author SHA1 Message Date
Han-Wen Nienhuys 73e99326fb go.crypto/ssh: separate kex algorithms into kexAlgorithm class.
Adds readPacket() to conn, and renames conn to packetConn.
Key exchanges operate on packetConn, so they can be
unittested.

R=agl, jpsugar, dave
CC=golang-dev
https://golang.org/cl/13352055
2013-09-24 12:26:29 -04:00
Han-Wen Nienhuys 934c14ffe9 go.crypto/ssh: introduce Signer method, an abstraction of
private keys.

R=agl, jpsugar, jonathan.mark.pittman
CC=golang-dev
https://golang.org/cl/13338044
2013-09-19 14:45:31 -04:00
Adam Langley 28dc961a18 go.crypto/ssh/terminal: fix non-ASCII history.
The length of history buffer entries (which are stored as strings) was
being used as the number of runes. This was correct until ff9ce887b46b,
which allowed unicode entry, but can now cause a panic when editing
history that contains non-ASCII codepoints.

R=golang-dev, sfrithjof, r
CC=golang-dev
https://golang.org/cl/13255050
2013-09-15 12:48:02 -04:00
Adam Langley cb60f353cb go.crypto/ssh/terminal: support Unicode entry.
Previously, terminal only supported ASCII characters. This change
alters some []byte to []rune so that the full range of Unicode is
supported. The only thing that doesn't appear to work correctly are
grapheme clusters as the code still assumes one rune per glyph. Still,
this change allows many more languages to work than did previously.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13704043
2013-09-13 14:33:00 -04:00
Han-Wen Nienhuys e62b2aead4 go.crypto/ssh: introduce PublicKey interface type.
Public functions affected:
-AgentKey.Key
-AgentClient.SignRequest
-ClientKeyring.Key
-MarshalPublicKey
-ParsePublicKey

R=agl, jpsugar, jmpittman
CC=golang-dev
https://golang.org/cl/13642043
2013-09-13 14:25:14 -04:00
Jonathan Pittman 6a743c56c7 go.crypto/ssh: Begin adding server side support for more than RSA for client key auth
R=agl, dave, hanwen
CC=ekg, golang-dev
https://golang.org/cl/13528044
2013-09-09 13:06:04 -04:00
Han-Wen Nienhuys f17d130281 go.crypto/ssh: remove misleading marshalPrivRSA.
Properly capitalize publicKey throughout.

R=golang-dev
CC=agl, dave, golang-dev, jpsugar
https://golang.org/cl/13415046
2013-09-05 11:36:51 -04:00
Han-Wen Nienhuys ffadfa6648 go.crypto/ssh/test: Only show SSHD debug output if test fails.
R=agl, dave, jpsugar
CC=golang-dev
https://golang.org/cl/13438043
2013-09-03 10:54:19 -04:00
Alex Brainman 665213f561 go.crypto/ssh: use 127.0.0.1 during TestKexAlgorithms (fixes windows build)
R=golang-dev, mikioh.mikioh, remyoudompheng
CC=golang-dev
https://golang.org/cl/13370043
2013-08-29 12:57:42 +10:00
JP Sugarbroad a1beccb9f0 go.crypto/ssh: Update Dial to perform remote resolution of DNS names.
R=agl
CC=golang-dev
https://golang.org/cl/13010047
2013-08-28 17:51:56 -04:00
Han-Wen Nienhuys a93ee0c91a go.crypto/ssh: Use net.UnixConn for connecting client and sshd.
This obviates custom code to emulate a thread-safe connection.

Use this for testing that listeners close if the connection breaks.

R=dave, agl, fullung
CC=golang-dev
https://golang.org/cl/11781043
2013-08-28 12:41:55 -04:00
Han-Wen Nienhuys d7d50b0a7c go.crypto/ssh: implement ECDH.
Implement elliptic-curve Diffie-Hellman, including host key signature
verification.

Moves host key cryptographic verification to ClientConn.handshake(), so
RSA host keys are also verified.

Fixes golang/go#6158.

R=dave, agl
CC=golang-dev
https://golang.org/cl/13021045
2013-08-28 10:50:25 -04:00
Adam Langley b725ff72eb go.crypto/ssh/terminal: handle ^W, ^K and ^H
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13207043
2013-08-28 07:36:04 -04:00
JP Sugarbroad c2c80b64c0 crypto/ssh: Allow customization of the client version.
R=agl, golang-dev, dave
CC=golang-dev
https://golang.org/cl/13176044
2013-08-27 13:40:08 -04:00
JP Sugarbroad 504f1d5525 crypto/ssh: Handle msgUserAuthBanner during keyboard-interactive auth.
R=agl, golang-dev
CC=golang-dev
https://golang.org/cl/12983046
2013-08-27 11:23:31 -04:00
Han-Wen Nienhuys 4dc7c8e2f4 go.crypto/ssh: seed random generator, so auto port allocation is truly random.
R=agl, dave
CC=golang-dev
https://golang.org/cl/12027043
2013-07-29 13:09:39 -04:00
Han-Wen Nienhuys 2d394e3025 go.crypto/ssh: add workaround for broken port forwarding in
OpenSSH 5.

Tested with OpenSSH_5.9

R=agl, dave
CC=golang-dev
https://golang.org/cl/11921043
2013-07-26 14:37:37 -04:00
Han-Wen Nienhuys 7f7cbbf18e go.crypto/ssh: close channel feeding tcpListener.
Close both on closing the listener, and on closing the
connection. Test the former case.

R=dave
CC=golang-dev
https://golang.org/cl/11349043
2013-07-22 21:50:13 +10:00
Adam Langley c4978816b9 go.crypto/ssh/terminal: support Go 1.0.
For those still stuck on Go 1.0.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11297043
2013-07-15 18:01:31 -04:00
Adam Langley c4711a569a go.crypto/ssh/terminal: don't save passwords in history.
The history buffer would recall previously entered lines: including passwords. With this change, lines entered while echo is disabled are no longer put into the history.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10853043
2013-07-02 19:46:13 -04:00
Han-Wen Nienhuys afdc305bc8 go.crypto/ssh: add hook for host key checking.
R=dave, agl
CC=gobot, golang-dev
https://golang.org/cl/9922043
2013-06-21 12:46:35 -04:00
Han-Wen Nienhuys 7cbb17fecb go.crypto/ssh: fix test breakages introduced by 125:40246d2ae2eb
* Remove special handling for dynamically allocated
  ports. This was a bug in OpenSSH 5.x sshd.

* Run the test with a preselected port number.

* Run TestPortForward only on unix platforms.

R=dave, agl
CC=golang-dev
https://golang.org/cl/10049045
2013-06-18 12:43:42 -04:00
Han-Wen Nienhuys b9b3892677 go.crypto/ssh/test: Run sshd with -e, so the debug output goes onto stderr.
R=dave, agl
CC=golang-dev
https://golang.org/cl/10230043
2013-06-18 21:50:58 +10:00
Han-Wen Nienhuys 0d8dc3cd6a go.crypto/ssh: fix and test port forwarding.
Set maxPacket in forwarded connection, and use the requested port
number as key in forwardList.

R=golang-dev, agl, dave
CC=golang-dev
https://golang.org/cl/9753044
2013-06-11 22:10:15 -04:00
Adam Langley aa0f5b4081 go.crypto: revert 7f5a59ff6b43.
This change reverts https://golang.org/cl/10113043/ because
some folks are stuck on 1.0 till 1.1.1 comes out.

R=golang-dev
CC=golang-dev
https://golang.org/cl/10151043
2013-06-10 10:57:00 -04:00
Adam Langley eca6c1626e go.crypto: remove unreachable code.
I ran go vet over all of go.crypto and removed lots of panic("unreachable") that are no longer needed.

R=golang-dev, r, dgryski
CC=golang-dev
https://golang.org/cl/10113043
2013-06-07 16:05:15 -04:00
Adam Langley 59566675d5 ssh/terminal: support home, end, up and down keys.
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/9777043
2013-06-07 10:21:53 -04:00
Han-Wen Nienhuys c7df565dd4 go.crypto/ssh: implement keyboard-interactive auth (RFC 4256), both
on client and server-side.

R=dave, agl
CC=gobot, golang-dev
https://golang.org/cl/9853050
2013-06-06 10:44:12 -04:00
Han-Wen Nienhuys 36bf31eb71 go.crypto/ssh: add a error return to decode(), and avoid casting decode() output.
R=dave, kardianos, agl
CC=gobot, golang-dev
https://golang.org/cl/9738053
2013-06-06 10:24:21 -04:00
Dave Cheney e8889f5e72 go.crypto/ssh: fix race on mock ssh network connection
Fixes golang/go#5138.
Fixes golang/go#4703.

This appears to pass my stress tests with and without the -race detector, but I'd like to see others hit it with their machines.

R=golang-dev, fullung, huin, kardianos, agl
CC=golang-dev
https://golang.org/cl/9929043
2013-06-05 11:19:21 +10:00
Dave Cheney 1a6f1e67fb go.crypto/ssh: fix test breakage
Followup CL for 9711043. The order that CombinedOutput returns data captured from stdout/stderr is not specified, so we have to test both variants.

Thanks to fullung for the bug report.

R=fullung, kr
CC=golang-dev
https://golang.org/cl/9921044
2013-06-01 10:58:02 +10:00
Keith Rarick 0e971cde33 ssh: add Output and CombinedOutput helpers
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/9711043
2013-05-29 16:06:18 +10:00
David Symonds ac9976b0b7 go.crypto/ssh: More error reporting improvements.
R=golang-dev, kardianos, dave
CC=golang-dev
https://golang.org/cl/8596047
2013-04-26 09:44:04 +10:00
David Symonds 41998200eb go.crypto/ssh/test: Replace FailNow with Fail where it is obvious that the test doesn't want to fail now.
Improve a couple of test error messages too.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8661045
2013-04-23 12:15:38 +10:00
David Symonds 952dc41929 go.crypto/ssh/test: Fix distracting nil pointer dereference in a test.
If cgo is disabled (such as it appears to be on a subset of builders),
username() panics, and s.cmd is nil; let's not panic while recovering
from a different panic.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/8820043
2013-04-17 17:40:33 +10:00
David Symonds c7af4ef7d9 go.crypto/ssh/test: improve diagnostics for test failing to get username.
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/8817043
2013-04-17 16:22:42 +10:00
Albert Strasheim 62eb5d3fac go.crypto/ssh/test: wait on sshd process in tests
R=dave
CC=golang-dev
https://golang.org/cl/8449043
2013-04-07 19:26:33 +10:00
Adam Langley 1ddfbba54b go.crypto/ssh: fix tests with -cpu 1,2.
When running the ssh tests several times (e.g. with -cpu 1,2), the
second run would fail because testing globals had been altered. This
change avoids altering the globals since the default worked anyway.

Fixes golang/go#4715.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7903045
2013-03-22 15:51:39 -04:00
Adam Langley dc703e91d7 ssh/test: deflake session test.
The session test previously had a one second timeout for the output of
stty and this was leading to flakiness. This change removes the timeout
since go test has a generic timeout mechanism.

Additionally, the test was looking for "-echo" in the output to test
the value of the echo flag. However, there are also typically "echoe",
"echok" and "echonl" flags, and "-echo" could be a prefix of any of
time. Thus we now also match a trailing space.

R=golang-dev, rsc, extraterrestrial.neighbour
CC=golang-dev
https://golang.org/cl/7579043
2013-03-08 10:09:40 -05:00
Adam Langley db732cbcc6 ssh/terminal: add darwin support.
terminal contains a number of utility functions that are currently only
implemented for Linux. Darwin uses different named constants for
getting and setting the terminal state so this change splits them off
as constants and defines them for each arch.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7286043
2013-02-04 10:36:09 -05:00
Adam Langley 03be8f3bf0 ssh/terminal: add GetState and make ReadPassword work in raw mode.
GetState is useful for restoring the terminal in a signal handler.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6990043
2012-12-22 11:02:28 -05:00
Eric Milliken 61ab4d36df go.crypto/ssh: support OpenSSH keepalives
Fixes golang/go#4552.

R=minux.ma, agl
CC=golang-dev
https://golang.org/cl/6948059
2012-12-18 11:33:58 -05:00
Jonathan Pittman d95b28330d go.crypto/ssh: some cleanup
Simplify MarshalAuthorizedKey by using the algoName func.
Make the algoName func be very specific about supported key types in openssh certs.
Generalize some of the commentary that previously mentioned specific key types.

R=agl, dave
CC=golang-dev
https://golang.org/cl/6938067
2012-12-16 10:47:10 -05:00
Mikio Hara eeef66c528 go.crypto: gofmt -w -s
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6948057
2012-12-15 14:19:17 +09:00
Jonathan Pittman 54c65aebf4 go.crypto/ssh: Miscellaneous changes up for discussion.
Export key and certificate algorithm names.
Switch from string literals over to using the constants for any key/cert algorithm references.
Make URL references visible in the godoc web display.
Standardize url reference names with surrounding [].

R=dave, agl, jonathan.mark.pittman
CC=golang-dev
https://golang.org/cl/6944047
2012-12-14 10:11:06 -05:00
Alex Brainman 97c15b3da8 go.crypto/ssh/test: move some variables into common os source file to fix windows build
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6944048
2012-12-14 18:45:36 +11:00
Jonathan Pittman 94c9f92c92 go.crypto/ssh: Add support for ECDSA keys and certs.
R=agl, dave
CC=golang-dev
https://golang.org/cl/6873060
2012-12-14 05:52:19 +11:00
Adam Langley 4002be2701 go.crypto/ssh: run gofmt
gofmt got better at removing trailing whitespace.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6929044
2012-12-10 18:12:36 -05:00
Shawn Ledbetter 887809b6be ssh: add functions for public keys in wire & auth keys format.
This allows easy import/export of public keys in the format
expected by OpenSSH for authorized_keys files, as well as
allowing comparisons with ServerConfig's PublickeyCallback.
Fixes golang/go#3908.

R=agl, dave, golang-dev, bradfitz
CC=agl, golang-dev
https://golang.org/cl/6855107
2012-12-10 17:43:09 -05:00
Joel Sing ae58a7bde0 go.crypto/ssh: make tests work on non-cgo platforms.
user.Current() currently requires cgo - if an error is returned
attempt to get the username from the environment.

R=golang-dev, minux.ma, bradfitz, dave
CC=golang-dev
https://golang.org/cl/6819113
2012-11-12 02:50:33 +11:00