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 login the server asks for: MS-CHAPv2 (RFC 2759, with the server's proof checked) and, only when the VPN allows the weak logins, CHAP-MD5 (RFC 1994) or none, which prove nothing about the server, and 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 ErrTimeout = quiet
ErrTimeout: the server stopped answering while the link came up.
var ErrWeakLogin = errors.New("the VPN server only offers a PPP login that does not prove it is the server (PAP, which hands it your password itself, CHAP-MD5, or none), so anyone who knows the pre-shared key could pretend to be the server; komando uses such a login only when it is allowed for this VPN")
ErrWeakLogin: the server insists on a login that does not prove it is the server, and the VPN does not allow one (Peer.AllowPAP). The caller names the per-VPN setting that does.
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 a weak login: PAP, which sends the
// password itself (inside the VPN's encryption, but to whoever answers
// as the server), CHAP-MD5 or none, which prove nothing about the
// server. Off, komando asks for MS-CHAPv2 instead and, when the server
// insists, fails with ErrWeakLogin.
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).