{"id":13581705,"url":"https://github.com/mdlayher/consrv","last_synced_at":"2025-04-05T07:06:47.177Z","repository":{"id":41116983,"uuid":"275457018","full_name":"mdlayher/consrv","owner":"mdlayher","description":"Command consrv is a SSH to serial console bridge server, originally designed for deployment on gokrazy.org devices. Apache 2.0 Licensed.","archived":false,"fork":false,"pushed_at":"2024-12-12T19:55:54.000Z","size":171,"stargazers_count":138,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T06:08:12.061Z","etag":null,"topics":["gokrazy","golang","linux","serial-port","ssh"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdlayher.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-27T21:35:57.000Z","updated_at":"2025-02-15T23:39:36.000Z","dependencies_parsed_at":"2025-01-05T23:15:54.446Z","dependency_job_id":"2ccec6c2-af73-4a46-981e-0912de358e3b","html_url":"https://github.com/mdlayher/consrv","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdlayher%2Fconsrv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdlayher%2Fconsrv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdlayher%2Fconsrv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdlayher%2Fconsrv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdlayher","download_url":"https://codeload.github.com/mdlayher/consrv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299832,"owners_count":20916190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["gokrazy","golang","linux","serial-port","ssh"],"created_at":"2024-08-01T15:02:11.602Z","updated_at":"2025-04-05T07:06:47.142Z","avatar_url":"https://github.com/mdlayher.png","language":"Go","funding_links":[],"categories":["Go","linux"],"sub_categories":[],"readme":"# consrv [![Test](https://github.com/mdlayher/consrv/workflows/Test/badge.svg)](https://github.com/mdlayher/consrv/actions) [![Go Reference](https://pkg.go.dev/badge/github.com/mdlayher/consrv.svg)](https://pkg.go.dev/github.com/mdlayher/consrv) [![Go Report Card](https://goreportcard.com/badge/github.com/mdlayher/consrv)](https://goreportcard.com/report/github.com/mdlayher/consrv)\n\nCommand `consrv` is a SSH to serial console bridge server, originally designed\nfor deployment on [gokrazy.org](https://gokrazy.org) devices. Apache 2.0 Licensed.\n\n## Overview\n\nSSH can be used to conveniently access remote machines over the network, but\nonly if the machine has functional networking.\n\nSerial consoles can be used to remotely access a machine with broken or no\nnetworking, but often require running a cable from another machine to remotely\nrescue a machine.\n\n`consrv` combines the best of both worlds: an SSH interface running on a\nRaspberry Pi which can provide serial console access to one or more remote\nmachines, all secured by an SSH channel. I (Matt Layher) run `consrv` on two\nRaspberry Pi 4s using gokrazy to act as remote serial console servers for my\nheadless machines.\n\n```text\n-- Ethernet --\u003e [Raspberry Pi + consrv]\n                  |-- USB to serial --\u003e [desktop]\n                  |-- USB to serial --\u003e [router]\n                  |-- USB to serial --\u003e [server]\n```\n\nI use the following hardware, but any serial equipment supported by Linux should\njust work:\n\n- [Syba dual port DB9 COM RS232 PCIe x1\n  card](https://www.amazon.com/gp/product/B003D3MFHM/)\n- [StarTech USB to Serial RS232 null-modem adapter](https://www.amazon.com/gp/product/B008634VJY/)\n\n## Setup (gokrazy)\n\nAfter formatting and mounting `/perm` on a gokrazy device, create the following\nfiles:\n\n- `/perm/consrv/host_key`: an OpenSSH format private key for the host (generate\n  using `ssh-keygen`, I recommend `ssh-keygen -t ed25519`)\n- `/perm/consrv/consrv.toml`: the configuration file for `consrv`\n\n## Setup (Linux/other OS)\n\nWhen `consrv` is built for a non-gokrazy Linux or other operating system\n(without build tag `gokrazy`), flags are available to specify the location of\nthe configuration and SSH host key files:\n\n```\n$ ./consrv -h\nUsage of ./consrv:\n  -c string\n        path to consrv.toml configuration file (default \"consrv.toml\")\n  -k string\n        path to OpenSSH format host key file (default \"host_key\")\n```\n\n## Configuration\n\nThe TOML configuration file should have device entries for each serial device,\nand SSH public key identities which can be used to access the devices. Password\nauthentication is not supported. For example:\n\n```toml\n# Configure the SSH server listener. If no configuration is specified, consrv\n# binds the SSH server to \":2222\" by default.\n[server]\naddress = \":2222\"\n\n# Configure one or more USB to serial devices with friendly names which are used\n# as the SSH username to access a device's serial console. You must specify either\n# \"device\" as the path to the device or \"serial\" to look up the device's path\n# by the adapter's serial number (useful for machines with many connections).\n#\n# Optionally a list of identities which are allowed to access a device may be\n# provided on a per-device basis. If no identities key is configured, all\n# identities are allowed to access the device.\n[[devices]]\nname = \"server\"\nserial = \"A64NMAJS\"\nbaud = 115200\nidentities = [\"mdlayher\"]\n\n[[devices]]\nname = \"desktop\"\ndevice = \"/dev/ttyUSB1\"\nbaud = 115200\n\n# Configure one or more SSH public key identities which can authenticate against\n# consrv to access the devices.\n[[identities]]\nname = \"mdlayher\"\npublic_key = \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN5i5d0mRKAf02m+ju+I1KrAYw3Ny2IHXy88mgyragBN Matt Layher (mdlayher@gmail.com)\"\n\n# Enable or disable the debug HTTP server for facilities such as Prometheus\n# metrics and pprof support.\n#\n# Warning: do not expose pprof on an untrusted network!\n[debug]\naddress = \"localhost:9288\"\nprometheus = true\npprof = false\n```\n\nNow you can log in to either device's serial console over SSH using port 2222 on\nthe `consrv` host. When you're ready to end your session, use the SSH escape\n`ENTER ~ .` to break the connection:\n\n```text\n$ ssh -i ~/.ssh/mdlayher_ed25519 -p 2222 server@monitnerr-1\nconsrv\u003e opened serial connection \"server\": path: \"/dev/ttyUSB0\", serial: \"A64NMAJS\", baud: 115200\n\nservnerr-3 login: matt\nPassword:\n\n[matt@servnerr-3:~]$ w\n 19:49:16 up 8 days,  1:01,  1 user,  load average: 0.12, 0.06, 0.02\nUSER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT\nmatt     ttyS0     19:49    4.00s  0.03s  0.00s w\n\n[matt@servnerr-3:~]$ Shared connection to monitnerr-1 closed.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdlayher%2Fconsrv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdlayher%2Fconsrv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdlayher%2Fconsrv/lists"}