This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
wiki:advanced:multi-node:x2goserver-pgsql [2011/11/12 15:21] sunweaver |
wiki:advanced:multi-node:x2goserver-pgsql [2016/03/29 19:40] (current) stefanbaur [X2Go Server with PostgreSQL database backend] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | < | + | **Note: |
| - | Changes since x2goserver v3.0.99.x: | ||
| - | The '' | + | With X2Go Server v3.0.99.0 the whole session database backend code had been fully rewritten due to a serious security issue that had been brought up by Morty, Reinhard and Arw. Sind then, the '' |
| - | SQLite database (installation default) nor the PostgreSQL database. Since v3.0.99.x | + | SQLite database (installation default) nor the PostgreSQL database. Since v3.0.99.x PostgreSQL views and rules are used to restrict users from modifying or accessing data of other users. |
| - | PostgreSQL views and rules are used to restrict users from modifying or accessing | + | |
| - | data of other users. | + | |
| - | For accessing the X2go/PostgreSQL database Perl DBI has been used in x2goserver. | + | For accessing the X2Go/PostgreSQL database |
| - | __Preparations: | + | ===== Preparations ===== |
| - | | + | |
| - | * configure PostgreSQL server for md5 authentication for users from x2goserver | + | |
| + | * configure PostgreSQL server for md5 authentication for users from X2Go Server | ||
| < | < | ||
| Line 21: | Line 19: | ||
| </ | </ | ||
| - | __Example:__ | + | **Example:** |
| < | < | ||
| Line 30: | Line 28: | ||
| You must create a database user which can create databases and users for | You must create a database user which can create databases and users for | ||
| - | X2go database administration. You can also use the '' | + | X2Go database administration. You can also use the '' |
| job. | job. | ||
| Line 61: | Line 59: | ||
| </ | </ | ||
| - | __Database | + | ===== Database |
| < | < | ||
| Line 82: | Line 81: | ||
| </ | </ | ||
| - | Database administration using ''/ | + | ===== Database administration using ''/ |
| < | < | ||
| $ / | $ / | ||
| - | X2Go SQL admin interface. Use it to create | + | X2Go SQL admin interface. Use it to create |
| - | remove users or groups in x2go database | + | remove users or groups in X2Go session |
| Usage: | Usage: | ||
| x2godbadmin --createdb | x2godbadmin --createdb | ||
| Line 95: | Line 96: | ||
| </ | </ | ||
| - | __Create | + | ==== Create |
| < | < | ||
| Line 101: | Line 103: | ||
| </ | </ | ||
| - | __Create | + | ==== Create |
| < | < | ||
| Line 111: | Line 114: | ||
| </ | </ | ||
| - | After that step users can create | + | After that step users of the posix group '' |
| - | ====== | + | ===== Database Structure and Troubleshooting |
| - | :!: **Before you begin!** -> Note that you are using old and insecure code... Please upgrade to a current version of x2goserver. | + | |
| - | //The following documentation only exists for historical reference and it will be removed soon from this wiki.// | + | In hopefully rare cases it may become necessary to fix the X2Go session database via standard PostgreSQL tools (e.g. '' |
| + | ==== Connect to the database ==== | ||
| - | Please make sure that you have added the x2go repository | + | In case it becomes necessary |
| - | If you want to use an already existent PostgreSQL | + | |
| - | First of all, you'll need to tell the address of the target server to every x2goserver: | + | |
| < | < | ||
| - | # echo -n < | + | $ psql --user x2godbuser --password -h localhost --dbname x2go_sessions |
| </ | </ | ||
| - | Furthermore you'll need to allow “passwordless” authentication via SSH keys. Please don't add a “paraphrase” to the generated key: | + | As password use the password found in '' |
| - | < | ||
| - | # mkdir / | ||
| - | # ssh-keygen -t dsa -f / | ||
| - | </ | ||
| - | To copy the public part of the key to the PostgreSQL | + | After successful login, |
| + | |||
| + | < | ||
| + | ts-01:~ # psql --user x2godbuser --password -h localhost --dbname x2go_sessions | ||
| + | Password for user x2godbuser: < | ||
| + | Welcome | ||
| + | |||
| + | Type: \copyright for distribution terms | ||
| + | \h for help with SQL commands | ||
| + | \? for help with psql commands | ||
| + | \g or terminate with semicolon to execute query | ||
| + | \q to quit | ||
| + | |||
| + | x2go_sessions=> | ||
| + | </ | ||
| + | |||
| + | ==== Database structure ==== | ||
| + | |||
| + | The database has five tables: | ||
| + | |||
| + | < | ||
| + | x2go_sessions=> | ||
| + | List of relations | ||
| + | | ||
| + | --------+---------------+-------+---------- | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | (5 rows) | ||
| + | </ | ||
| + | |||
| + | Three of them are important for session management: sessions, used_ports, mounts. | ||
| + | |||
| + | Furthermore, the database defined four views: | ||
| + | |||
| + | < | ||
| + | x2go_sessions=> | ||
| + | List of relations | ||
| + | | ||
| + | --------+---------------+------+---------- | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | (4 rows) | ||
| + | |||
| + | x2go_sessions=> | ||
| + | </ | ||
| + | |||
| + | If you want to show the content of a table or view, evoke this SQL command: | ||
| + | |||
| + | < | ||
| + | x2go_sessions=> | ||
| + | server | ||
| + | --------------+---------------------------------------+-----------------+------- | ||
| + | ts-01 | mike-57-1379961697_stRTERMINAL_dp24 | x2gouser_mike | 30019 | ||
| + | ts-01 | mike-57-1379961697_stRTERMINAL_dp24 | x2gouser_mike | 30018 | ||
| + | ts-01 | mike-57-1379961697_stRTERMINAL_dp24 | x2gouser_mike | 30020 | ||
| + | (3 rows) | ||
| + | </file> | ||
| + | |||
| + | ==== Troubleshooting ==== | ||
| + | |||
| + | If you want to remove these entries (because they are there but they by some reason should not be there), use this command set: | ||
| < | < | ||
| - | # mkdir -p ~postgres/ | + | x2go_sessions=> delete from used_ports where port=30020; |
| - | # cat id_dsa-pub | + | DELETE 1 |
| - | # chown -Rf postgres: | + | |
| - | # chmod -Rf go-rwx ~postgres/ | + | |
| </ | </ | ||
| - | You can test the needed connection by entering following command: | + | ... or ... |
| < | < | ||
| - | # ssh -i / | + | x2go_sessions=> |
| + | DELETE 3 | ||
| </ | </ | ||
| - | You'll also need to run the “x2gocreatebase.sh” script as described before | + | For further input on manipulating PostgreSQL |