1*1edba515SAndy Fiddaman.\" 2*1edba515SAndy Fiddaman.\" The contents of this file are subject to the terms of the Common 3*1edba515SAndy Fiddaman.\" Development and Distribution License (the "License"). You may not use 4*1edba515SAndy Fiddaman.\" this file except in compliance with the License. 5*1edba515SAndy Fiddaman.\" 6*1edba515SAndy Fiddaman.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or 7*1edba515SAndy Fiddaman.\" http://www.opensolaris.org/os/licensing. See the License for the 8*1edba515SAndy Fiddaman.\" specific language governing permissions and limitations under the 9*1edba515SAndy Fiddaman.\" License. 10*1edba515SAndy Fiddaman.\" 11*1edba515SAndy Fiddaman.\" When distributing Covered Code, include this CDDL HEADER in each file 12*1edba515SAndy Fiddaman.\" and include the License file at usr/src/OPENSOLARIS.LICENSE. If 13*1edba515SAndy Fiddaman.\" applicable, add the following below this CDDL HEADER, with the fields 14*1edba515SAndy Fiddaman.\" enclosed by brackets "[]" replaced with your own identifying 15*1edba515SAndy Fiddaman.\" information: Portions Copyright [yyyy] [name of copyright owner] 16*1edba515SAndy Fiddaman.\" 17*1edba515SAndy Fiddaman.\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved 18*1edba515SAndy Fiddaman.\" Copyright 2024 Oxide Computer Company 19*1edba515SAndy Fiddaman.\" 20*1edba515SAndy Fiddaman.Dd April 17, 2024 21*1edba515SAndy Fiddaman.Dt TCPKEY 8 22*1edba515SAndy Fiddaman.Os 23*1edba515SAndy Fiddaman.Sh NAME 24*1edba515SAndy Fiddaman.Nm tcpkey 25*1edba515SAndy Fiddaman.Nd Manages the Security Association Database (SADB) for TCP 26*1edba515SAndy Fiddaman.Sh SYNOPSIS 27*1edba515SAndy Fiddaman.Nm 28*1edba515SAndy Fiddaman.Op Fl nvp 29*1edba515SAndy Fiddaman.Nm 30*1edba515SAndy Fiddaman.Op Fl nvp 31*1edba515SAndy Fiddaman.Fl f Ar filename 32*1edba515SAndy Fiddaman.Nm 33*1edba515SAndy Fiddaman.Fl c Ar filename 34*1edba515SAndy Fiddaman.Nm 35*1edba515SAndy Fiddaman.Op Fl nvp 36*1edba515SAndy Fiddaman.Cm get 37*1edba515SAndy Fiddaman.Brq Ar Extension value Ns No \&... 38*1edba515SAndy Fiddaman.Nm 39*1edba515SAndy Fiddaman.Op Fl nvp 40*1edba515SAndy Fiddaman.Cm delete 41*1edba515SAndy Fiddaman.Brq Ar Extension value Ns No \&... 42*1edba515SAndy Fiddaman.Nm 43*1edba515SAndy Fiddaman.Op Fl nvp 44*1edba515SAndy Fiddaman.Cm flush 45*1edba515SAndy Fiddaman.Nm 46*1edba515SAndy Fiddaman.Op Fl nvp 47*1edba515SAndy Fiddaman.Cm dump 48*1edba515SAndy Fiddaman.Nm 49*1edba515SAndy Fiddaman.Op Fl nvp 50*1edba515SAndy Fiddaman.Cm save 51*1edba515SAndy Fiddaman.Op Ar filename 52*1edba515SAndy Fiddaman.Sh DESCRIPTION 53*1edba515SAndy FiddamanThe 54*1edba515SAndy Fiddaman.Nm 55*1edba515SAndy Fiddamancommand is used to manually manipulate the 56*1edba515SAndy Fiddaman.Xr tcp 4P 57*1edba515SAndy Fiddamansecurity association database. 58*1edba515SAndy Fiddaman.Pp 59*1edba515SAndy FiddamanWhile the 60*1edba515SAndy Fiddaman.Nm 61*1edba515SAndy Fiddamanutility has only a limited number of general options, it supports a rich 62*1edba515SAndy Fiddamancommand language. 63*1edba515SAndy FiddamanThe user may specify requests to be delivered by means of a programmatic 64*1edba515SAndy Fiddamaninterface specific for manual keying. 65*1edba515SAndy FiddamanSee 66*1edba515SAndy Fiddaman.Xr pf_key 4P . 67*1edba515SAndy FiddamanWhen 68*1edba515SAndy Fiddaman.Nm 69*1edba515SAndy Fiddamanis invoked with no arguments, it will enter an interactive mode which prints a 70*1edba515SAndy Fiddamanprompt 71*1edba515SAndy Fiddaman.Pq Dq tcpkey> 72*1edba515SAndy Fiddamanto the standard output and accepts commands from the standard input until the 73*1edba515SAndy Fiddamanend-of-file is reached. 74*1edba515SAndy Fiddaman.Pp 75*1edba515SAndy Fiddaman.Nm 76*1edba515SAndy Fiddamanuses a 77*1edba515SAndy Fiddaman.Dv PF_KEY 78*1edba515SAndy Fiddamansocket and the message types 79*1edba515SAndy Fiddaman.Dv SADB_ADD , 80*1edba515SAndy Fiddaman.Dv SADB_DELETE , 81*1edba515SAndy Fiddaman.Dv SADB_GET 82*1edba515SAndy Fiddamanand 83*1edba515SAndy Fiddaman.Dv SADB_FLUSH . 84*1edba515SAndy FiddamanThus, you must have the 85*1edba515SAndy Fiddaman.Dv PRIV_SYS_IP_CONFIG 86*1edba515SAndy Fiddamanprivilege to use this command. 87*1edba515SAndy Fiddaman.Sh OPTIONS 88*1edba515SAndy Fiddaman.Bl -tag -width Ds 89*1edba515SAndy Fiddaman.It Fl c Op Ar filename 90*1edba515SAndy FiddamanAnalogous to the 91*1edba515SAndy Fiddaman.Fl f 92*1edba515SAndy Fiddamanoption 93*1edba515SAndy Fiddaman.Pq see following , 94*1edba515SAndy Fiddamanexcept that the input is not executed but only checked for syntactical 95*1edba515SAndy Fiddamancorrectness. 96*1edba515SAndy FiddamanErrors are reported to 97*1edba515SAndy Fiddaman.Dv stderr . 98*1edba515SAndy FiddamanThis option is provided to debug configurations without making changes. 99*1edba515SAndy Fiddaman.It Fl f Op Ar filename 100*1edba515SAndy FiddamanRead commands from an input file, 101*1edba515SAndy Fiddaman.Ar filename . 102*1edba515SAndy FiddamanThe lines of the input file are identical to the command line language. 103*1edba515SAndy FiddamanThe 104*1edba515SAndy Fiddaman.Ic save 105*1edba515SAndy Fiddamancommand can generate files readable by the 106*1edba515SAndy Fiddaman.Fl f 107*1edba515SAndy Fiddamanargument. 108*1edba515SAndy Fiddaman.It Fl n 109*1edba515SAndy FiddamanPrevent attempts to print host and network names symbolically when reporting 110*1edba515SAndy Fiddamanactions. 111*1edba515SAndy FiddamanThis is useful, for example, when all name servers are down or are otherwise 112*1edba515SAndy Fiddamanunreachable. 113*1edba515SAndy Fiddaman.It Fl p 114*1edba515SAndy FiddamanParanoid. 115*1edba515SAndy FiddamanDo not print any keying material, even if saving. 116*1edba515SAndy FiddamanInstead of an actual hexadecimal digit, print an 117*1edba515SAndy Fiddaman.Sq X 118*1edba515SAndy Fiddamanwhen this flag is turned on. 119*1edba515SAndy Fiddaman.It Fl v 120*1edba515SAndy FiddamanVerbose. 121*1edba515SAndy FiddamanPrint the messages being sent into the 122*1edba515SAndy Fiddaman.Dv PF_KEY 123*1edba515SAndy Fiddamansocket, and print raw seconds values for lifetimes. 124*1edba515SAndy Fiddaman.El 125*1edba515SAndy Fiddaman.Sh COMMANDS 126*1edba515SAndy Fiddaman.Bl -tag -width Ds 127*1edba515SAndy Fiddaman.It Ic add 128*1edba515SAndy FiddamanAdd an SA. 129*1edba515SAndy FiddamanBecause it involves the transfer of keying material, it cannot be invoked from 130*1edba515SAndy Fiddamanthe shell, lest the keys be visible in 131*1edba515SAndy Fiddaman.Xr ps 1 132*1edba515SAndy Fiddamanoutput. 133*1edba515SAndy FiddamanIt can be used either from the interactive tcpkey> prompt or in a command 134*1edba515SAndy Fiddamanfile specified by the 135*1edba515SAndy Fiddaman.Fl f 136*1edba515SAndy Fiddamanoption. 137*1edba515SAndy FiddamanThe 138*1edba515SAndy Fiddaman.Ic add 139*1edba515SAndy Fiddamancommand accepts all extension-value pairs described below. 140*1edba515SAndy Fiddaman.It Ic delete 141*1edba515SAndy FiddamanDelete a specific SA. 142*1edba515SAndy FiddamanThis command requires the 143*1edba515SAndy Fiddaman.Sy src 144*1edba515SAndy Fiddamanextension, and the 145*1edba515SAndy Fiddaman.Sy dest 146*1edba515SAndy Fiddamanextension. 147*1edba515SAndy FiddamanIf the SA is in use, it will be marked for deletion and no longer used for new 148*1edba515SAndy Fiddamanconnection setup. 149*1edba515SAndy FiddamanHowever, existing connections will continue to use it. 150*1edba515SAndy Fiddaman.It Ic get 151*1edba515SAndy FiddamanLook up and display a security association. 152*1edba515SAndy FiddamanLike 153*1edba515SAndy Fiddaman.Ic delete , 154*1edba515SAndy Fiddamanthis command only requires 155*1edba515SAndy Fiddaman.Sy src 156*1edba515SAndy Fiddamanand 157*1edba515SAndy Fiddaman.Sy dest . 158*1edba515SAndy Fiddaman.It Ic flush 159*1edba515SAndy FiddamanRemove all SAs. 160*1edba515SAndy Fiddaman.It Ic dump 161*1edba515SAndy FiddamanWill display all SAs. 162*1edba515SAndy FiddamanBecause of the large amount of data generated by this command, there is no 163*1edba515SAndy Fiddamanguarantee that all SA information will be successfully delivered, or that this 164*1edba515SAndy Fiddamancommand will even complete. 165*1edba515SAndy Fiddaman.It Ic save 166*1edba515SAndy FiddamanIs the command analog of the 167*1edba515SAndy Fiddaman.Fl s 168*1edba515SAndy Fiddamanoption. 169*1edba515SAndy Fiddaman.It Sy help 170*1edba515SAndy FiddamanPrints a brief summary of commands. 171*1edba515SAndy Fiddaman.El 172*1edba515SAndy Fiddaman.Sh EXTENSION VALUE TYPES 173*1edba515SAndy FiddamanCommands like 174*1edba515SAndy Fiddaman.Ic add , 175*1edba515SAndy Fiddaman.Ic delete , 176*1edba515SAndy Fiddaman.Ic get , 177*1edba515SAndy Fiddamanand 178*1edba515SAndy Fiddaman.Ic update 179*1edba515SAndy Fiddamanrequire that certain extensions and associated values be specified. 180*1edba515SAndy FiddamanThe extensions will be listed here, followed by the commands that use them, and 181*1edba515SAndy Fiddamanthe commands that require them. 182*1edba515SAndy Fiddaman.Pp 183*1edba515SAndy Fiddaman.Bl -tag -width xxxxxxxxxxxxxxxxxxxx -compact 184*1edba515SAndy Fiddaman.It Cm src Ar addr | name 185*1edba515SAndy FiddamanSource address of the SA. 186*1edba515SAndy Fiddaman.It Cm src6 Ar IPv6addr 187*1edba515SAndy Fiddaman.Pp 188*1edba515SAndy Fiddaman.It Cm dst Ar addr | name 189*1edba515SAndy FiddamanDestination address of the SA. 190*1edba515SAndy Fiddaman.It Cm dst6 Ar IPv6addr 191*1edba515SAndy Fiddaman.Pp 192*1edba515SAndy Fiddaman.It Cm sport Ar port 193*1edba515SAndy FiddamanSource port number. 194*1edba515SAndy FiddamanIf unspecified, the SA will match any source port. 195*1edba515SAndy Fiddaman.Pp 196*1edba515SAndy Fiddaman.It Cm dport Ar port 197*1edba515SAndy FiddamanDestination port number. 198*1edba515SAndy FiddamanIf unspecified, the SA will match any destination port. 199*1edba515SAndy Fiddaman.Pp 200*1edba515SAndy Fiddaman.It Cm authalg Ar algorithm 201*1edba515SAndy FiddamanAuthentication algorithm. 202*1edba515SAndy FiddamanThe only supported value is 203*1edba515SAndy Fiddaman.Sq md5 . 204*1edba515SAndy Fiddaman.It Cm authstring Ar string 205*1edba515SAndy FiddamanAuthentication string. 206*1edba515SAndy FiddamanOnly ASCII characters are supported and the authentication string must be no 207*1edba515SAndy Fiddamanlonger than 80 characters. 208*1edba515SAndy Fiddaman.El 209*1edba515SAndy Fiddaman.Sh FILES 210*1edba515SAndy Fiddaman.Bl -tag -width Ds 211*1edba515SAndy Fiddaman.It Pa /etc/inet/secret/tcpkeys 212*1edba515SAndy FiddamanDefault configuration file used at boot time. 213*1edba515SAndy Fiddaman.El 214*1edba515SAndy Fiddaman.Sh EXAMPLES 215*1edba515SAndy Fiddaman.Bl -tag -width 4 216*1edba515SAndy Fiddaman.It Sy Example 1 No Empting Out All SAs 217*1edba515SAndy Fiddaman.Bd -literal 218*1edba515SAndy Fiddaman# tcpkey flush 219*1edba515SAndy Fiddaman.Ed 220*1edba515SAndy Fiddaman.It Sy Example 2 No Saving All SAs To Standard Output 221*1edba515SAndy Fiddaman.Bd -literal 222*1edba515SAndy Fiddaman# tcpkey save 223*1edba515SAndy Fiddaman.Ed 224*1edba515SAndy Fiddaman.It Sy Example 3 No Adding a pair of SAs 225*1edba515SAndy Fiddaman.Pp 226*1edba515SAndy FiddamanNote that the second SA specifies 179 as the 227*1edba515SAndy Fiddaman.Em source 228*1edba515SAndy Fiddamanport so that it matches reply traffic. 229*1edba515SAndy Fiddaman.Bd -literal 230*1edba515SAndy Fiddaman# tcpkey 231*1edba515SAndy Fiddamantcpkey> add src 192.168.1.1 dst 192.168.1.2 dport 179 \e 232*1edba515SAndy Fiddaman authalg md5 authstring s3kr1t 233*1edba515SAndy Fiddamantcpkey> add src 192.168.1.2 dst 192.168.1.1 sport 179 \e 234*1edba515SAndy Fiddaman authalg md5 authstring s3kr1t 235*1edba515SAndy Fiddamantcpkey> exit 236*1edba515SAndy Fiddaman.Ed 237*1edba515SAndy Fiddaman.It Sy Example 4 No Displaying all SAs 238*1edba515SAndy Fiddaman.Bd -literal 239*1edba515SAndy Fiddaman# tcpkey dump 240*1edba515SAndy FiddamanBase message (version 2) type DUMP, SA type TCPSIG. 241*1edba515SAndy FiddamanMessage length 112 bytes, seq=5, pid=649091. 242*1edba515SAndy FiddamanSRC: Source address (proto=6/tcp) 243*1edba515SAndy FiddamanSRC: AF_INET6: port 0, ::ffff:192.168.1.1/32 (host.example.com). 244*1edba515SAndy FiddamanDST: Destination address (proto=6/tcp) 245*1edba515SAndy FiddamanDST: AF_INET6: port 179, ::ffff:192.168.1.2/32 <unknown>. 246*1edba515SAndy FiddamanAST: Authentication string. 247*1edba515SAndy FiddamanAST: "s3kr1t" 248*1edba515SAndy Fiddaman.Ed 249*1edba515SAndy Fiddaman.El 250*1edba515SAndy Fiddaman.Sh INTERFACE STABILITY 251*1edba515SAndy FiddamanThe command line interface of 252*1edba515SAndy Fiddaman.Nm 253*1edba515SAndy Fiddamanis 254*1edba515SAndy Fiddaman.Sy Uncommitted . 255*1edba515SAndy FiddamanThe command line interface of 256*1edba515SAndy Fiddaman.Nm 257*1edba515SAndy Fiddamanis 258*1edba515SAndy Fiddaman.Sy Not-An-Interface 259*1edba515SAndy Fiddamanand may change at any time. 260*1edba515SAndy Fiddaman.Sh SEE ALSO 261*1edba515SAndy Fiddaman.Xr ps 1 , 262*1edba515SAndy Fiddaman.Xr ipseckey 8 263