Add front_synchro container
This commit is contained in:
parent
9d8e29da6f
commit
de88470a0d
4 changed files with 166 additions and 20 deletions
|
@ -2,5 +2,6 @@
|
||||||
TODO
|
TODO
|
||||||
db/
|
db/
|
||||||
docs/guide/
|
docs/guide/
|
||||||
|
front_synchro/
|
||||||
misc/
|
misc/
|
||||||
perl-mcrypt/
|
perl-mcrypt/
|
||||||
|
|
66
README.md
66
README.md
|
@ -72,26 +72,6 @@ As machines aren't always in safe place (transportation, night before CTF,
|
||||||
|
|
||||||
**Always set strong password when it is possible** eg. SSL certificats, ...
|
**Always set strong password when it is possible** eg. SSL certificats, ...
|
||||||
|
|
||||||
#### Frontend
|
|
||||||
|
|
||||||
Keep in mind that this is the machine exposed to participant.
|
|
||||||
|
|
||||||
##### Requirements
|
|
||||||
|
|
||||||
* `nginx` with those modules: `aio` (for fast delivery of huge
|
|
||||||
content), `fastcgi`, `rewrite`, `ssl`;
|
|
||||||
* `php-fpm` with `mcrypt` module (for submission encryption);
|
|
||||||
|
|
||||||
##### Firewall rules
|
|
||||||
|
|
||||||
Expose to participants only 80 and 443 ports.
|
|
||||||
|
|
||||||
Expose on synchronization interface the 22 port, used for synchronization and
|
|
||||||
administration purpose from backend.
|
|
||||||
|
|
||||||
DROP **has to be** the default rule for INPUT, FORWARD and OUTPUT chains; use
|
|
||||||
CONNTRACK states.
|
|
||||||
|
|
||||||
|
|
||||||
#### Backend
|
#### Backend
|
||||||
|
|
||||||
|
@ -246,6 +226,52 @@ synchronization with frontend (only `launch.sh`), submission checking and
|
||||||
smart static pages regeneration.
|
smart static pages regeneration.
|
||||||
|
|
||||||
|
|
||||||
|
#### Frontend
|
||||||
|
|
||||||
|
Keep in mind that this is the machine exposed to participant.
|
||||||
|
|
||||||
|
##### Docker containers
|
||||||
|
|
||||||
|
1. Generate the synchronization SSH key on the backend:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo su -c "ssh-keygen -t rsa -b 8192 -N '' -f ~synchro/.ssh/id_rsa" synchro
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Copy `~synchro/.ssh/id_rsa.pub` into `front_synchro/authorized_keys` file.
|
||||||
|
|
||||||
|
3. Run the `front_synchro` container:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t synchro front_synchro/
|
||||||
|
docker run -d --name fsync -p 2242:22 synchro
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Run the frontend container:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t frontend front/
|
||||||
|
docker run --rm -p 80:80 -p 443:443 --volumes-from fsync front
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
##### Requirements
|
||||||
|
|
||||||
|
* `nginx` with those modules: `aio` (for fast delivery of huge
|
||||||
|
content), `fastcgi`, `rewrite`, `ssl`;
|
||||||
|
* `php-fpm` with `mcrypt` module (for submission encryption);
|
||||||
|
|
||||||
|
##### Firewall rules
|
||||||
|
|
||||||
|
Expose to participants only 80 and 443 ports.
|
||||||
|
|
||||||
|
Expose on synchronization interface the 22 port, used for synchronization and
|
||||||
|
administration purpose from backend.
|
||||||
|
|
||||||
|
DROP **has to be** the default rule for INPUT, FORWARD and OUTPUT chains; use
|
||||||
|
CONNTRACK states.
|
||||||
|
|
||||||
|
|
||||||
### History
|
### History
|
||||||
|
|
||||||
#### FIC2014
|
#### FIC2014
|
||||||
|
|
28
front_synchro/Dockerfile
Normal file
28
front_synchro/Dockerfile
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
FROM debian:wheezy
|
||||||
|
MAINTAINER Pierre-Olivier Mercier <nemunaire@nemunai.re>
|
||||||
|
|
||||||
|
# Install packages ####################################################
|
||||||
|
|
||||||
|
RUN apt-get -y update && \
|
||||||
|
apt-get install -y \
|
||||||
|
openssh-server \
|
||||||
|
openssh-blacklist-extra \
|
||||||
|
rsync \
|
||||||
|
&& \
|
||||||
|
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
RUN useradd -d /var/www/fic-server/ -M -N -g nogroup synchro
|
||||||
|
|
||||||
|
# Configure softwares #################################################
|
||||||
|
|
||||||
|
COPY sshd_config /etc/ssh/sshd_config
|
||||||
|
#COPY authorized_keys /var/www/fic-server/.ssh/authorized_keys
|
||||||
|
|
||||||
|
# ENVIRONNEMENT #######################################################
|
||||||
|
|
||||||
|
VOLUME ["/var/www/fic-server/out","/var/www/fic-server/files","/var/www/fic-server/submission","/var/www/fic-server/front","/var/www/fic-server/shared"]
|
||||||
|
|
||||||
|
EXPOSE 22/tcp
|
||||||
|
|
||||||
|
CMD service ssh start && \
|
||||||
|
tail -F /var/log/auth.log
|
91
front_synchro/sshd_config
Normal file
91
front_synchro/sshd_config
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
# Package generated configuration file
|
||||||
|
# See the sshd_config(5) manpage for details
|
||||||
|
|
||||||
|
# What ports, IPs and protocols we listen for
|
||||||
|
Port 22
|
||||||
|
# Use these options to restrict which interfaces/protocols sshd will bind to
|
||||||
|
#ListenAddress ::
|
||||||
|
#ListenAddress 0.0.0.0
|
||||||
|
Protocol 2
|
||||||
|
# HostKeys for protocol version 2
|
||||||
|
HostKey /etc/ssh/ssh_host_rsa_key
|
||||||
|
#Privilege Separation is turned on for security
|
||||||
|
UsePrivilegeSeparation yes
|
||||||
|
|
||||||
|
# Lifetime and size of ephemeral version 1 server key
|
||||||
|
KeyRegenerationInterval 3600
|
||||||
|
ServerKeyBits 1024
|
||||||
|
|
||||||
|
# Ciphers and keying
|
||||||
|
Ciphers aes256-ctr,aes192-ctr,aes128-ctr
|
||||||
|
KexAlgorithms diffie-hellman-group-exchange-sha256
|
||||||
|
MACs hmac-ripemd160
|
||||||
|
#RekeyLimit default none
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
SyslogFacility AUTH
|
||||||
|
LogLevel INFO
|
||||||
|
|
||||||
|
# Authentication:
|
||||||
|
LoginGraceTime 1m
|
||||||
|
PermitRootLogin no
|
||||||
|
StrictModes yes
|
||||||
|
|
||||||
|
RSAAuthentication yes
|
||||||
|
PubkeyAuthentication yes
|
||||||
|
#AuthorizedKeysFile %h/.ssh/authorized_keys
|
||||||
|
|
||||||
|
# Don't read the user's ~/.rhosts and ~/.shosts files
|
||||||
|
IgnoreRhosts yes
|
||||||
|
# For this to work you will also need host keys in /etc/ssh_known_hosts
|
||||||
|
RhostsRSAAuthentication no
|
||||||
|
# similar for protocol version 2
|
||||||
|
HostbasedAuthentication no
|
||||||
|
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
|
||||||
|
#IgnoreUserKnownHosts yes
|
||||||
|
|
||||||
|
# To enable empty passwords, change to yes (NOT RECOMMENDED)
|
||||||
|
PermitEmptyPasswords no
|
||||||
|
|
||||||
|
# Change to yes to enable challenge-response passwords (beware issues with
|
||||||
|
# some PAM modules and threads)
|
||||||
|
ChallengeResponseAuthentication no
|
||||||
|
|
||||||
|
# Change to no to disable tunnelled clear text passwords
|
||||||
|
PasswordAuthentication no
|
||||||
|
|
||||||
|
# Kerberos options
|
||||||
|
#KerberosAuthentication no
|
||||||
|
#KerberosGetAFSToken no
|
||||||
|
#KerberosOrLocalPasswd yes
|
||||||
|
#KerberosTicketCleanup yes
|
||||||
|
|
||||||
|
# GSSAPI options
|
||||||
|
#GSSAPIAuthentication no
|
||||||
|
#GSSAPICleanupCredentials yes
|
||||||
|
|
||||||
|
X11Forwarding no
|
||||||
|
X11DisplayOffset 10
|
||||||
|
PrintMotd no
|
||||||
|
PrintLastLog yes
|
||||||
|
TCPKeepAlive yes
|
||||||
|
#UseLogin no
|
||||||
|
|
||||||
|
#MaxStartups 10:30:60
|
||||||
|
#Banner /etc/issue.net
|
||||||
|
|
||||||
|
# Allow client to pass locale environment variables
|
||||||
|
AcceptEnv LANG LC_*
|
||||||
|
|
||||||
|
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||||
|
|
||||||
|
# Set this to 'yes' to enable PAM authentication, account processing,
|
||||||
|
# and session processing. If this is enabled, PAM authentication will
|
||||||
|
# be allowed through the ChallengeResponseAuthentication and
|
||||||
|
# PasswordAuthentication. Depending on your PAM configuration,
|
||||||
|
# PAM authentication via ChallengeResponseAuthentication may bypass
|
||||||
|
# the setting of "PermitRootLogin without-password".
|
||||||
|
# If you just want the PAM account and session checks to run without
|
||||||
|
# PAM authentication, then enable this but set PasswordAuthentication
|
||||||
|
# and ChallengeResponseAuthentication to 'no'.
|
||||||
|
UsePAM yes
|
Reference in a new issue