Server
authkeys.server
Unattended HTTP key server (the generalized keygrabber).
Serves authorized_keys over HTTP so hosts that cannot run the
AuthorizedKeysCommand locally (or want a shared, cached view) can fetch keys
from a central instance. Compared with the original prototype this version is
fully config-driven: bind address, port, and API key come from a [serve]
config section (or CLI overrides); the API key is compared in constant time; and
there is no host-specific source toggling baked in.
Config ([serve] section)::
[serve]
bind = 127.0.0.1
port = 8090
api_key = ${env:AUTHKEYS_APIKEY} ; empty => auth disabled (bind locally!)
path = /keys
LOGGER = logging.getLogger('authkeys.server')
module-attribute
KeyHandler
Bases: BaseHTTPRequestHandler
server
instance-attribute
server_version = 'authkeys'
class-attribute
instance-attribute
do_GET()
Source code in src/authkeys/server.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
log_message(fmt, *args)
Source code in src/authkeys/server.py
79 80 | |
KeyServer(authkeys, *, bind='127.0.0.1', port=8090, api_key=None, path='/keys', max_usernames=16, require_auth=False)
Bases: ThreadingHTTPServer
Threaded HTTP server bound to an :class:AuthKeys instance.
Source code in src/authkeys/server.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
allow_reuse_address = True
class-attribute
instance-attribute
api_key = api_key or None
instance-attribute
authkeys = authkeys
instance-attribute
daemon_threads = True
class-attribute
instance-attribute
max_usernames = max_usernames
instance-attribute
route = '/' + path.strip('/')
instance-attribute
check_auth(provided)
Source code in src/authkeys/server.py
64 65 66 67 68 69 70 71 72 | |
serve(server)
Run server until interrupted (blocking).
Source code in src/authkeys/server.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |