Documentation
¶
Overview ¶
Package ppp is a minimal PPP peer for the VPNs that carry PPP (L2TP): LCP (RFC 1661), IPCP with DNS (RFC 1332, RFC 1877) and the logins the server asks for: CHAP-MD5 (RFC 1994), MS-CHAPv2 (RFC 2759, with the server's proof checked) and, only when the VPN allows it, PAP (RFC 1334), which sends the password itself. Compression, encryption (MPPE) and IPv6 are never negotiated.
Index ¶
Constants ¶
const ( LCP = 0xc021 PAP = 0xc023 CHAP = 0xc223 IPCP = 0x8021 IPV6CP = 0x8057 CCP = 0x80fd IPv4 = 0x0021 IPv6 = 0x0057 )
Protocol numbers.
Variables ¶
var ErrPAPRefused = errors.New("the VPN server only accepts the PAP login, which hands it your password itself instead of a proof of it, so anyone who knows the pre-shared key and pretends to be the server gets the password; komando uses PAP only when it is allowed for this VPN")
ErrPAPRefused: the server insists on PAP and the VPN does not allow it (Peer.AllowPAP). The caller names the per-VPN setting that does.
var ErrTimeout = quiet
ErrTimeout: the server stopped answering while the link came up.
Functions ¶
This section is empty.
Types ¶
type MSCHAPv2 ¶
type MSCHAPv2 struct {
PeerChallenge [16]byte
NTResponse [24]byte
// contains filtered or unexported fields
}
MSCHAPv2 is one MS-CHAPv2 answer.
func NewMSCHAPv2 ¶
func NewMSCHAPv2(authChallenge []byte, user, password string, peerChallenge [16]byte) (*MSCHAPv2, error)
NewMSCHAPv2 answers an authenticator challenge (16 bytes) with a random peer challenge.
func (*MSCHAPv2) MSK ¶
MSK is the EAP-MSCHAPv2 master session key (RFC 3079 keys, the server's receive key first), used for the IKEv2 AUTH payload.
func (*MSCHAPv2) VerifySuccess ¶
VerifySuccess checks the server's success message ("S=<40 hex> M=...").
type Peer ¶
type Peer struct {
// Log, when set, notes the steps of the link (no secrets).
Log func(format string, args ...any)
// AllowPAP lets the server choose PAP, which sends the password itself
// (inside the VPN's encryption, but to whoever answers as the server).
// Off, komando asks for MS-CHAPv2 instead and, when the server insists,
// fails with ErrPAPRefused.
AllowPAP bool
// contains filtered or unexported fields
}
Peer is one PPP link. Send writes a PPP frame (protocol, information).
func (*Peer) Handle ¶
Handle processes one received control frame. It returns an error when the link cannot go on (the server ended it or refused the login).