1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
.\"# @(#)COPYRIGHT 1.1a (NRL) 17 August 1995
.\"
.\"COPYRIGHT NOTICE
.\"
.\"All of the documentation and software included in this software
.\"distribution from the US Naval Research Laboratory (NRL) are
.\"copyrighted by their respective developers.
.\"
.\"This software and documentation were developed at NRL by various
.\"people. Those developers have each copyrighted the portions that they
.\"developed at NRL and have assigned All Rights for those portions to
.\"NRL. Outside the USA, NRL also has copyright on the software
.\"developed at NRL. The affected files all contain specific copyright
.\"notices and those notices must be retained in any derived work.
.\"
.\"NRL LICENSE
.\"
.\"NRL grants permission for redistribution and use in source and binary
.\"forms, with or without modification, of the software and documentation
.\"created at NRL provided that the following conditions are met:
.\"
.\"1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\"2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\"
.\" This product includes software developed at the Information
.\" Technology Division, US Naval Research Laboratory.
.\"
.\"4. Neither the name of the NRL nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\"THE SOFTWARE PROVIDED BY NRL IS PROVIDED BY NRL AND CONTRIBUTORS ``AS
.\"IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\"TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
.\"PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NRL OR
.\"CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
.\"EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
.\"PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
.\"PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
.\"LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
.\"NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
.\"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\"The views and conclusions contained in the software and documentation
.\"are those of the authors and should not be interpreted as representing
.\"official policies, either expressed or implied, of the US Naval
.\"Research Laboratory (NRL).
.\"
.\"----------------------------------------------------------------------*/
.\"
.\" $ANA: keyadmin.8,v 1.3 1996/06/13 20:15:57 wollman Exp $
.\" $FreeBSD$
.\"
.Dd June 13, 1996
.Dt KEY 8
.Os
.Sh NAME
.Nm keyadmin
.Nd manually manipulate the kernel key management database
.Sh SYNOPSIS
.Nm
.Op Ar command Op Ar args
.Sh DESCRIPTION
The
.Nm
command is used to manually enter security associations into the kernel
key/security association database. (See
.Xr key 4 ).
.Pp
Almost any operation offered in the
.Xr key 4
API is available to privileged users running
.Nm .
Until there is an implementation of an automated key management protocol,
which will manipulate the key database in a manner similar to how
.Xr routed 8
or
.Xr gated 8
manipulates the routing tables,
.Nm
is the only way of establishing security associations.
.Pp
If
.Nm
is invoked without any arguments, it will enter an interactive mode, where
the user can type in
.Dq Ar command Op Ar args
interactively, or use
.Nm
to enter a single
.Dq Ar command Op Ar args .
.Ar Command
can be one of the following:
.Bl -inset
.It Ic del Ar type spi source destination
.Pp
Delete a security association between
.Ar source
and
.Ar destination
of the given
.Ar type
and
.Ar spi .
Example:
.Bd -literal
delete esp 90125 anderson.yes.org rabin.yes.org
.Ed
.It Ic get Ar type spi source destination
.Pp
Retrieve (and print) a security association between
.Ar source
and
.Ar destination
of the given
.Ar type
and
.Ar spi .
Example:
.Bd -literal
get ah 5150 eddie.vanhalen.com alex.vanhalen.com
.Ed
.It Ic dump
.Pp
Display the entire security association table. WARNING: This prints a lot
of data.
.It Ic load Ar filename
.Pp
Load security association information from a file formatted as documented in
.Xr keys 5 . If
.Dq -
is specified for the
.Ar filename ,
load keys from the standard input.
.It Ic save Ar filename
.Pp
Save security association information to a file formatted as documented in
.Xr keys 5 . If
.Dq -
is specified for the
.Ar filename ,
place the key file out on the standard output. (This can be used as a sort
of lightweight
.Ic dump
command.)
NOTE: The
.Ic save
command must create a new file; it will not write into an
existing file. This is to prevent writing into a world-readable file, or a
named pipe or UNIX socket (see
.Xr socket 2
and
.Xr mkfifo 1 ).
.It Ic help Op command
.Pp
Offer brief help without an argument, or slightly more specific help on a
particular command.
.It Ic flush
.Pp
Erase all entries in the kernel security association table.
.El
.Pp
The following values for
.Ar command
are only available by using
.Nm
in its interactive mode of operation:
.Bl -inset
.It Ic add Ar type spi source destination transform key
.Op Ar iv
.Pp
Add a security association of a particular
.Ar type
and
.Ar spi
from a
.Ar source
to a
.Ar destination ,
using a particular
.Ar transform
and
.Ar key .
If a transform requires an initialization vector, the
.Ar iv
argument contains it. This command is available only in interactive mode
because
.Nm
makes no attempt to destroy its argument vector after use. A malicious user
of the
.Xr ps 1
command could determine security keys if
.Ic add
were allowed to be used straight from the command line. Example:
.Bd -literal
add esp 2112 temples.syrinx.org priests.syrinx.org des-cbc \\
a652a476a652a476 87ac9876deac9876
.Ed
.It Ic exit
.It Ic quit
.Pp
Exit interaction with
.Nm .
An EOF will also end interaction with
.Nm .
.El
.Sh SEE ALSO
.Xr ipsec 4 ,
.Xr key 4 ,
.Xr route 4 ,
.Xr gated 8 ,
.Xr routed 8
.Sh HISTORY
The
.Nm
command first appeared in NRL's
.Bx 4.4
IPv6 networking distribution.
.Nm Keyadmin
started its life as a pipe dream thought up by Dan McDonald, and came to
life through the excruciating efforts of Ran Atkinson, Dan McDonald,
Craig Metz, and Bao Phan.
The NRL version of the program was originally called
.Nm key ,
but was renamed to
.Nm
because of the conflict with
.Xr key 1 .
.Sh BUGS
.Nm Keyadmin
needs a -n flag like
.Xr route 8
to avoid name lookups.
.Pp
The
.Ic dump
and
.Ic save
commands currently display the first 30 or so entries.
|