syncthing: Run service as system user 'syncthing'

- Enabled Apache LDAP authentication for Syncthing.
This commit is contained in:
Joseph Nuthalpati 2017-03-22 18:53:48 +05:30 committed by Sunil Mohan Adapa
parent 53645deebf
commit a5147cfe16
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
3 changed files with 21 additions and 4 deletions

View File

@ -39,6 +39,12 @@ def parse_arguments():
return parser.parse_args()
def subcommand_pre_setup(_):
"""Actions to be performed before installing Syncthing"""
subprocess.check_call(
['adduser', '--system', '--disabled-login', 'syncthing'])
def subcommand_setup(_):
"""Setup Syncthing configuration."""
subprocess.check_call(
@ -49,12 +55,13 @@ def subcommand_setup(_):
def service_enable():
"""Start the Syncthing service as plinth user"""
subprocess.check_call(['systemctl', 'start', 'syncthing@plinth.service'])
subprocess.check_call(
['systemctl', 'start', 'syncthing@syncthing.service'])
def service_disable():
"""Stop the Syncthing service as plinth user"""
subprocess.check_call(['systemctl', 'stop', 'syncthing@plinth.service'])
subprocess.check_call(['systemctl', 'stop', 'syncthing@syncthing.service'])
def subcommand_enable(_):

View File

@ -1,5 +1,14 @@
ProxyPass /syncthing/ http://localhost:8384/
<Location /syncthing/>
ProxyPassReverse http://localhost:8384/
Require all granted
</Location>
AuthType basic
AuthName "FreedomBox Login"
AuthBasicProvider ldap
AuthLDAPUrl "ldap:///ou=users,dc=thisbox?uid"
AuthLDAPGroupAttribute memberUid
AuthLDAPGroupAttributeIsDN off
Require valid-user
</Location>

View File

@ -72,6 +72,7 @@ def init():
def setup(helper, old_version=None):
"""Install and configure the module."""
helper.call('pre', actions.superuser_run, 'syncthing', ['pre-setup'])
helper.install(managed_packages)
helper.call('post', actions.superuser_run, 'syncthing', ['setup'])
global service