diff --git a/README.md b/README.md index afb7eb248ef2fe346883efbd6d1071faffc79922..5a4d1b9413947d7fb97d8b597061c58de14c7969 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ When you unpack the code from Git: - Create a directory where you will place server config file and copy **otp_config-template.php** there using a name of your choice; this file contains access details to the OTP database and it must be read by the server, but should not be placed within the web-server directory, in case a problem with your PHP could lead to exposure. -- In the config directory, copy **config-template.php** to **config.php** and put in the location of the otp_server config file. +- In the config directory, copy `config-template.php` to `config.php` and put in the location of the otp_server config file. - Configure your httpd server to be able to execute otp_server.php ### Using Docker @@ -54,9 +54,32 @@ resolution based on the host machine and standard port 80 for connections. - You need docker instaled on your host machine - If you do not want to use **--network host** option then decide which port will be mapped to your Docker image (say 8080) - Download the code from git +- In the **config** directory, copy **config-template.php** to **config.php**; do not modify the settings +- In the **otp_server_config** directory copy **otp_config-template.php** to **otp_confi.php** and modify the settings as needed - As root run **docker build -t otp_server:latest .** - As root run **docker run -d --name otp_server --network host --rm otp_server:latest** +### Running the dosker image at boot +For systems using systemctl we suggest to install the new service called + +``` +[Unit] +Description=TOTP server for eduGAN technical site +After=docker.service +Requires=docker.service + +[Service] +TimeoutStartSec=0 +Restart=always +ExecStartPre=-/usr/bin/docker stop otp_server +ExecStartPre=-/usr/bin/docker rm otp_server +ExecStart=/usr/bin/docker run --rm --name otp_server --network host otp_server:latest +ExecStop=/usr/bin/docker stop -t 2 otp_server + +[Install] +WantedBy=multi-user.target +``` + ## Testing From the main technical site run: @@ -69,3 +92,5 @@ curl -o otp.out http://otp_server_address/otp_server.php?user=xxx@example.com Your otp.out should contain value "-1" which means - the user not found. If this works then you are ready to go. + +