Skip to content

Commit 44fbc26

Browse files
committed
Add PR shenxn#69 from upstream
1 parent cb8a875 commit 44fbc26

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ tag | description
3434
To initialize and add account to the bridge, run the following command.
3535

3636
```
37-
docker run --rm -it -v protonmail:/root shenxn/protonmail-bridge init
37+
docker run --rm -it -v protonmail:/home/protonmail shenxn/protonmail-bridge init
3838
```
3939

4040
Wait for the bridge to startup, use `login` command and follow the instructions to add your account into the bridge. Then use `info` to see the configuration information (username and password). After that, use `exit` to exit the bridge. You may need `CTRL+C` to exit the docker entirely.
@@ -44,7 +44,7 @@ Wait for the bridge to startup, use `login` command and follow the instructions
4444
To run the container, use the following command.
4545

4646
```
47-
docker run -d --name=protonmail-bridge -v protonmail:/root -p 1025:25/tcp -p 1143:143/tcp --restart=unless-stopped shenxn/protonmail-bridge
47+
docker run -d --name=protonmail-bridge -v protonmail:/home/protonmail -p 1025:25/tcp -p 1143:143/tcp --restart=unless-stopped shenxn/protonmail-bridge
4848
```
4949

5050
## Kubernetes
@@ -58,7 +58,7 @@ If you don't want to use Helm, you can also reference to the guide ([#6](https:/
5858
Please be aware that running the command above will expose your bridge to the network. Remember to use firewall if you are going to run this in an untrusted network or on a machine that has public IP address. You can also use the following command to publish the port to only localhost, which is the same behavior as the official bridge package.
5959

6060
```
61-
docker run -d --name=protonmail-bridge -v protonmail:/root -p 127.0.0.1:1025:25/tcp -p 127.0.0.1:1143:143/tcp --restart=unless-stopped shenxn/protonmail-bridge
61+
docker run -d --name=protonmail-bridge -v protonmail:/home/protonmail -p 127.0.0.1:1025:25/tcp -p 127.0.0.1:1143:143/tcp --restart=unless-stopped shenxn/protonmail-bridge
6262
```
6363

6464
Besides, you can publish only port 25 (SMTP) if you don't need to receive any email (e.g. as a email notification service).
@@ -78,4 +78,4 @@ For anyone who want to build this container on your own (for development or secu
7878
docker build .
7979
```
8080

81-
That's it. The `Dockerfile` and bash scripts handle all the downloading, building, and packing. You can also add tags, push to your favorite docker registry, or use `buildx` to build multi architecture images.
81+
That's it. The `Dockerfile` and bash scripts handle all the downloading, building, and packing. You can also add tags, push to your favorite docker registry, or use `buildx` to build multi architecture images.

build/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,11 @@ COPY gpgparams entrypoint.sh /protonmail/
2727
COPY --from=build /build/proton-bridge/bridge /protonmail/
2828
COPY --from=build /build/proton-bridge/proton-bridge /protonmail/
2929

30-
ENTRYPOINT ["bash", "/protonmail/entrypoint.sh"]
30+
# Add a user 'protonmail' with UID 8535
31+
RUN useradd -u 8535 -d /home/protonmail protonmail \
32+
&& mkdir -p /home/protonmail \
33+
&& chown protonmail: /home/protonmail
34+
# change to non-privileged user for extra security
35+
USER protonmail
36+
37+
ENTRYPOINT ["bash", "/protonmail/entrypoint.sh"]

build/entrypoint.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
set -ex
44

5+
# Go to current user's homedir
6+
cd
7+
echo "Running as user '$USER' (UID '$UID') in '$PWD'"
8+
59
# Initialize
610
if [[ $1 == init ]]; then
711

@@ -32,4 +36,4 @@ else
3236
mkfifo faketty
3337
cat faketty | /protonmail/proton-bridge --cli $@
3438

35-
fi
39+
fi

0 commit comments

Comments
 (0)