mtimeout.1: Use correct dash for number ranges.
[misc] / sshsvc-mkauthkeys.1
CommitLineData
b9ee4e83
MW
1.de hP
2.IP
3\h'-\w'\fB\\$1\ \fP'u'\fB\\$1\ \fP\c
4..
5.ie t .ds o \(bu
6.el .ds o o
7.
8.TH sshsvc-mkauthkeys 1 "23 April 2015" "distorted.org.uk" "Utilities"
9.SH NAME
10sshsvc-mkauthkeys \- build authorized_keys files for SSH services
11.SH SYNOPSIS
12.B sshsvc-mkauthkeys
13.RB [ \-c
14.IR config ]
15.RB [ \-k
16.IR keysdir ]
17.RB [ \-o
18.IR output ]
19.br
20\&\h'8n'
21.RB [ \-H
22.IR head ]
23.RB [ \-T
24.IR tail ]
25.SH DESCRIPTION
26The
27.B sshsvc-mkauthkeys
28script constructs an OpenSSH
29.B authorized_keys
30file
31from a collection of SSH public keys
32and some configuration in the form of shell variable and function
33definitions.
34The script expects to be run from a makefile
35within a
36.B .ssh/
37directory
38and reads and writes files with fixed relative pathnames by default.
39These can be overridden using command-line options.
40.SS "Command line options"
41.TP
42.BI \-c " config"
43Source configuration from
44.I config
45instead of the default
46.BR sshsvc.conf .
47.TP
48.BI \-k " keysdir"
49Collect user keys from
50.I keysdir
51instead of the default
52.BR keys/ .
53.TP
54.BI \-o " output"
55Write the output to
56.I output
57instead of the default
58.BR authorized_keys .
59.TP
60.BI \-H " head"
61Read initial raw entries from
62.I head
63(if it exists)
64instead of the default
65.BR sshsvc-authkeys.head .
66.TP
67.BI \-T " tail"
68Read final raw entries from
69.I tail
70(if it exists)
71instead of the default
72.BR sshsvc-authkeys.tail .
73.SS "Overall operation"
74The
75.I output
76file
77.RB ( authorized_keys
78by default)
79is constructed as follows.
80.hP 0.
81A comment is written to
82the very top of
83the output file
84explaining that it was generated by
85.BR sshsvc-mkauthkeys .
86.hP 1.
87If the
88.I head
89file
90.RB ( sshsvc-authkeys.head
91by default)
92exists then its contents are written unchanged to the output.
93.hP 2.
94Each of the files
95.IB keysdir / user\fR[ ! label\fR] .pub
96is processed in turn
97(see below)
98in ascending lexicographic order
99to make a single-line entry
100in the output file.
101The default
102.I keysdir
103is
104.BR keys/ .
105.hP 3.
106If the
107.I tail
108file
109.RB ( sshsvc-authkeys.tail
110by default)
111exists then its contents are written unchanged to the output.
112.hP 4.
113A commend is written to
114the very bottom of
115the output file
116explaining that it was generated by
117.BR sshsvc-mkauthkeys .
118.SS "Configuration"
119The configuration
120for a particular SSH service
121is read from
122.BR sshsvc.conf .
123This file must exist
124in the current working directory,
125though it needn't have any content
126since all configurable parameters have sensible
127(though not necessarily useful)
128defaults.
129.SS "The make_full_key_line function"
130The most general configuration hook
131(and therefore the one requiring most effort from the user)
132is the
133.B make_full_key_line
134function.
135It is given the key file's
136.I user
137name as an argument and
138expected to write
139the
140.I options
141portion of an
142.B authorized_keys
143entry to standard output.
144.PP
145The default implementation is likely to be suitable
146for almost all services. It calls
147.B make_key_line
148(see below)
149to construct
150environment variable settings
151and other per-user configuration settings,
152and attaches general policy settings.
153.PP
154It uses the following variables.
155.TP
156.B allow_port_forwarding
157If not
158.B yes
159then forbid port forwarding
160(include
161.B no-port-forwarding
162in the line).
163The default is
164.BR no .
165.TP
166.B allow_x11_forwarding
167If not
168.B yes
169then forbid X11 connection forwarding
170(include
171.B no-X11-forwarding
172in the line).
173The default is
174.BR no .
175.TP
176.B allow_agent_forwarding
177If not
178.B yes
179then forbid SSH agent forwarding
180(include
181.B no-agent-forwarding
182in the line).
183The default is
184.BR no .
185It's probably not a good idea to enable this.
186.TP
187.B allow_pty
188If not
189.B yes
190then forbid pty allocation
191(include
192.B no-pty
193in the line).
194The default is
195.BR no .
196This is usually what you want
197unless your service needs an interactive terminal
198(e.g., a console for a virtual machine).
199.TP
200.B cmd
201If set to any value
202and the line from
203.B make_key_line
204doesn't already contain a
205.RB ` command= ...'
206option,
207then always run
208.I cmd
209(with the service user's shell)
210rather than using the client's requested command line,
211which is left in
212.B SSH_ORIGINAL_COMMAND
213(include
214.BI command="" cmd ""
215in the line).
216The default is
217.BR bin/sshsvc .
218.SS "The make_key_line function"
219The
220.B make_key_line
221function is called with
222the key file's
223.I user
224name as its only argument,
225and is expected to write any per-user
226(and unusual)
227options to standard output.
228Mostly it will be sufficient to generate an
229.RB ` environment= ...'
230option
231and leave the rest to
232.BR make_full_key_line .
233.PP
234The default
235.B make_key_line
236function is suitable for simple cases.
237It examines the
238.B env
239variable,
240replacing
241.B @user
242placeholders with the key's
243.I user
244name,
245and emits the line
246.BI environment= env\fR.
247The default value of
248.B env
249is
250.B SSHSVC_USER=@user
251which may be good enough for services
252explicitly written to work with it.
253.SH FILES
254.TP
255.BR sshsvc.conf
256Read for configuration
257(shell variable and function definitions).
258.TP
259.BI keys/ user\fR[ ! label\fR] .pub
260Input public keys to process.
261.TP
262.B sshsvc-authkeys.head
263Pre-cooked
264.B authorized_keys
265entries to write at the top of the output.
266.TP
267.B sshsvc-authkeys.tail
268Pre-cooked
269.B authorized_keys
270entries to write at the bottom of the output.
271.TP
272.B authorized_keys
273Output file.
274.SH BUGS
275Perfection guaranteed.
276Satisfaction, or your money back.
277.SH "SEE ALSO"
278.BR ssh (1),
279.BR sshd (8).
280.SH AUTHOR
281Mark Wooding, <mdw@distorted.org.uk>