{"id":15113820,"url":"https://github.com/harrisoncramer/go-shell-run","last_synced_at":"2025-10-23T05:31:08.796Z","repository":{"id":54422219,"uuid":"521986510","full_name":"harrisoncramer/go-shell-run","owner":"harrisoncramer","description":"Simple Golang HTTP server to allow for the remote execution of shell commands.","archived":false,"fork":false,"pushed_at":"2022-08-14T20:33:58.000Z","size":3505,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T11:40:48.467Z","etag":null,"topics":["bash-script","ci","go","golang","ssh"],"latest_commit_sha":null,"homepage":"","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/harrisoncramer.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":null,"security":null,"support":null}},"created_at":"2022-08-06T15:40:13.000Z","updated_at":"2024-08-20T16:51:24.000Z","dependencies_parsed_at":"2022-08-13T15:10:30.411Z","dependency_job_id":null,"html_url":"https://github.com/harrisoncramer/go-shell-run","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrisoncramer%2Fgo-shell-run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrisoncramer%2Fgo-shell-run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrisoncramer%2Fgo-shell-run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harrisoncramer%2Fgo-shell-run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harrisoncramer","download_url":"https://codeload.github.com/harrisoncramer/go-shell-run/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237784794,"owners_count":19365930,"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":["bash-script","ci","go","golang","ssh"],"created_at":"2024-09-26T01:23:25.374Z","updated_at":"2025-10-23T05:31:08.476Z","avatar_url":"https://github.com/harrisoncramer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoShellRun 🐚\n\nThis repository is a simple Golang HTTP server designed to allow for the remote\nexecution of shell commands.\n\nIt was originally designed to automate deployment workflows via webhooks. \n\nNOTE: This is an insecure approach because the token is not encrypted, and is mainly for demonstration purposes. If you need something like this look into just running your commands with SSH or via Puppet if you need something more robust.\n\n## Security\n\nIn order to validate an inbound request, this server checks that a specific header called `token` \nmatches what you set in your server configuration. You may also want to firewall the port you\nchoose only for specfic IP addresses, since this server enables shell access to your\nmachine. Be careful!\n\n## Installation and Use\n\nCompile the binary with `go build` for your operating system of choice. Then send the binary to your server:\n\n```terminal\n$ GOOS=linux GOARCH=amd64 go build .\n$ scp ./go-shell-run ubuntu@12.345.67.89:/home/harrison\n```\n\nRun the binary on an open port of your choosing and pass it your API key:\n\n```terminal\n$ ssh ubuntu@12.345.67.89\n$ ./go-shell-run --port=3012 --token=89fnoq8yeho8h1y3o\n```\n\nYou can now pass arbitrary shell commands to the server by POSTing them to the `/jobs` endpoint.\n\n```\n$ curl --location --request POST 'http://12.345.67.89:3012/jobs' \\\n--header 'token: 89fnoq8yeho8h1y3o' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"jobs\": [\n        \"pwd\",\n        \"ls -la\",\n    ]\n}'\n```\n\nIf the server is already executing the jobs it'll return a 503, if not, you'll\nrecieve a JSON response.\n\n## Running as a Service\n\nThe `/resources` folder contains a service manifest that you could use to turn this\nbinary into a service controlled by `systemctl`, so that the server is\npersistent even across command failures.\n\nCopy this file to your `/etc/systemd/system` directory and restart your system\nmanager. On Ubuntu, this series of commands might look something like this:\n\n```terminal\n$ scp ./resources/go-shell-run.service ubuntu@12.345.67.89:/home/harrison\n$ ssh ubuntu@12.345.67.89\n$ sudo mv /home/harrison/go-shell-run.service /etc/systemd/system\n$ sudo systemctl daemon reload\n$ sudo systemctl status go-shell-run.service\n● go-shell-run.service - Service that runs an HTTP server meant for arbitrary shell execution remotely.\n     Loaded: loaded (/etc/systemd/system/go-shell-run.service; disabled; vendor preset: enabled)\n     Active: active (running) since Sun 2022-08-07 17:20:42 UTC; 10min ago\n   Main PID: 57135 (go-shell-run)\n      Tasks: 3 (limit: 2354)\n     Memory: 852.0K\n        CPU: 5ms\n     CGroup: /system.slice/go-shell-run.service\n             └─57135 /home/harrison/c2c-visualization/go-shell-run --port=3012 --token=s72870h!b98f0uA(\n```\n\nYou can follow the logs with `journalctl` like this:\n\n```terminal\nsudo journalctl -u go-shell-run.service --follow\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrisoncramer%2Fgo-shell-run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharrisoncramer%2Fgo-shell-run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharrisoncramer%2Fgo-shell-run/lists"}