Manual Explicit Wireguard enable via nmcli for Improved Cross-Linux distro support.
This commit is contained in:
parent
0983d1a68d
commit
fcf469bd03
2 changed files with 16 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ from core.services.networking.systemwide.systemwide_utils import extract_wg_inte
|
||||||
from core.services.networking.systemwide import killswitch
|
from core.services.networking.systemwide import killswitch
|
||||||
from core.services.networking.systemwide.dns_tools.process_dns_result import orchestrate_dns_check
|
from core.services.networking.systemwide.dns_tools.process_dns_result import orchestrate_dns_check
|
||||||
from core.services.networking.systemwide.dns_tools.SearchResult import SearchResult, SearchError
|
from core.services.networking.systemwide.dns_tools.SearchResult import SearchResult, SearchError
|
||||||
from core.services.networking.systemwide.wireguard.nmcli_tools import setup_nmcli_connection, setup_ipv6_sinkhole
|
from core.services.networking.systemwide.wireguard.nmcli_tools import setup_nmcli_connection, setup_ipv6_sinkhole, manual_nmcli_enable
|
||||||
from core.services.networking.systemwide.wireguard.wg_firewall_dns import set_dns, revert_dns, turn_on_firewall, check_and_kill_firewall, enable_firewall_with_retry
|
from core.services.networking.systemwide.wireguard.wg_firewall_dns import set_dns, revert_dns, turn_on_firewall, check_and_kill_firewall, enable_firewall_with_retry
|
||||||
from core.errors.logger import logger
|
from core.errors.logger import logger
|
||||||
from core.errors.exceptions import FirewallError
|
from core.errors.exceptions import FirewallError
|
||||||
|
|
@ -125,6 +125,8 @@ def __establish_system_connection(
|
||||||
# return nmcli_result
|
# return nmcli_result
|
||||||
raise ConnectionError(f'NMCLI could not be enabled. {nmcli_result.message}')
|
raise ConnectionError(f'NMCLI could not be enabled. {nmcli_result.message}')
|
||||||
|
|
||||||
|
manual_nmcli_enable()
|
||||||
|
|
||||||
# ============= IPv6 SINKHOLE =============
|
# ============= IPv6 SINKHOLE =============
|
||||||
if connection_observer:
|
if connection_observer:
|
||||||
connection_observer.notify("connecting", "Setting Up IPv6 Protection..")
|
connection_observer.notify("connecting", "Setting Up IPv6 Protection..")
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,19 @@ import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
def manual_nmcli_enable() -> Result:
|
||||||
|
"""
|
||||||
|
This is needed on certain linux distros, such as some types of Arch,
|
||||||
|
While other distros such as Mint do it automatically.
|
||||||
|
"""
|
||||||
|
logger.info("Doing manual connection enable with 'wg'.")
|
||||||
|
command = ['nmcli', 'connection', 'up', 'wg']
|
||||||
|
human_readable_goal = "nmcli connection manual start"
|
||||||
|
nmcli_result = run_generic_command(command, human_readable_goal, timeout=7)
|
||||||
|
if not nmcli_result.valid:
|
||||||
|
raise ConnectionError(f'NMCLI could not be enabled. {nmcli_result.message}')
|
||||||
|
|
||||||
|
|
||||||
def setup_nmcli_connection(wg_config_path: str) -> Result:
|
def setup_nmcli_connection(wg_config_path: str) -> Result:
|
||||||
try:
|
try:
|
||||||
command = ['nmcli', 'connection', 'import', '--temporary', 'type', 'wireguard', 'file', wg_config_path]
|
command = ['nmcli', 'connection', 'import', '--temporary', 'type', 'wireguard', 'file', wg_config_path]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue