Added config spec
This commit is contained in:
parent
7ec36b4bd2
commit
c20e577f7c
@ -1,6 +1,6 @@
|
|||||||
"""Connection backend implementation file."""
|
"""Connection backend implementation file."""
|
||||||
|
|
||||||
from vpn_manager.service.connections.base import ConnectionBase
|
from vpn_manager.service.connections.base import ConnectionBase, ConfigSpec
|
||||||
from typing import TypedDict, Required
|
from typing import TypedDict, Required
|
||||||
from enum import IntEnum, StrEnum
|
from enum import IntEnum, StrEnum
|
||||||
from asyncio import (
|
from asyncio import (
|
||||||
@ -26,11 +26,19 @@ import psutil
|
|||||||
|
|
||||||
|
|
||||||
class LoginTarget(StrEnum):
|
class LoginTarget(StrEnum):
|
||||||
"""Login target enum."""
|
"""
|
||||||
|
Login target enum.
|
||||||
|
|
||||||
|
Has two methods for selecting the target, using the GlobalProtect
|
||||||
|
client's names, and the more technical names that specify
|
||||||
|
"""
|
||||||
|
|
||||||
GATEWAY = "gateway"
|
GATEWAY = "gateway"
|
||||||
PORTAL = "portal"
|
PORTAL = "portal"
|
||||||
|
|
||||||
|
SSL = "ssl"
|
||||||
|
IPSEC = "ipsec"
|
||||||
|
|
||||||
|
|
||||||
class Options(TypedDict, total=False):
|
class Options(TypedDict, total=False):
|
||||||
"""Options type definition for GlobalProtect VPNs."""
|
"""Options type definition for GlobalProtect VPNs."""
|
||||||
@ -392,3 +400,49 @@ class GlobalProtectConnection(
|
|||||||
cls.put_value(result, "b", options, "use_default_browser")
|
cls.put_value(result, "b", options, "use_default_browser")
|
||||||
cls.put_value(result, "s", options, "firefox_browser_container")
|
cls.put_value(result, "s", options, "firefox_browser_container")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_config_spec(cls):
|
||||||
|
"""See parent."""
|
||||||
|
return cls._build_config_spec(
|
||||||
|
ConfigSpec(
|
||||||
|
name="hostname",
|
||||||
|
signature="s",
|
||||||
|
description="Hostname of the VPN server",
|
||||||
|
required=True,
|
||||||
|
),
|
||||||
|
ConfigSpec(
|
||||||
|
name="login_target",
|
||||||
|
signature="s",
|
||||||
|
description="What kind of connection to create (IPSec or SSL)",
|
||||||
|
choices=[ConnectionType.PORTAL, ConnectionType.GATEWAY],
|
||||||
|
),
|
||||||
|
ConfigSpec(
|
||||||
|
name="spoof_clientos",
|
||||||
|
signature="s",
|
||||||
|
description="Custom OS identifier to use instead of autodetected OS",
|
||||||
|
),
|
||||||
|
ConfigSpec(
|
||||||
|
name="verify_certificate",
|
||||||
|
signature="b",
|
||||||
|
description="Whether to verify the certificate provided by the server. DISABLING THIS IS DANGEROUS!!!",
|
||||||
|
default=True,
|
||||||
|
),
|
||||||
|
ConfigSpec(
|
||||||
|
name="allow_insecure_crypto",
|
||||||
|
signature="b",
|
||||||
|
description="Whether to allow older, insecure TLS versions when connecting to the server. ENABLING THIS IS DANGEROUS!!!",
|
||||||
|
default=False,
|
||||||
|
),
|
||||||
|
ConfigSpec(
|
||||||
|
name="use_default_browser",
|
||||||
|
signature="b",
|
||||||
|
description="Whether to request use of the default browser when authenticating. The server may not allow this.",
|
||||||
|
default=True,
|
||||||
|
),
|
||||||
|
ConfigSpec(
|
||||||
|
name="firefox_browser_container",
|
||||||
|
signature="s",
|
||||||
|
description="Specify a browser container to open the authentication page in. Requires Firefox and the 'Open external links in container' plugin",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user