{"id":21134794,"url":"https://github.com/fxstein/pubkey","last_synced_at":"2025-07-09T03:32:23.175Z","repository":{"id":57455477,"uuid":"42128569","full_name":"fxstein/pubkey","owner":"fxstein","description":"Simple public key distribution for your infrastructure.","archived":false,"fork":false,"pushed_at":"2015-12-09T21:06:14.000Z","size":50,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-02T11:06:17.570Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fxstein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-08T17:40:18.000Z","updated_at":"2023-06-22T20:18:45.000Z","dependencies_parsed_at":"2022-09-10T08:01:19.292Z","dependency_job_id":null,"html_url":"https://github.com/fxstein/pubkey","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fxstein/pubkey","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxstein%2Fpubkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxstein%2Fpubkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxstein%2Fpubkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxstein%2Fpubkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fxstein","download_url":"https://codeload.github.com/fxstein/pubkey/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fxstein%2Fpubkey/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263905391,"owners_count":23527959,"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":[],"created_at":"2024-11-20T06:35:51.239Z","updated_at":"2025-07-09T03:32:22.929Z","avatar_url":"https://github.com/fxstein.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"pubkey\n======\n\n[![Build Status](https://travis-ci.org/fxstein/pubkey.svg?branch=master)](https://travis-ci.org/fxstein/pubkey)\n\nNeed to setup private/public key server connections for password less ssh\ncommunications? Tired of manually having to copy around public keys?\n\n`pubkey` creates a RESTful endpoint and replies with the public key you want\nto share. Default is plain text so you can use curl to download and apply the\npublic key with a single step. Optionally the key can be wrapped in a json\ndocument for other use-cases.\n\n`pubkey` enables a pull model where remote servers can pull a public key\ninto their configurations without needing access to the source system of the\nkey.\n\nIf you are looking for a push type model you might want to consider\n`ssh-copy-id` it copies the public key from a local host to a target host.\n\nFor instructions on how to best generate SSH keys head on over to\n[Github Articles: Generating SSH Keys](https://help.github.com/articles/generating-ssh-keys/)\n\nINSTALLATION\n------------\n\n```shell\n$ [sudo] pip[3] install pubkey\nor\n$ [sudo] pip[3] install --upgrade pubkey\n# Upgrades older versions of the tool\n```\n\nThe module is hosted on PyPi: \u003chttps://pypi.python.org/pypi/pubkey\u003e\n\nTo install from github clone the repository onto your local machine then run\n\n```shell\n$ [sudo] setup.py install\n# From the repository root directory e.g. /Users/xxxxx/pubkey\n```\n\nTRAVIS CI DEPLOY SETUP\n---------------\n\nIf you wish to deploy this from your own fork, you will need to set up TravisCI for handling the deployment. When you visit your profile at https://travis-ci.org/profile and re-sync to get the project to appear in the list, click on the cog wheel to visit your particular settings. Once here we have a few settings we need to configure: `pypi_test_user`, `pypi_test_pass`, `pypi_test`, `pypi_user`, `pypi_pass`, `pypi`.\n\n![screen shot 2015-12-09 at 12 42 16 pm](https://cloud.githubusercontent.com/assets/45141/11698353/0396fefa-9e73-11e5-98eb-ccc1bcd2d8cd.png)\n\nAs listed above, all of these items need to be given a value. For passwords, ensure the button **Display value in build log** is not selected.\n\nUSAGE\n-----\n\nSimply head to the host that has the public key and run\n\n```shell\n$ pubkey --auto\n# Starts the pubkey server with default settings and IP auto detection\n```\n\nExample output:\n\n```text\nINFO: pubkey file used: /Users/xxxxx/.ssh/id_rsa.pub\nINFO: pubkey server started at http://192.168.0.36:1080\nRemote host command:\n\ncurl -s -S 192.168.0.36:1080 \u003e\u003e ~/.ssh/authorized_keys\n\nPress ctrl-C to stop.\n```\n\nNow head to your first remote host on the same network e.g. ssh with password\nand run\n\n```shell\n$ curl -s -S 192.168.0.36:1080 \u003e\u003e ~/.ssh/authorized_keys\n# Downloads the public key from the first host and appends it to the users authorized_keys\n```\n\nIf you don't see an error message you should be done. Logout and and attempt an\nssh connection from the first to the second host. If usernames match up you\nshould not be required a password any longer.\n\nYou can also validate that the key has been successfully added by running\n\n```shell\n$ cat ~/.ssh/authorized_keys\n```\n\nYou should see the content of the public key appended at the end of the file\n(which might be the very first entry in case authorized_keys did not exist\nbefore)\n\nAnd just in case you appended the same public key more than once for whatever\nreason no harm is done. Simple sort the file and remove duplicates by running\n\n```shell\n$ sort -u ~/.ssh/authorized_keys -o ~/.ssh/authorized_keys\n```\n\nIn case you need to get access to the public key via JSON simply append /json to\nthe GET request:\n\n```shell\n$ curl -s -S 192.168.0.36:1080/json\n{\"keyfile\": \"/Users/xxxxx/.ssh/id_rsa.pub\", \"pubkey\": \"ssh-rsa AAAAB3NzaC1yc2EBBBBDAQABAAACAQC48EkBhgKDBP3ziBrHUCEoWIiY74OkarBVrLFkQz2MC+u5cKpE3zU7OXDI1AvtBt1Gb7mBvocztoa6r+YkPodOwjJK7N/FtLIO8yevIz2H3bClEryxb0yKmhrAB2jDlTPZoBd8gIFUdCUyAN+BVTXF9sNsyhOpVaycsUaMmocqEWmTm7Awl3PJhZq6nwaSy4Etb9Mkj0DCiDCwL9auDRbHbyw3kekQ5q7bBF7cIzQAUN2EWCTI1dMvv8KgHsrctfwfmN0Bu/Dy4vCp47UMXzlNI2wrKhYvVCKi9MU+K5bWRMmv76vHctvMnrcwvwllYDG3+ltgDhZAvIKKTrXBuMS4zGoDM7dF1Rz825olUkyd+9LgqW+tMy7tOM1edE9lBsB/rJYwtGWCH1zHmg65+W/Sfx2X5mLZ27BOHs46f5o0zyuST8LOgQNNDhuiJWLQGlsgsQ1RTPtlysgnGx300WEvc9lKMaAE9ixTSwq1R5GrNrt9PnB3jQp6BnTsxdZuOv8nicfqkSoRRBRcNEIz7wMXIzZOgTJCMu+5l3nOOijHZKfUA0AMjwr1LwCZWHnZ12k1XE5RteUqroXANs66WfEkIMpxHAL+pjqozZ7e1cRphIPVk7HskWyzLWM/DoXYnfSas6KrSNfv5TUdu45mWiKFGIEVZExsC3sQJ1Kun3fCgQ== another@email.com\\n\"}\n```\n\nFor more options please run\n\n```shell\n$ pubkey --help\n```\n\n```text\nusage: pubkey {arguments ...}\n\npubkey - Public Key distribution made easy.\n\nEver needed to quickly setup trusted keys for password less ssh sessions?\npubkey helps by making public keys avaialble on the local network with a\nsimple REST interface and a matching command to append the public key to\nvarious machines on the same network.\n\nSimply start pubkey on the source of the public key. Then head over to your\nremote target and run:\n\ncurl -s -S host:port \u003e\u003e ~/.ssh/authorized_keys\n\non the various hosts that require the key to be added to their trusted keys.\nDone.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --debug               toggle debug output\n  --quiet               suppress all output\n  -a, --auto            Auto detect IP address to bind REST server to.\n  --host HOST           IP address to bind REST server to. Default is\n                        \u003clocalhost\u003e and therefore NOT visible on the network.\n  --key KEYFILE         Keyfile of public key. Commonly ~/.ssh/id_rsa.pub Only\n                        public key filenames [.pub] allowed.\n  -n NUM, --num NUM     Reply to only (num) requests then quit. 0 for no\n                        limit. Deafult is 0 (no limit)\n  -o, --once            Reply to only 1 request then quit.\n  --port PORT           Port to be used by REST server. Default is 1080.\n  -t TIME, --time TIME  Timeout ater (time) seconds then quit. 0 for no\n                        timeout. Default is 300s (5min)\n  -v, --version         show program's version number and exit\n\nExamples:\n\n$ pubkey --auto\n\n  Run pubkey in host auto detection mode. Should detect the correct server IP\n  for the local host on the local network in most cases. If not use --host\n  option to override with desired hostname or IP.\n  Timeout after 300 seconds by default\n\n$ pubkey --host 10.1.1.124 --port 6080 --time 0\n\n  Run pubkey and open REST server at 10.1.1.124:6080 and no timeout.\n\n$ pubkey --auto --once\n\n  Run pubkey in host auto detection mode and finish after 1 request or the\n  default of 300s - whichever comes first\n\n$ pubkey -auto -n 10 -t 600\n\n  Run pubkey in auto detection mode and finish after 10 requests or 600 seconds\n  whichever comes first\n\nReport bugs, submit feature requests, and/or contribute code over at:\nhttps://github.com/fxstein/pubkey\n```\n\nREQUIREMENTS\n------------\n\npubkey requires Python 3.4+ to run. This is because pubkey leverages the new\nasyncio framework of Python 3.4 or newer.\n\npubkey also leverages the following modules:\n\n*   asyncio \u003e= 3.4.0\n*   aiohttp \u003e= 0.17.0\n*   cement \u003e= 2.6.0\n*   colorlog \u003e= 2.6.0\n\npubkey leverages an async http web-server to implement is server side REST\ninterface.\n\npubkey also leverages the [Cement](http://builtoncement.com/) framework to\nimplement command-line options, logging, configuration as well as overall\napplication orchestration.\n\nLICENSE\n-------\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Oliver Ratzesberger\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffxstein%2Fpubkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffxstein%2Fpubkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffxstein%2Fpubkey/lists"}