webdav

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 13 Imported by: 0

README

TR-Webdav

TR-Webdav is a very simplistic webdav server written in go, tailered to serve as a webdav server for Procurat servers.

Configuration

In order to run the server, you need the following configuration files:

conf.json
{
"dataPath": "/path/to/data", // The path to the data directory
"adminUserName": "admin", // The username for the admin user (can access all files)
"credentialsFilePath": "/path/to/user.passwd", // The path to the credentials file (explained below)
"permissionsFilePath": "/path/to/permissions.json" // The path to the permissions file (explained below)
"realm": "WebDAV" // The realm for the webdav server
"restrictedDirectories": ["dir1", "dir2"] // A list of directories that are restricted and need permission (specified in permissions.json) to access
"usersRoot": "users" // The name after the user directories come (for example /users/my-user) - it is only accessible by the user itself and the admin user
"certPath": "/path/to/cert.pem" // The path to the certificate file (for HTTPS)
"keyPath": "/path/to/key.pem" // The path to the key file (for HTTPS)
}
user.passwd

This file contains the credentials for the users, similar to a user.passwd file for HTTP Digest auth. It is a simple file with the following format: username:realm:passwordHash

Example

my-user:WebDAV:cba5dd28add5f5a89bd7b890a8e9db79

permissions.json

[
  {
    "username": "my-user",
    "permissions": ["private", "secret", "finances"]
  }
]

This file contains of an array of users, which can have an array of permissions. Those permissions must match the restricted directories you specified in the conf.json file before. If a user is not specified in this file, the server will handle it as if the user has no permissions at all (just his home directory).

Usage

You can either run the service as a precompiled binary, use the Docker image or compile it yourself.

Compiling

To compile the server, you need to have go installed. Then, you can simply run go build in the root directory of the repository.

Docker

You can either pull the docker image with docker pull hub.docker.com/triargos/tr-webdav or use a docker-compose file like this:

services:
  webdav:
    image: triargos/tr-webdav
    volumes:
      - /path/to/conf.json:/app/conf.json
      - /path/to/user.passwd:/app/user.passwd
      - /path/to/permissions.json:/app/permissions.json
      - /path/to/data:/app/data
      - /path/to/cert.pem:/app/cert.pem
      - /path/to/key.pem:/app/key.pem
    ports:
      - 8080:8080
      - 8443:8443
    restart: always

Precompiled binary

Get the latest release from the releases page and run it with ./tr-webdav (or tr-webdav.exe on Windows).

Contributing

Any contributions are welcome.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL