docker-borgserver/README.md

57 lines
2.2 KiB
Markdown
Raw Normal View History

2017-10-20 05:24:25 +00:00
# BorgServer - Docker image
Debian based container image, running openssh-daemon only accessable by user named "borg" using SSH-Publickey Auth & "borgbackup" as client. Backup-Repositoriees, client's SSH-Keys & SSHd's Hostkeys will be stored in persistent storage.
2017-10-19 17:57:52 +00:00
2017-10-20 14:41:53 +00:00
### Quick Example
Here is a quick example how to configure & run this image:
Create persistent directories
```
mkdir -p borg/sshkeys/clients borg/backup
2017-10-20 14:41:53 +00:00
```
Copy any client ssh publickey into container
*Remember*: Filename = Borg-repository name!
```
cp ~/.ssh/my_machine.pub borg/sshkeys/client/my_machine
```
The OpenSSH-Deamon will expose on port 22/tcp - so you will most likely want to redirect it to a different port. Like 2233 in this example:
```
docker run -td
-p 2233:22 \
--volume $(pwd)/borg/sshkeys:/sshkeys \
--volume $(pwd)/borg/backup:/backup \
nold360/borgserver:latest
```
2017-10-20 05:24:25 +00:00
## Borgserver Configuration
* Place Borg-Clients SSH-PublicKeys in persistent storage
* Client Repositories will be named by the filename found in /sshkeys/clients/
2017-10-19 17:57:52 +00:00
2017-10-20 05:24:25 +00:00
### Persistent Storages & Client Configuration
2017-10-19 17:57:52 +00:00
We will need two persistent storage directories for our borgserver to be usefull:
2017-10-20 05:24:25 +00:00
#### /sshkeys
This directory has two subdirectories:
##### /sshkeys/clients/
2017-10-19 17:57:52 +00:00
Here we will put all SSH public keys from our borg clients, we want to backup. Every key must be it's own file, containing only one line, with the key. The name of the file will become the name of the borg repository, we need for our client to connect.
That means every client get's it's own repository. So you might want to use the hostname of the client as the name of the sshkey file.
2017-10-20 05:24:25 +00:00
```
2017-10-19 17:57:52 +00:00
F.e. /sshkeys/webserver.mydomain.com
2017-10-20 05:24:25 +00:00
```
2017-10-19 17:57:52 +00:00
Than your client would have to initiat the borg repository like this:
2017-10-20 05:24:25 +00:00
```
webserver.mydomain.com ~$ borg init ssh://borg@borgserver-container/backup/webserver.mydomain.com
```
2017-10-19 17:57:52 +00:00
2017-10-20 14:41:53 +00:00
**!IMPORTANT!**: The container wouldn't start the SSH-Deamon until there is at least one ssh-keyfile in this directory!
2017-10-19 17:57:52 +00:00
2017-10-20 05:24:25 +00:00
##### /sshkeys/host/
This directory will be automaticly created on first start. Also run.sh will copy the SSH-Hostkeys here, so your clients can verify it's borgservers ssh-hostkey.
#### /backup
2017-10-19 17:57:52 +00:00
In this directory will borg write all the client data to. It's best to start with an empty directory.