Skip to content

ovpn parser ignores auth-user-pass directive #336

@cachebag

Description

@cachebag

part of #288.

the .ovpn parser in core/ovpn_parser/parser.rs doesn't handle the auth-user-pass directive. this is one of the most common directives in real-world .ovpn files — it tells the client that the server requires username/password authentication.

because of this, TryFrom<OvpnFile> for OpenVpnConfig always sets auth_type: None, so imported configs don't know whether password auth is required. a user importing a .ovpn file that has auth-user-pass will get a config that doesn't prompt for or include credentials.

changes

  • add auth_user_pass: bool field to OvpnFile
  • parse auth-user-pass directive in the lexer/parser (with optional file path argument, which we can ignore for now — NM handles interactive prompts)
  • in TryFrom<OvpnFile>, infer auth_type from the combination of auth_user_pass and cert presence:
    • auth_user_pass + certs → PasswordTls
    • auth_user_pass + no certs → Password
    • no auth_user_pass + certs → Tls
    • neither → None (same as today)

tests

  • parser test for auth-user-pass (bare and with file path)
  • TryFrom test confirming auth_type inference

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestnmrsChanges to nmrsvpnChanges to VPN surface

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions