🎉 server code
This commit is contained in:
parent
5b09a51bee
commit
442f37a84a
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
authorized_keys
|
||||
docker-compose.yml
|
10
Dockerfile
Normal file
10
Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
FROM alpine:latest
|
||||
RUN apk --update add openssh && rm -rf /var/cache/apk/*
|
||||
|
||||
COPY motd /etc/motd
|
||||
COPY sshd_config /etc/ssh/sshd_config
|
||||
COPY authorized_keys /etc/ssh/authorized_keys
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
EXPOSE 22
|
||||
ENTRYPOINT /entrypoint.sh
|
22
README.md
22
README.md
@ -1,2 +1,24 @@
|
||||
# Spiegelei
|
||||
Provide sftp storage to Spiegelei-client
|
||||
|
||||
## Setup Instructions
|
||||
Clone git repository:
|
||||
```console
|
||||
$ git clone https://git.tjdev.de/DrMaxNix/spiegelei-server.git
|
||||
$ cd spiegelei-server
|
||||
```
|
||||
|
||||
Set up local config files:
|
||||
```console
|
||||
$ touch authorized_keys
|
||||
$ nano authorized_keys
|
||||
```
|
||||
```console
|
||||
$ cp docker-compose.template.yml docker-compose.yml
|
||||
$ nano docker-compose.yml
|
||||
```
|
||||
|
||||
Build and run container:
|
||||
```console
|
||||
$ docker compose up -d
|
||||
```
|
||||
|
12
docker-compose.template.yml
Normal file
12
docker-compose.template.yml
Normal file
@ -0,0 +1,12 @@
|
||||
services:
|
||||
main:
|
||||
restart: unless-stopped
|
||||
build:
|
||||
context: .
|
||||
ports:
|
||||
- "3322:22"
|
||||
volumes:
|
||||
- host_keys:/host_keys
|
||||
- /mnt/yourdrive:/data
|
||||
volumes:
|
||||
host_keys:
|
19
entrypoint.sh
Executable file
19
entrypoint.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
## HOST KEYS ##
|
||||
mkdir -p /host_keys
|
||||
chmod 700 /host_keys
|
||||
|
||||
# check whethre they exist
|
||||
if [[ ! -f /host_keys/ssh_host_rsa_key || ! -f /host_keys/ssh_host_ecdsa_key || ! -f /host_keys/ssh_host_ed25519_key || ! -f /host_keys/ssh_host_rsa_key.pub || ! -f /host_keys/ssh_host_ecdsa_key.pub || ! -f /host_keys/ssh_host_ed25519_key.pub ]]; then
|
||||
# create new keys
|
||||
mkdir -p /host_keys/etc/ssh
|
||||
ssh-keygen -A -f /host_keys
|
||||
mv /host_keys/etc/ssh/* /host_keys/
|
||||
rmdir /host_keys/etc/ssh
|
||||
fi
|
||||
|
||||
|
||||
## RUN SSH SERVER ##
|
||||
/usr/sbin/sshd -D -f /etc/ssh/sshd_config
|
12
sshd_config
Normal file
12
sshd_config
Normal file
@ -0,0 +1,12 @@
|
||||
Port 22
|
||||
HostKey /host_keys/ssh_host_rsa_key
|
||||
HostKey /host_keys/ssh_host_ecdsa_key
|
||||
HostKey /host_keys/ssh_host_ed25519_key
|
||||
|
||||
AuthorizedKeysFile /etc/ssh/authorized_keys
|
||||
|
||||
AllowTcpForwarding no
|
||||
GatewayPorts no
|
||||
X11Forwarding no
|
||||
|
||||
Subsystem sftp internal-sftp
|
Loading…
Reference in New Issue
Block a user