Remove basic auth security.

This commit is contained in:
Kyle Bostelmann 2016-09-28 16:14:05 -03:00
parent 9e2bdb8049
commit d788b25a74
4 changed files with 4 additions and 29 deletions

View File

@ -4,7 +4,6 @@ FACTORIO_PATH ?= ~/.factorio
SECURITY_PATH ?= $(FACTORIO_PATH)/security
SAVES_PATH ?= $(FACTORIO_PATH)/saves
MODS_PATH ?= $(FACTORIO_PATH)/mods
ADMIN_PASS ?= "" # Left empty to allow password to be autogenerated
PORT_FORWARD ?= -p 80:80 -p 443:443 -p 34197:34197/udp
build:
@ -18,7 +17,7 @@ logs:
docker exec -it factorio-server cat /var/log/nginx/error.log
run:
docker run -d --name factorio-server -v $(SECURITY_PATH):/security -v $(SAVES_PATH):/opt/factorio/saves -v $(MODS_PATH):/opt/factorio/mods $(PORT_FORWARD) -e ADMIN_PASSWORD=$(ADMIN_PASS) factorio-server-manager
docker run -d --name factorio-server -v $(SECURITY_PATH):/security -v $(SAVES_PATH):/opt/factorio/saves -v $(MODS_PATH):/opt/factorio/mods $(PORT_FORWARD) factorio-server-manager
stop:
docker stop factorio-server

View File

@ -23,21 +23,15 @@ You should always do that, as this will allow you to change the login credential
Ok, you got me. There might be things that are easier than that... You should do it anyways.
## Updating Credentials, adding and deleting users.
This is where I got lazy. I'm sorry, but I did not create a great tool that automagically does everything for you. But you can do it. As I'm sure you've read the security chapter and you've done everything I said there you should've mounted the security volume to any point on your filetree already. If not, read the security chapter!
An admin user is created initially using the credentials defined in the factorio-server-manager config file.
In the mounted security volume you'll find a passwords.conf file. This contains encrypted passwords for every user who can access the manager. The format is `username:encryptedpassword`.
The default admin credentials are `user:admin password:factorio`.
Deleting users is pretty straightforward. Delete the correct line.
To create a new password entry, you can use `openssl passwd -apr1 yourpasswordhere`. That should get you started.
Users can be added and deleted on the settings page.
## Updating Factorio
For now you can't update/downgrade the Factorio version from the UI. You can however do this using docker images while sustaining your security settings and map/modfiles. This guide assumes that you mounted the volumes /security /opt/factorio/saves and /opt/factorio/mods to your file system. Before doing anything we need to stop the old container using `docker stop factorio-manager`. To update Factorio you should then open the Dockerfile and change the Factorio version to the one desired. After that you need to rebuild the image using `docker build -t factorio-server-manager .`. Once completed you can simply rerun the command that you used to run the image in the first place. It's recommended to change the name to something including the version to keep track of the containers.
## For everyone who actually read this thing to the end
You can also set your default admin password by passing it to your initial docker run command like this:
`docker run -d --name factorio-manager -d -v [yourpath]:/security -p 80:80 -p 443:443 -p 34197:34197/udp -e "ADMIN_PASSWORD=jqkSnQS4rA" factorio-server-manager`
And now go and build some nice factories!

View File

@ -13,20 +13,5 @@ if [ ! -f /security/server.key ]; then
-out /security/server.crt
fi
if [ ! -f /security/passwords.conf ]; then
echo "Generating password file"
if [ -z "$ADMIN_PASSWORD" ]; then
echo "Generating credentials"
export ADMIN_PASSWORD=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c10)
fi
echo "Credentials:"
echo "**********************************"
echo "Username: admin"
echo "Password: $ADMIN_PASSWORD"
echo "**********************************"
echo -n "admin:" >> /security/passwords.conf
openssl passwd -apr1 $ADMIN_PASSWORD >> /security/passwords.conf
fi
nohup nginx &
/opt/factorio-server/factorio-server-manager -dir '/opt/factorio' -conf '/opt/factorio-server/conf.json'

View File

@ -42,9 +42,6 @@ http {
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
ssl_prefer_server_ciphers on;
auth_basic "restricted";
auth_basic_user_file /security/passwords.conf;
location /api {
proxy_pass http://goapp;
proxy_set_header Host $host;