Documentation
¶
Overview ¶
Package openconnect produces the NetworkManager openconnect plugin's secrets without an openconnect binary.
NetworkManager's openconnect plugin does not ask for a password. It asks for a cookie, a gateway and a gwcert — the output of an authentication, not its input. Conventionally an agent gets those by spawning the plugin's own nm-openconnect-auth-dialog, which drives libopenconnect through the whole sign-in.
lys-shell authenticates itself instead. For GlobalProtect that is a form POST and, when the gateway asks, a second one carrying the 2FA answer; for AnyConnect it is an XML exchange in which the gateway describes the form it wants filled in; Fortinet, Array and the web-login protocols (nc, pulse, f5) are plain HTML form posts. Either way it is plain HTTPS with no tunnel involved, which is exactly what `openconnect --authenticate` does before handing the cookie to something else. The resulting cookie is cached, so a reconnect costs no second factor.
The tunnel itself is still NetworkManager's plugin. This package replaces the sign-in, not the thing that moves packets.
Index ¶
- Constants
- Variables
- func Authenticate(ctx context.Context, p Profile, requestNew, unattended bool, ...) (map[string]string, error)
- func DeliverSSOCallback(uri string) bool
- func Forget(uuid string)
- func IsSupported(p Profile) bool
- func RememberPassword(uuid, password string)
- func RememberedPassword(uuid string) (string, bool)
- func SignsInNatively(protocol string) bool
- type Profile
- type Protocol
Constants ¶
const ( // UsernameKey is where lys-shell keeps the sign-in username. The // plugin's auth dialog asks every time; lys-shell stores it in the // profile, where it is a setting the user can see and edit rather // than hidden state. UsernameKey = "lys-shell-username" // SSOKey records that this profile wants the browser sign-in // ("yes" or "true"). openconnect's own switch for this is a // command-line flag, not a profile setting. SSOKey = "lys-shell-sso" // SignInKey lets a profile ask for the plugin's own auth dialog // instead of lys-shell's sign-in: "plugin" opts out; anything else is the // default, which is lys-shell. The escape hatch for a gateway lys-shell reads // wrong — above all one of the web-login protocols, whose pages are // per-deployment markup. SignInKey = "lys-shell-signin" )
The profile's vpn.data keys lys-shell adds of its own; the plugin has no notion of any of them.
const ServiceType = "org.freedesktop.NetworkManager.openconnect"
ServiceType is the NM service name of the openconnect plugin.
Variables ¶
var Protocols = []Protocol{
{"gp", "Palo Alto GlobalProtect"},
{"anyconnect", "Cisco AnyConnect"},
{"fortinet", "Fortinet"},
{"array", "Array Networks"},
{"nc", "Juniper Network Connect"},
{"pulse", "Pulse Connect Secure"},
{"f5", "F5 BIG-IP"},
}
Protocols is every protocol the openconnect plugin speaks, in the order the picker offers them (PROTOCOLS).
Functions ¶
func Authenticate ¶
func Authenticate(ctx context.Context, p Profile, requestNew, unattended bool, prompter secrets.Prompter) (map[string]string, error)
Authenticate signs into the profile's gateway and returns the secrets the openconnect plugin asked for.
requestNew is NM saying the secrets it had were rejected: the cached cookie is dropped and the gateway signed into afresh. The stored password is kept — NM's secrets are the cookie's derivatives, so their rejection says nothing about the password; only the gateway refusing the password itself drops it.
unattended is an activation nobody is watching — a tunnel brought back after a suspend. It gets the cached session if that is still alive, and nothing else: no prompt, and no password posted, since a gateway doing push MFA answers that with a push to a phone nobody is looking at.
Errors are the secrets package's: a refusal (*secrets.AuthenticationFailedError), a sign-in that did not finish (*secrets.SignInIncompleteError), or a gateway this cannot follow (*secrets.ProtocolUnsupportedError).
func DeliverSSOCallback ¶
DeliverSSOCallback hands a browser callback (a globalprotectcallback: URI) to a waiting GlobalProtect SAML sign-in, reporting whether one was waiting.
func Forget ¶
func Forget(uuid string)
Forget drops everything cached for a profile: the session, the password, and the record of what was last handed over. Called when the profile is deleted: a session cookie and a password outliving their profile is a leak, and a profile recreated under the same name gets a new UUID, so nothing would ever collect them.
func IsSupported ¶
IsSupported reports whether lys-shell can produce this profile's secrets natively.
func RememberPassword ¶
func RememberPassword(uuid, password string)
RememberPassword stores a password the way a sign-in that worked does.
func RememberedPassword ¶
RememberedPassword is the password stored for a profile, and whether there is one.
func SignsInNatively ¶
SignsInNatively reports whether lys-shell signs into this protocol itself, rather than leaving it to the plugin's own auth dialog. The form asks this at configuration time, so the answer arrives while the protocol is being picked rather than as a failure on the first connect.
Types ¶
type Profile ¶
type Profile struct {
UUID string
Name string
Gateway string
Protocol string
// Username is the stored sign-in username, "" when there is none.
Username string
// SSO is whether this profile asked for the browser (SAML) sign-in.
// Opt-in because advertising the capability is a one-way door per
// gateway.
SSO bool
// PluginSignIn is whether this profile asked to be signed in by the
// plugin's own auth dialog rather than by lys-shell.
PluginSignIn bool
}
Profile is the openconnect settings lys-shell needs out of an NM profile.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package openconnecttest holds the fakes the NM secret agent's tests need from the openconnect sign-in.
|
Package openconnecttest holds the fakes the NM secret agent's tests need from the openconnect sign-in. |