mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
shadowsocks: Fix incorrect setting of state directory
Commit 50e5608331330b37c0b9cce846e34ccc193d1b0d incorrectly sets the StateDirectory without setting DynamicUser. Buster's shadowsocks will then create directory /var/lib/shadowsocks-libev/freedombox/ and refuse to delete it in later versions when DynamicUser=yes needs it to be a symlink. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
This commit is contained in:
parent
f2c451720d
commit
79a9948290
@ -7,6 +7,7 @@ Helper script for configuring Shadowsocks.
|
|||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import pathlib
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import sys
|
import sys
|
||||||
@ -65,6 +66,19 @@ def subcommand_setup(_):
|
|||||||
}
|
}
|
||||||
_merge_config(initial_config)
|
_merge_config(initial_config)
|
||||||
|
|
||||||
|
# Commit 50e5608331330b37c0b9cce846e34ccc193d1b0d incorrectly sets the
|
||||||
|
# StateDirectory without setting DynamicUser. Buster's shadowsocks will
|
||||||
|
# then create directory /var/lib/shadowsocks-libev/freedombox/ and refuse
|
||||||
|
# to delete is in later versions when DynamicUser=yes needs it to be a
|
||||||
|
# symlink.
|
||||||
|
action_utils.service_daemon_reload()
|
||||||
|
wrong_state_dir = pathlib.Path('/var/lib/shadowsocks-libev/freedombox/')
|
||||||
|
if not wrong_state_dir.is_symlink() and wrong_state_dir.is_dir():
|
||||||
|
wrong_state_dir.rmdir()
|
||||||
|
|
||||||
|
if action_utils.service_is_enabled(shadowsocks.managed_services[0]):
|
||||||
|
action_utils.service_restart(shadowsocks.managed_services[0])
|
||||||
|
|
||||||
|
|
||||||
def subcommand_get_config(_):
|
def subcommand_get_config(_):
|
||||||
"""Read and print Shadowsocks configuration."""
|
"""Read and print Shadowsocks configuration."""
|
||||||
|
|||||||
@ -15,7 +15,7 @@ from plinth.utils import format_lazy
|
|||||||
|
|
||||||
from .manifest import backup # noqa, pylint: disable=unused-import
|
from .manifest import backup # noqa, pylint: disable=unused-import
|
||||||
|
|
||||||
version = 2
|
version = 3
|
||||||
|
|
||||||
managed_services = ['shadowsocks-libev-local@freedombox']
|
managed_services = ['shadowsocks-libev-local@freedombox']
|
||||||
|
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
[Service]
|
[Service]
|
||||||
StateDirectory=shadowsocks-libev/%i
|
StateDirectory=shadowsocks-libev/%i
|
||||||
|
DynamicUser=yes
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user