r/protonvpn: Move remote_addrs file to /var
If `/` is mounted read-only, as is usually the case, the Proton VPN watchdog cannot update the `remote_addrs` configuration file. It needs to be stored in a directory that is guaranteed to be writable.
This commit is contained in:
@@ -102,7 +102,7 @@ class AsyncDaemon(BaseAsyncDaemon):
|
||||
)
|
||||
CONFIG = os.environ.get(
|
||||
'PROTONVPN_CONFIG',
|
||||
'/etc/strongswan/swanctl/conf.d/protonvpn.remote_addrs',
|
||||
'/var/lib/protonvpn/remote_addrs',
|
||||
)
|
||||
|
||||
def __init__(self) -> None:
|
||||
@@ -215,6 +215,8 @@ class AsyncDaemon(BaseAsyncDaemon):
|
||||
if not self.serverlist:
|
||||
log.error('Cannot reconfigure: no known servers!')
|
||||
return
|
||||
if not os.path.isdir(os.path.dirname(self.CONFIG)):
|
||||
os.makedirs(os.path.dirname(self.CONFIG))
|
||||
fd = os.open(self.CONFIG, os.O_CREAT | os.O_RDWR, 0o644)
|
||||
with open(fd, 'r+', encoding='utf-8') as f:
|
||||
line = f.readline()
|
||||
|
||||
Reference in New Issue
Block a user