Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 9214129

Browse files
authored
Merge pull request #10 from axiom-data-science/upsteam-merges
Updates and cleanup
2 parents cfce281 + a30023c commit 9214129

File tree

4 files changed

+120
-73
lines changed

4 files changed

+120
-73
lines changed

.github/workflows/docker.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Docker
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
release:
11+
types:
12+
- published
13+
14+
jobs:
15+
docker:
16+
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
24+
- name: Docker meta
25+
id: meta
26+
uses: docker/metadata-action@v4
27+
with:
28+
images: |
29+
axiom/rsync-server
30+
tags: |
31+
type=ref,event=branch
32+
type=ref,event=tag
33+
34+
- name: Set up QEMU
35+
uses: docker/setup-qemu-action@v2
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v2
39+
40+
- name: Login to Docker Hub
41+
if: success() && github.event_name != 'pull_request'
42+
uses: docker/login-action@v2
43+
with:
44+
username: ${{ secrets.DOCKERHUB_USERNAME }}
45+
password: ${{ secrets.DOCKERHUB_TOKEN }}
46+
47+
- name: Build and push
48+
uses: docker/build-push-action@v4
49+
with:
50+
push: ${{ github.event_name != 'pull_request' }}
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
FROM debian:buster
2-
MAINTAINER Kyle Wilcox <[email protected]>
1+
FROM debian:bullseye-slim
2+
LABEL org.opencontainers.image.authors="Kyle Wilcox <[email protected]>" \
3+
org.opencontainers.image.url="https://github.com/axiom-data-science/rsync-server"
34
ENV DEBIAN_FRONTEND noninteractive
45
ENV LANG C.UTF-8
56
ENV NOTVISIBLE "in users profile"
67

78
RUN apt-get update && \
8-
apt-get install -y openssh-server rsync && \
9-
apt-get clean && \
10-
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
11-
12-
RUN mkdir /var/run/sshd
13-
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
14-
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
15-
RUN echo "export VISIBLE=now" >> /etc/profile
9+
apt-get install -y --no-install-recommends openssh-server rsync && \
10+
apt-get clean && \
11+
mkdir /var/run/sshd && \
12+
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
13+
sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd && \
14+
echo "export VISIBLE=now" >> /etc/profile && \
15+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1616

1717
COPY entrypoint.sh /entrypoint.sh
18-
RUN chmod 744 /entrypoint.sh
1918

2019
EXPOSE 22
2120
EXPOSE 873
2221

23-
CMD ["rsync_server"]
2422
ENTRYPOINT ["/entrypoint.sh"]
23+
CMD ["rsync_server"]

README.md

Lines changed: 56 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
## rsync-server
1+
# rsync-server
22

33
A `rsyncd`/`sshd` server in Docker. You know, for moving files.
44

5-
6-
### quickstart
5+
## Quickstart
76

87
Start a server (both `sshd` and `rsyncd` are supported)
98

10-
```
11-
$ docker run \
12-
--name rsync-server \ # Name it
13-
-p 8000:873 \ # rsyncd port
14-
-p 9000:22 \ # sshd port
15-
-e USERNAME=user \ # rsync username
16-
-e PASSWORD=pass \ # rsync/ssh password
17-
-v /your/public.key:/root/.ssh/authorized_keys \ # your public key
18-
axiom/rsync-server
9+
```shell
10+
docker run \
11+
--name rsync-server \
12+
-p 8000:873 \
13+
-p 9000:22 \
14+
-e USERNAME=user \
15+
-e PASSWORD=pass \
16+
-v /your/public.key:/root/.ssh/authorized_keys \
17+
axiom/rsync-server:latest
1918
```
2019

2120
**Warning** If you are exposing services to the internet be sure to change the default password from `pass` by settings the environmental variable `PASSWORD`.
2221

23-
#### `rsyncd`
22+
### `rsyncd`
2423

2524
Please note that `/volume` is the `rsync` volume pointing to `/data`. The data
2625
will be at `/data` in the container. Use the `VOLUME` parameter to change the
2726
destination path in the container. Even when changing `VOLUME`, you will still
2827
`rsync` to `/volume`. **It is recommended that you always change the default password of `pass` by setting the `PASSWORD` environmental variable, even if you are using key authentication.**
2928

30-
```
31-
$ rsync -av /your/folder/ rsync://user@localhost:8000/volume
29+
```shell
30+
rsync -av /your/folder/ rsync://user@localhost:8000/volume
3231
Password: pass
32+
3333
sending incremental file list
3434
./
3535
foo/
@@ -40,15 +40,15 @@ sent 166 bytes received 39 bytes 136.67 bytes/sec
4040
total size is 0 speedup is 0.00
4141
```
4242

43-
44-
#### `sshd`
43+
### `sshd`
4544

4645
Please note that you are connecting as the `root` and not the user specified in
4746
the `USERNAME` variable. If you don't supply a key file you will be prompted
4847
for the `PASSWORD`. **It is recommended that you always change the default password of `pass` by setting the `PASSWORD` environmental variable, even if you are using key authentication.**
4948

50-
```
51-
$ rsync -av -e "ssh -i /your/private.key -p 9000 -l root" /your/folder/ localhost:/data
49+
```shell
50+
rsync -av -e "ssh -i /your/private.key -p 9000 -l root" /your/folder/ localhost:/data
51+
5252
sending incremental file list
5353
./
5454
foo/
@@ -59,90 +59,87 @@ sent 166 bytes received 31 bytes 131.33 bytes/sec
5959
total size is 0 speedup is 0.00
6060
```
6161

62-
63-
### Usage
62+
## Usage
6463

6564
Variable options (on run)
6665

6766
* `USERNAME` - the `rsync` username. defaults to `user`
6867
* `PASSWORD` - the `rsync` password. defaults to `pass`
6968
* `VOLUME` - the path for `rsync`. defaults to `/data`
70-
* `ALLOW` - space separated list of allowed sources. defaults to `192.168.0.0/16 172.16.0.0/12`.
69+
* `ALLOW` - space separated list of allowed sources. defaults to `10.0.0.0/8 192.168.0.0/16 172.16.0.0/12 127.0.0.1/32`.
7170

71+
### Simple server on port 873
7272

73-
##### Simple server on port 873
74-
75-
```
76-
$ docker run -p 873:873 axiom/rsync-server
73+
```shell
74+
docker run -p 873:873 axiom/rsync-server:latest
7775
```
7876

77+
### Use a volume for the default `/data`
7978

80-
##### Use a volume for the default `/data`
81-
82-
```
83-
$ docker run -p 873:873 -v /your/folder:/data axiom/rsync-server
79+
```shell
80+
docker run -p 873:873 -v /your/folder:/data axiom/rsync-server:latest
8481
```
8582

86-
##### Set a username and password
83+
### Set a username and password
8784

88-
```
89-
$ docker run \
85+
```shell
86+
docker run \
9087
-p 873:873 \
9188
-v /your/folder:/data \
9289
-e USERNAME=admin \
9390
-e PASSWORD=mysecret \
94-
axiom/rsync-server
91+
axiom/rsync-server:latest
9592
```
9693

97-
##### Run on a custom port
94+
### Run on a custom port
9895

99-
```
100-
$ docker run \
96+
```shell
97+
docker run \
10198
-p 9999:873 \
10299
-v /your/folder:/data \
103100
-e USERNAME=admin \
104101
-e PASSWORD=mysecret \
105-
axiom/rsync-server
102+
axiom/rsync-server:latest
106103
```
107104

108-
```
109-
$ rsync rsync://admin@localhost:9999
105+
```shell
106+
rsync rsync://admin@localhost:9999
107+
110108
volume /data directory
111109
```
112110

111+
### Modify the default volume location
113112

114-
##### Modify the default volume location
115-
116-
```
117-
$ docker run \
113+
```shell
114+
docker run \
118115
-p 9999:873 \
119116
-v /your/folder:/myvolume \
120117
-e USERNAME=admin \
121118
-e PASSWORD=mysecret \
122119
-e VOLUME=/myvolume \
123-
axiom/rsync-server
120+
axiom/rsync-server:latest
124121
```
125122

126-
```
127-
$ rsync rsync://admin@localhost:9999
123+
```shell
124+
rsync rsync://admin@localhost:9999
125+
128126
volume /myvolume directory
129127
```
130128

131-
##### Allow additional client IPs
129+
### Allow specific client IPs
132130

133-
```
134-
$ docker run \
131+
```shell
132+
docker run \
135133
-p 9999:873 \
136134
-v /your/folder:/myvolume \
137135
-e USERNAME=admin \
138136
-e PASSWORD=mysecret \
139137
-e VOLUME=/myvolume \
140-
-e ALLOW=192.168.8.0/24 192.168.24.0/24 172.16.0.0/12 127.0.0.1/32 \
141-
axiom/rsync-server
138+
-e ALLOW=192.168.24.0/24 \
139+
axiom/rsync-server:latest
142140
```
143141

144-
145-
##### Over SSH
142+
### Over SSH
146143

147144
If you would like to connect over ssh, you may mount your public key or
148145
`authorized_keys` file to `/root/.ssh/authorized_keys`.
@@ -155,18 +152,18 @@ destination as you would when using SSH.** On the contrary, when using the
155152
`rsyncd` daemon, you will always be using `/volume`, which maps to `VOLUME`
156153
inside of the container.
157154

158-
```
155+
```shell
159156
docker run \
160157
-v /your/folder:/myvolume \
161158
-e USERNAME=admin \
162159
-e PASSWORD=mysecret \
163160
-e VOLUME=/myvolume \
164-
-e ALLOW=192.168.8.0/24 192.168.24.0/24 172.16.0.0/12 127.0.0.1/32 \
161+
-e ALLOW=10.0.0.0/8 192.168.0.0/16 172.16.0.0/12 127.0.0.1/32 \
165162
-v /my/authorized_keys:/root/.ssh/authorized_keys \
166163
-p 9000:22 \
167-
axiom/rsync-server
164+
axiom/rsync-server:latest
168165
```
169166

170-
```
171-
$ rsync -av -e "ssh -i /your/private.key -p 9000 -l root" /your/folder/ localhost:/data
167+
```shell
168+
rsync -av -e "ssh -i /your/private.key -p 9000 -l root" /your/folder/ localhost:/data
172169
```

entrypoint.sh

100644100755
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33

44
USERNAME=${USERNAME:-user}
55
PASSWORD=${PASSWORD:-pass}
6-
ALLOW=${ALLOW:-192.168.8.0/24 192.168.24.0/24 172.16.0.0/12 127.0.0.1/32}
6+
ALLOW=${ALLOW:-10.0.0.0/8 192.168.0.0/16 172.16.0.0/12 127.0.0.1/32}
77
VOLUME=${VOLUME:-/data}
88

99

@@ -23,7 +23,6 @@ setup_rsyncd(){
2323
echo "$USERNAME:$PASSWORD" > /etc/rsyncd.secrets
2424
chmod 0400 /etc/rsyncd.secrets
2525
[ -f /etc/rsyncd.conf ] || cat > /etc/rsyncd.conf <<EOF
26-
pid file = /var/run/rsyncd.pid
2726
log file = /dev/stdout
2827
timeout = 300
2928
max connections = 10

0 commit comments

Comments
 (0)