Verified Commit d9e9a3b5 authored by anarcat's avatar anarcat
Browse files

package this as something that can go into pip

I'm not exactly sure we'll go that route, but it will make deployment
clearer.

Note that this involves renaming the main script, which makes the
directory listing a little more confusing and redundant, but it makes
the `setup.py` stuff easier (because we don't need to rename the
file).

The downside is that it doesn't look like a python module anymore,
which confuses some tools, but we can always add a symlink in the
source (like we do in undertime) to workaround that problem, in the
future.

Closes: #3
parent 0b6625e7
......@@ -88,7 +88,7 @@ can start processing *all* the files at the root of that account
using:
export WEBDAV_PASSWORD=[REDACTED]
./processor.py --username dangerzone-bot --location https://example.com/remote.php/dav/files/dangerzone-bot/ -v
./dangerzone-webdav-processor --username dangerzone-bot --location https://example.com/remote.php/dav/files/dangerzone-bot/ -v
Obviously, the `--username` and `--location` parameters must be
adapted to your configuration. The latter, in particular, can be found
......@@ -110,7 +110,10 @@ the systemd unit files provided along the script.
First install the script in a standard location, for example:
install processor.py /usr/local/bin/dangerzone-webdav-processor
install dangerzone-webdav-processor /usr/bin/
Note that you can also deploy the script with `pip3 install .` but in
that case you will need to change the path in the `.service` file.
Then add a role user for the project, grant it access to the Docker
daemon:
......@@ -118,8 +121,11 @@ daemon:
adduser --systemd dangerzone
adduser dangerzone docker
If you want to use another username, you will need to modify the
`.service` file.
Add the configuration file to
`/etc/default/dangerzone-webdav-processor`, with the following syntax:
`/etc/default/dangerzone-webdav-processor`, in the following syntax:
WEBDAV_LOCATION=https://example.com/remote.php/dav/files/dangerzone-bot/
WEBDAV_USERNAME=dangerzone-bot
......@@ -128,7 +134,7 @@ Add the configuration file to
Those are equivalent to the `--location`, `--username`, and
`--password` parameters, documented above.
Then deploy the systemd scripts:
Then deploy the systemd scripts units:
cp dangerzone-webdav-processor.{timer,service} /etc/systemd/system/
systemctl daemon-reload
......
[metadata]
url = https://gitlab.torproject.org/tpo/tpa/dangerzone-webdav-processor/
name = dangerzone-webdav-processor
author = Antoine Beaupré
author_email = anarcat@debian.org
license = AGPLv3
description = sanitize files on a WebDAV server
long_description = file: README.md
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Console
License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Natural Language :: English
Operating System :: POSIX
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3
Programming Language :: Python :: 3.9
python_requires = >= 3.9
[options]
scripts = dangerzone-webdav-processor
install_requires =
webdavclient3
setup_requires = setuptools_scm
[flake8]
max-line-length=120
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 Antoine Beaupré <anarcat@debian.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from setuptools import setup
if __name__ == "__main__":
setup(use_scm_version=True)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment