{"id":20238433,"url":"https://github.com/smallstep/sshutil","last_synced_at":"2026-03-07T09:01:57.215Z","repository":{"id":244852876,"uuid":"272742676","full_name":"smallstep/sshutil","owner":"smallstep","description":"🤫 🧱 a not-so-secret SSH client \u0026 server utility module.","archived":false,"fork":false,"pushed_at":"2026-03-05T19:28:26.000Z","size":162,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-03-05T22:14:35.497Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://smallstep.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smallstep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-06-16T15:19:32.000Z","updated_at":"2026-02-17T04:31:01.000Z","dependencies_parsed_at":"2026-03-05T21:06:12.028Z","dependency_job_id":null,"html_url":"https://github.com/smallstep/sshutil","commit_stats":null,"previous_names":["smallstep/sshutil"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/smallstep/sshutil","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallstep%2Fsshutil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallstep%2Fsshutil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallstep%2Fsshutil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallstep%2Fsshutil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smallstep","download_url":"https://codeload.github.com/smallstep/sshutil/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallstep%2Fsshutil/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30210334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T08:34:08.961Z","updated_at":"2026-03-07T09:01:57.141Z","avatar_url":"https://github.com/smallstep.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sshutil\n\nA [single-dependency][gomod] utility package that provides a [`net/http`][net-http] style SSH server.\n\n`sshutil` is part of the [Smallstep][smallstep] crypto suite ([step][], [step-ca][], etc.).\n\n[gomod]: https://github.com/smallstep/sshutil/blob/master/go.mod\n[net-http]: https://golang.org/pkg/net/http/\n[smallstep]: https://smallstep.com/docs\n[step]: https://github.com/smallstep/cli\n[step-ca]: https://github.com/smallstep/certificates\n\n## Why sshutil?\n\nThe `sshutil` package depends solely on the Go [`x/crypto`][crypto] module.\nThe [`x/crypto/ssh`][crypto-ssh] package provides convenient support for the [ssh wire protocol][rfc4253], the [ssh authentication protocol][rfc4252], and the [ssh connection protocol][rfc4254].\nSSH, and thus the `x/crypto` implementation, is natually scoped to a single connection—whereas servers generally need to accept many connections.\nA small, but tedious, amount of work is required to implement a full connection-tracking server for use in applications.\n`sshutil` fills in the gap.\n\n[crypto]: https://pkg.go.dev/golang.org/x/crypto\n[crypto-ssh]: https://pkg.go.dev/golang.org/x/crypto/ssh\n[rfc4252]: https://tools.ietf.org/html/rfc4252\n[rfc4253]: https://tools.ietf.org/html/rfc4253\n[rfc4254]: https://tools.ietf.org/html/rfc4254\n\n## Get\n\n```\n$ go get go.step.sm/sshutil\n```\n\n## Examples\n\nExample can be found in the [examples][] directory.\nRun with:\n\n```\n$ go run go.step.sm/example/\u003cname\u003e\n$ go run ./example/\u003cname\u003e\n```\n\n[examples]: https://github.com/smallstep/sshutil/tree/master/example\n\n\n### Hello SSH\n\n[`hello`](https://github.com/smallstep/sshutil/tree/master/example/hello/main.go)\n\n```golang\npackage main\n\nimport \"go.step.sm/sshutil\"\n\nfunc() hello(stream sshutil.Session) {\n\tstream.Terminal.Write([]byte(\"Hello SSH\\n\")\n}\n\nfunc main() {\n\tserver := \u0026sshutil.Server{Addr: \":2022\"}\n\tserver.Channel(\"session\", sshutil.NewSessionHandler(hello))\n\tserver.ListenAndServe()\n}\n```\n\nOutput:\n```\n$ go run ./example/hello\n$ ssh localhost -p 2022\nHello SSH\nServer closed remote connection to localhost.\n```\n\n### Host Key\n\nEasily configure a persistent host key using `sshutil.LoadHostKeyFromFile`.\nThe default session handler is an echo terminal server.\n\n[`hostkey`](https://github.com/smallstep/sshutil/tree/master/example/hostkey/main.go)\n\n```golang\npackage main\n\nimport (\n\t\"log\"\n\n\t\"go.step.sm/sshutil\"\n)\n\nfunc main() {\n\tserver := \u0026sshutil.Server{\n\t\tAddr: \":2022\",\n\t\tConfig: sshutil.DefaultServerConfig(),\n\t}\n\n\tkey, err := sshutil.LoadHostKeyFromFile(\"example/server.key\", \"\")\n\tif err != nil {\n\t\tlog.Fatalf(\"error loading key: %v\", err)\n\t}\n\tserver.Config.AddHostKey(key)\n\n\terr = server.ListenAndServe()\n\tlog.Print(err)\n}\n```\n\nOutput:\n```\n$ go run ./example/hostkey\n$ ssh localhost -p 2022\n\u003e echo\necho\n\u003e ^D\nClient closed connection to localhost.\n```\n\n## Test\n\n```\n$ go test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallstep%2Fsshutil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmallstep%2Fsshutil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallstep%2Fsshutil/lists"}