How to start a server with authentication?

You can get help here if Freeciv doesn't start on your computer, or if you keep getting fatal errors while playing etc.
User avatar
Corbeau
Elite
Posts: 1057
Joined: Mon Jan 13, 2014 11:13 pm

Re: How to start a server with authentication?

Postby Corbeau » Sun Jun 02, 2019 9:20 pm

cazfi wrote:
Corbeau wrote:File: GT0_auth.conf (755) in the same directory. Content:

Code: Select all

[fcdb]
backend="sqlite"
database="$HOME/games/GT0/game.sqlite"

It's not a shell script! Freeciv does not know that by "$HOME" you mean value of the environment variable HOME.


I had all the same problems when it was "~". <--- this is supposed to be "tilde", it seems the forum doesn't show it properly

Anyway, problem(s) solved by other means. Madmax utilised the LT scripts so now everything is working.

But now I have another qiestion. Is it possible to reset a player's password? For example, when the game starts, it could happen that someone else, and not the pre-signed-up player, joins first and takes over someone else's nickname. What can be done in such cases?

cazfi
Elite
Posts: 1724
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to start a server with authentication?

Postby cazfi » Sun Jun 02, 2019 9:30 pm

Corbeau wrote:
cazfi wrote:
Corbeau wrote:File: GT0_auth.conf (755) in the same directory. Content:

Code: Select all

[fcdb]
backend="sqlite"
database="$HOME/games/GT0/game.sqlite"

It's not a shell script! Freeciv does not know that by "$HOME" you mean value of the environment variable HOME.


I had all the same problems when it was "~".

It doesn't parse that either. It would be looking for directory literally named "$HOME" or "~"

cazfi
Elite
Posts: 1724
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to start a server with authentication?

Postby cazfi » Sun Jun 02, 2019 9:35 pm

Corbeau wrote:But now I have another qiestion. Is it possible to reset a player's password? For example, when the game starts, it could happen that someone else, and not the pre-signed-up player, joins first and takes over someone else's nickname. What can be done in such cases?

You need to modify the database by sqlite3 -command. Requires some knowledge of SQL. I can try to write more detailed instructions in a couple of days.

User avatar
Corbeau
Elite
Posts: 1057
Joined: Mon Jan 13, 2014 11:13 pm

Re: How to start a server with authentication?

Postby Corbeau » Sun Jun 02, 2019 9:50 pm

Actually, I had a look and there seem to be some GUI tool for managing SQLs. Being a complete amateur, I will make a wild guess that doing very simple tasks would be very simple. For example, "resetting a password" would simple mean deleting the password entry in the database? Am I being too simple?

cazfi
Elite
Posts: 1724
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to start a server with authentication?

Postby cazfi » Mon Jun 03, 2019 5:31 pm

Corbeau wrote:For example, "resetting a password" would simple mean deleting the password entry in the database? Am I being too simple?
Freeciv adds password only in user creation, so you can't clear password entirely from an existing user hoping for user to be able to enter a new one, but you can change the password. Or rather its md5 hash that is what is stored in the database instead of an cleartext password.

Code: Select all

> echo -n "MyNewPassword" | md5sum

User avatar
Corbeau
Elite
Posts: 1057
Joined: Mon Jan 13, 2014 11:13 pm

Re: How to start a server with authentication?

Postby Corbeau » Mon Jun 03, 2019 7:06 pm

Let's put it this way.

When a game is created, there is a database where usernames and passwords are stored. So, what is the state of the database after the game is created and before the user logs in for the first time to create his password?

cazfi
Elite
Posts: 1724
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to start a server with authentication?

Postby cazfi » Mon Jun 03, 2019 7:44 pm

Corbeau wrote:So, what is the state of the database after the game is created and before the user logs in for the first time to create his password?

I don't know about longturn.net implementation (where users exist prior to server start), but in standard freeciv entire user entry (both username and password) get created when user logs in for the first time for a server that is started with -Newusers commandline parameter.

User avatar
Corbeau
Elite
Posts: 1057
Joined: Mon Jan 13, 2014 11:13 pm

Re: How to start a server with authentication?

Postby Corbeau » Mon Jun 03, 2019 8:20 pm

What happens if there is no -Newusers parameter?

cazfi
Elite
Posts: 1724
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to start a server with authentication?

Postby cazfi » Mon Jun 03, 2019 8:26 pm

Corbeau wrote:What happens if there is no -Newusers parameter?

Only those users that already exist (from earlier freeciv server run with -Newusers) can log in.

User avatar
Corbeau
Elite
Posts: 1057
Joined: Mon Jan 13, 2014 11:13 pm

Re: How to start a server with authentication?

Postby Corbeau » Mon Jun 03, 2019 8:59 pm

What does "from earlier freeciv server" mean? Where is the information stored between servers?