Documentation
¶
Overview ¶
Package ipsec holds komando's own IPsec clients: IKEv1 (for L2TP/IPsec and Cisco-style IPsec with XAUTH) and IKEv2, with ESP carried in UDP (RFC 3948), so they run as an ordinary program without admin rights and without changing the computer's network: komando always tells the server it is behind NAT, so ESP never needs a raw socket.
Written from the RFCs (2407-2409, 3706, 3947, 3948, 4303, 7296, 7427, draft-beaulieu-ike-xauth, draft-dukes-ike-mode-cfg); no code from strongSwan, Libreswan or racoon is used.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNeedsPerson = errors.New("the VPN login asks for a one-time code; a person must run `komando vpn up NAME`")
ErrNeedsPerson: the login asks for a one-time code and nobody is there.
Functions ¶
This section is empty.
Types ¶
type L2TPLink ¶
type L2TPLink struct {
// contains filtered or unexported fields
}
L2TPLink carries L2TP over ESP transport mode: UDP port 1701 both ways.
type Options ¶
type Options struct {
Server string // host or host:port of the IKE server
PSK string // pre-shared key (IKEv1; IKEv2 when no EAP)
User string // XAUTH / L2TP PPP / EAP user name
Password string
ID string // IKEv1: the group name (aggressive mode); IKEv2: our identity
RemoteID string // IKEv2: the server's identity (default: Server's host)
CA []byte // IKEv2: the CA that signed the server certificate (PEM); empty: the system's
// Prompt asks a person for a one-time code (XAUTH); nil: nobody there.
Prompt func(label string, secret bool) (string, error)
Log func(format string, args ...any)
// Lifetime of the SAs komando proposes (0: 8h for IKE, 1h for ESP).
Lifetime time.Duration
// Debug logs every IKE message sent and received (sizes, types).
Debug bool
}
Options are what a client needs to connect.
type Session ¶
type Session struct {
// tunnel mode: the address and DNS servers the server gave
Address netip.Addr
DNS []netip.Addr
// contains filtered or unexported fields
}
Session is an established IPsec connection: ESP SAs over UDP, kept up (dead peer detection, rekeys) until closed.
func DialCisco ¶
DialCisco connects Cisco-style IPsec (IKEv1 with XAUTH and mode config, as in Cisco ASA/IOS, MikroTik, strongSwan and the "IPSec" type of macOS and iOS): ESP in tunnel mode; Address and DNS are the server's.
func DialIKEv2 ¶
DialIKEv2 connects an IKEv2 VPN: with a pre-shared key, or with an EAP login (User, Password) after checking the server's certificate.
func DialL2TP ¶
DialL2TP sets up the IPsec part of L2TP/IPsec: ESP in transport mode for UDP port 1701, with a pre-shared key. The caller runs L2TP over it.
func (*Session) Done ¶
func (s *Session) Done() <-chan struct{}
Done is closed when the session ended.
type Tunnel ¶
type Tunnel struct {
*Session
// contains filtered or unexported fields
}
Tunnel is a tunnel-mode session: IPv4 packets in and out.