Skip to content

Commit 4bcaf2e

Browse files
committed
♻️ Refactored code to support cryptomator-cli v0.6.X
1 parent e6a656d commit 4bcaf2e

12 files changed

+127
-80
lines changed

.dockerignore

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,8 @@
1-
**/.classpath
1+
22
**/.dockerignore
33
**/.env
44
**/.git
55
**/.gitignore
6-
**/.project
7-
**/.settings
8-
**/.toolstarget
9-
**/.vs
106
**/.vscode
11-
**/*.*proj.user
12-
**/*.dbmdl
13-
**/*.jfm
14-
**/bin
15-
**/charts
16-
**/docker-compose*
17-
**/compose*
18-
**/Dockerfile*
19-
**/node_modules
20-
**/npm-debug.log
21-
**/obj
22-
**/secrets.dev.yaml
23-
**/values.dev.yaml
24-
LICENSE
25-
README.md
267
# Project specific
27-
.env
288
vault.pass

Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
#------------------------------------------------------------------------------------------
22
# Stage 1: Build container
33
#------------------------------------------------------------------------------------------
4-
FROM alpine:3.18.2 as builder
4+
FROM debian:sid-20250407-slim AS builder
55

66
# Install ssl dependencies
7-
RUN apk --no-cache add openssl
7+
RUN apt-get update && apt-get install --no-install-recommends -y openssl unzip && rm -rf /var/lib/apt/lists/*
88

99
# Create a new selfsigned certificate
1010
COPY config/pem.conf /root/pem.conf
1111
RUN openssl req -newkey rsa:2048 -nodes -keyout /root/stunnel.pem -x509 -days 3650 -out /root/stunnel.pem -config /root/pem.conf
1212

13+
# Copy over cryptomator-cli package and unzip
14+
COPY packages/cryptomator-cli-latest-linux-x64.zip /opt/cryptomator-cli.zip
15+
RUN unzip -o /opt/cryptomator-cli.zip -d /opt/cryptomator/ && rm -f /opt/cryptomator-cli.zip
16+
1317
#------------------------------------------------------------------------------------------
1418
# Stage 2: Final container
1519
#------------------------------------------------------------------------------------------
16-
FROM alpine:3.18.2
20+
FROM debian:sid-20250407-slim
1721

18-
RUN apk --no-cache add stunnel openjdk17-jre-headless setpriv shadow
22+
RUN apt-get update && apt-get install --no-install-recommends -y stunnel curl netcat-openbsd && rm -rf /var/lib/apt/lists/*
1923

2024
# Set temporary UID and GID's to create the initial user and group
2125
# Use the 'standard' linux starting UID and GID for interactive users
@@ -32,9 +36,7 @@ RUN groupadd -g "${CRYPTOMATOR_TMP_GID}" cryptomator && useradd --no-log-init -u
3236
# Copy over the stunnel config and self signed cert
3337
COPY --chown=cryptomator:cryptomator --chmod=0440 config/stunnel.conf /etc/stunnel/stunnel.conf
3438
COPY --from=builder --chown=cryptomator:cryptomator --chmod=0440 /root/stunnel.pem /etc/stunnel/stunnel.pem
35-
36-
# Copy over the latest cryptomator-cli.jar file
37-
COPY --chown=cryptomator:cryptomator --chmod=0444 packages/cryptomator-cli-latest.jar /usr/local/bin/cryptomator-cli.jar
39+
COPY --from=builder --chown=cryptomator:cryptomator /opt/cryptomator/ /opt/
3840

3941
# Copy over the init scripts last (to speed up dev rebuilds when these change)
4042
COPY --chown=root:root --chmod=0555 scripts/init.sh /init.sh

Makefile

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,26 @@ openssl-remote-connect:
3535
openssl-remote-client-cert:
3636
openssl s_client -cert config/stunnel.pem -connect 127.0.0.1:18081
3737

38+
run-dev-env:
39+
docker-compose run cryptomator-webdav-env
40+
3841
run-dev-build:
39-
docker-compose run --service-ports cryptomator-webdav-dev
42+
docker-compose run --rm --remove-orphans --service-ports cryptomator-webdav-dev
43+
44+
run-dev-build-passfile:
45+
docker-compose run --rm --remove-orphans --service-ports cryptomator-webdav-passfile-dev
4046

4147
up-cryptomator-webdav:
4248
docker-compose up cryptomator-webdav
4349

4450
build-cryptomator-webdav:
45-
docker-compose build cryptomator-webdav
51+
docker-compose build cryptomator-webdav
52+
53+
test-cryptomator-webdav-http:
54+
curl -X PROPFIND http://127.0.0.1:8080/vault/ -H "Depth: 1"
55+
56+
test-cryptomator-webdav-https:
57+
curl -k -X PROPFIND https://127.0.0.1:8443/vault/ -H "Depth: 1"
58+
59+
test-cryptomator-webdav-https-host:
60+
curl -k -X PROPFIND https://127.0.0.1:18081/vault/ -H "Depth: 1"

Readme.md

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# Cryptomator-webdav
2+
23
This repo contains a set of docker files to create a docker image to run the [Cryptomator cli](https://github.com/cryptomator/cli) within Docker.
34
The Cryptomator-cli application shares a local Cryptmator vault over an TLS protected webdav share.
45

56
:warning: The webdav server contained within the Cryptomator-cli application provides **no username or password** access controls. Take your own appropriate security precautions.
67

78
:warning: As of June 2023, Cryptomator states the cli application is still in an early stage and not ready for production use. We recommend using it only for testing and evaluation purposes.
89

9-
<p align="center">
10-
<img src="images/cryptomator-finder-example.png" alt="Cryptomator Finder Example">
11-
</p>
10+
![Cryptomator Finder Example](images/cryptomator-finder-example.png)
1211

1312
## Usage Instructions
1413

@@ -23,17 +22,24 @@ cp sample.env .env
2322
docker-compose up cryptomator-webdav
2423
# The vault will be accessible on the docker host machine on the port specified in the .env file
2524
```
26-
By default the cryptomator vault will be available over webdav at `webdavs://127.0.0.1:18081/vault`, using a self-signed certificate, with no username or password on the webdav share.
25+
26+
By default the cryptomator vault will be available over webdav at the following url, using a self-signed certificate, with no username or password on the webdav share.
27+
28+
```bash
29+
webdavs://127.0.0.1:18081/vault
30+
```
2731

2832
If you wish to be able to access the vault over the the docker host's external IPs, update CRYPTOMATOR_HOST in `.env` to either 0.0.0.0 (all ips), or a specific docker host IP.
2933

30-
#### File Permissions
34+
### File Permissions
3135

3236
This docker image is setup to drop privileges to a userID and groupID specified in the Environment Variables. This is to aid running under appliance style OS's such as Unraid, where all containers are run as root by default. Dropping privileges within the container ensures Cryptomator only has access to the userID and groupID specified in the CRYPTOMATOR_UID and CRYPTOMATOR_GID environment variables.
3337

34-
**Ensure that your local Cryptomator vault files are read and writable by the user selected.**
38+
**Ensure that your local Cryptomator vault files are read and writable by the userID selected.**
39+
40+
#### Permissions Update
3541

36-
##### Permissions Update
42+
Run the following commands across your local cryptomator vault files to update them for the the default User and Group IDs.
3743

3844
```console
3945
# Change all files to be owned by userID/groupID 1000
@@ -74,6 +80,7 @@ CRYPTOMATOR_UMASK=0077
7480
```
7581

7682
### Using a signed cert
83+
7784
If you have a trusted certificate you with to use for the TLS layer, you can bind mount it over the top of the self signed cert within the image.
7885

7986
Add the following line under the Volumes entry within the docker-compose.yml file:
@@ -99,26 +106,36 @@ docker-compose build cryptomator-webdav
99106
```
100107

101108
## Upgrade version of internal cryptomator-cli instructions
109+
102110
To upgrade to a newer version of cryptomator-cli within the docker image:
103111

104-
* Download the new .jar from the [cryptomator-cli releases page](https://github.com/cryptomator/cli/releases)
105-
* Update the `packages/cryptomator-cli-latest.jar` symlink to point the new jar version
106-
```bash
107-
ln -sf cryptomator-cli-0.5.1.jar packages/cryptomator-cli-latest.jar
108-
```
112+
* Download and unzip the new release package from the [cryptomator-cli releases page](https://github.com/cryptomator/cli/releases)
109113
* Rebuild the docker image
114+
110115
```bash
111-
docker-compose build cryptomator-webdav
116+
wget -P packages 'https://github.com/cryptomator/cli/releases/download/0.6.2/cryptomator-cli-0.6.2-linux-x64.zip'
117+
ln -s -f cryptomator-cli-0.6.2-linux-x64.zip packages/cryptomator-cli-latest-linux-x64.zip
118+
make build-cryptomator-webdav
112119
```
113120

114121
## Debugging
115122

116-
### Cryptomator Environment Variables
117-
To check what environment variables are getting set in the container:
118-
* Run `docker-compose run cryptomator-webdav-env`
123+
### To check what environment variables are getting set in the container
124+
125+
```bash
126+
make run-dev-env
127+
```
128+
129+
### To run the docker container using an environment variable password, connect to a local shell and manually run the entrypoint script
119130

120-
### To run the docker container using an environment variable password and connect to a local shell
121-
* Run `docker-compose run --service-ports cryptomator-webdav-dev`
131+
```bash
132+
make run-dev-build
133+
/entrypoint.sh
134+
```
135+
136+
### To run the docker container using an password file, connect to a local shell and manually run the entrypoint script
122137

123-
### To run the docker container using an password file and connect to a local shell
124-
* Run `docker-compose run --service-ports cryptomator-webdav-passfile-dev`
138+
```bash
139+
make run-dev-build-passfile
140+
/entrypoint.sh
141+
```

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
version: '3'
21
services:
32
cryptomator-webdav: &base
43
build:
54
context: .
65
dockerfile: Dockerfile
76
image: greycubesgav/cryptomator-webdav
87
container_name: cryptomator-webdav
8+
platform: linux/amd64
99
env_file:
1010
- .env
1111
ports:
@@ -35,7 +35,7 @@ services:
3535
- './scripts/entrypoint.sh:/entrypoint.sh:ro'
3636
- './scripts/init.sh:/init.sh:ro'
3737
- './config/stunnel.conf:/etc/stunnel/stunnel.conf:ro'
38-
entrypoint: /usr/bin/env sh
38+
entrypoint: /usr/bin/env bash
3939
cryptomator-webdav-passfile-dev:
4040
# Adds passfile mount to dev container
4141
<<: *dev

packages/cryptomator-cli-0.5.1.jar

-13.5 MB
Binary file not shown.
-15.5 MB
Binary file not shown.
43.8 MB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cryptomator-cli-0.6.2-linux-x64.zip

packages/cryptomator-cli-latest.jar

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)