From 153fb211ac2342907eb766a79c1f41824f981ab5 Mon Sep 17 00:00:00 2001 From: Ben Deutsch Date: Sun, 5 Aug 2018 13:13:38 +0200 Subject: Replace auth.txt with SQLite auth database (#7279) * Replace auth.txt with SQLite auth database --- doc/world_format.txt | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'doc') diff --git a/doc/world_format.txt b/doc/world_format.txt index 9b0a1ef07..c5d1d1be1 100644 --- a/doc/world_format.txt +++ b/doc/world_format.txt @@ -29,6 +29,7 @@ It can be copied over from an old world to a newly created world. World |-- auth.txt ----- Authentication data +|-- auth.sqlite -- Authentication data (SQLite alternative) |-- env_meta.txt - Environment metadata |-- ipban.txt ---- Banned ips/users |-- map_meta.txt - Map metadata @@ -62,6 +63,34 @@ Example lines: - Player "bar", no password, no privileges: bar:: +auth.sqlite +------------ +Contains authentification data as an SQLite database. This replaces auth.txt +above when auth_backend is set to "sqlite3" in world.mt . + +This database contains two tables "auth" and "user_privileges": + +CREATE TABLE `auth` ( + `id` INTEGER PRIMARY KEY AUTOINCREMENT, + `name` VARCHAR(32) UNIQUE, + `password` VARCHAR(512), + `last_login` INTEGER +); +CREATE TABLE `user_privileges` ( + `id` INTEGER, + `privilege` VARCHAR(32), + PRIMARY KEY (id, privilege) + CONSTRAINT fk_id FOREIGN KEY (id) REFERENCES auth (id) ON DELETE CASCADE +); + +The "name" and "password" fields of the auth table are the same as the auth.txt +fields (with modern password hash). The "last_login" field is the last login +time as a unix time stamp. + +The "user_privileges" table contains one entry per privilege and player. +A player with "interact" and "shout" privileges will have two entries, one +with privilege="interact" and the second with privilege="shout". + env_meta.txt ------------- Simple global environment variables. @@ -107,6 +136,7 @@ Example content (added indentation and - explanations): readonly_backend = sqlite3 - optionally readonly seed DB (DB file _must_ be located in "readonly" subfolder) server_announce = false - whether the server is publicly announced or not load_mod_ = false - whether is to be loaded in this world + auth_backend = files - which DB backend to use for authentication data Player File Format =================== -- cgit v1.2.3