x2goserver-4.1.0.3/ChangeLog0000644000000000000000000036463713377671145012464 0ustar x2goserver (4.1.0.3-0x2go1) unstable; urgency=medium [ Mike Gabriel ] * New upstream version (4.1.0.3) - x2goserver.service: Add Documentation= key. - x2goserver/lib/x2gocheckport: chmod a+x. - New bin:pkg: x2goserver-desktopsharing. Move all desktop sharing integration logic from x2godesktopsharing to x2goserver src:pkg. - Don't rely on "ln -sf" to remove a symlink before recreating it. If the target is non-writable, this may fail (observed on a Debian stretch system). Thus, removing the symlink file first and then recreating it. - Massive white-space cleanup (at EOLs). - x2goserver/bin/x2goruncommand: Support IceWM as desktop session type. * debian/x2goserver*.dirs: + Let dirs have a trailing slash in their path (for the human eye merely). * debian/copyright: + Regenerate auto-generated copyright.in file. + Adopt from recent Debian packaging. + Add x2goserver.spec. * debian/control: + Move xfonts-base from D to R. Thanks lintian. + Move C (x2goserver) with versioned x2godesktopsharing, to B. + Don't depend on essential package without version. Drop bash from D. + Bump Standards-Version: to 4.2.1. No changes needed. + Mention "client side printing support" also in descr of bin:pkg x2goserver-common. * debian/*.postinst: + Avoid recursive chmod/chown. Recursive chown/chmod is susceptible to hardlink attacks on mainline, non-Debian kernels. * debian/x2goserver.postinst: + Load debconf module, even if not used (Debian Policy demand). * debian/*.templates: + Move x2goserver and x2goserver-desktopsharing templates into separate files. * debian/po: + Add French translation. Thanks to Jean-Pierre Giraud from the Debian project. (Closes DBTS:#905931). * lintian: + Drop unused debian/x2goserver-printing.lintian-overrides. * debian/*: White-space cleanup. * x2goserver.spec: + Mention "client side printing support" in all pkg descriptions. + Regression fix: Use "desktopsharing" package name above its description, not copy+pasted "extensions". + Regression fix: Make /etc/x2go/desktopsharing be owned by x2goserver- desktopsharing. + Exclude x2go*-desktopsharing scripts and man page in %files x2goserver. [ Mihai Moldovan ] * New upstream version (4.1.0.3): - x2goserver/lib/x2gocheckport: remove executable flag. This file is STILL not meant to be executed directly. - libx2go-server-db-perl/Makefile: make sure our {C,LD}FLAGS are always appended to the user-provided ones. - x2goserver-desktopsharing/bin/x2goterminate-desktopsharing: replace historical "egrep" with "grep -E". - x2goserver-desktopsharing/bin/x2goterminate-desktopsharing: don't use negative exit codes. - x2goserver-desktopsharing/bin/x2goterminate-desktopsharing: more curly braces, quotes etc. - x2goserver-extensions/bin/x2goserver-run-extensions: replace historical "egrep" with "grep -E". - x2goserver-extensions/bin/x2goserver-run-extensions: don't use negative exit codes. - x2goserver-extensions/bin/x2goserver-run-extensions: more curly braces, quotes etc. - x2goserver/bin/x2gofeaturelist: replace historical "egrep" with "grep -E". - x2goserver/bin/x2gofeaturelist: more curly braces, quotes etc. - x2goserver/bin/x2goruncommand: replace historical "egrep" with "grep -E". - x2goserver/bin/x2goversion: replace historical "egrep" with "grep -E". - x2goserver/bin/x2goversion: more curly braces, quotes etc. - x2goserver/bin/x2gostartagent: use single quotes instead of double quotes for literal strings. - x2goserver-x2goagent/etc/x2goagent.options: re-enable BIG-REQUESTS; newer nx-libs versions (3.5.99.17+) should handle this much better. Fixes: #1325. Fixes: #1321. - misc: copyright updates, but for contributors who haven't been active or requested not to be bumped. - misc: switch to HTTPS-based URLs where appropriate. - misc: update Oleksandr's email address. - misc manpages: pre-release date update. - libx2go-server-db-perl/src/libx2go-server-db-sqlite3-wrapper.c: revamp wrapper, alike to what was done in x2gobroker. * x2goserver.spec: + Pull in openSUSE-release manually on OpenSuSE Tumbleweed to work around a bug. + Also pass %{__global_{c{,pp},ld}flags} down via {C,LD}FLAGS. + Bump nxagent dependency up to 3.5.99.17+. * debian/x2goserver-desktopsharing.postinst: + More curly braces, quotes etc. * debian/x2goserver-desktopsharing.config: + More curly braces, quotes etc. * debian/x2goserver-desktopsharing.postrm: + More curly braces, quotes etc. * debian/libx2go-server-db-perl.postinst: + Replace historical "egrep" with "grep -E". * debian/x2goserver.config: + Replace historical "egrep" with "grep -E". + More curly braces, quotes etc. * debian/control: + Bump nxagent dependency up to 3.5.99.17+. * debian/copyright{,.in}: + Merge copyright entries. + Fix links to our wiki and update to HTTPS. [ Orion Poplawski ] * New upstream version (4.1.0.3): - x2goserver{/bin/x2gostartagent,-x2goagent/etc/x2goagent.options}: allow setting nxagent nx/nx options on the server via x2goagent.options. Fixes: #1322. -- X2Go Release Manager Thu, 29 Nov 2018 05:55:21 +0100 x2goserver (4.1.0.2-0x2go1) unstable; urgency=medium [ Mihai Moldovan ] * New upstream version (4.1.0.2): - Makefile.PL: update version number. - x2goserver-xsession/Makefile: consolidate a few entries. - x2goserver-xsession/Makefile: also remove Xresource*, Xsession*, xinit* and Xclient* config files. - *.{8,5}: pre-release date update. * debian/rules: + Add support for perl/perl:any substitution variable based upon detected OS version. * debian/control: + Use dist-substitution variable instead of hardcoding perl:any. + Add build dependency on x11-common for /etc/X11/Xsession* to be available in the build environment and the symlinks to be created correctly. + Add Pre-Depends on specific minimum dpkg version to x2goserver-xsession, needed for ${DPKG_RUNNING_VERSION} support. * debian/: + Add x2goserver-xsession.{preinst,post{inst,rm}} scriptlets to handle Xsession.d breakage cleanup correctly. Note that we can rely on dpkg-maintscript-helper's dir_to_symlink support only if the version is high enough, which is not the case on older Debian and Ubuntu platforms. While on Debian, that's only Wheezy and lower and we don't care about these versions anyway, Ubuntu Trusty/14.04 is sadly still supported and needs to be provided a proper workaround for now. * debian/x2goserver-xsession.post{inst,rm}: + Fix syntax errors. -- X2Go Release Manager Wed, 01 Aug 2018 01:55:58 +0200 x2goserver (4.1.0.1-0x2go1) unstable; urgency=medium [ Mike Gabriel ] * New upstream release (4.1.0.1): - x2goserver/man/man8/x2gostartagent.8: Fix grammar flaw reported by Debian's lintian tool. - x2goserver/man/man8/x2goresume-session.8: Fix grammar flaw reported by Debian's lintian tool. - x2goserver-x2goagent/bin/x2goagent: Fix license version (GPL-2+ not 3+). This script however is obsolete and should be replaced by a symlink to $BINDIR/nxagent. - Makefile.docupload: Switch license to GPL-2+. - x2gocheckport: chmod a+x. - x2goserver*/: license header hygene. List all copyright holder above the short form license. This prevents the licensecheck utility from being fooled. - X2Go: more license header hygene. - libx2go-server-db-perl: more license header hygene. - X2Go Agent XPM: Rename from x2go.xpm to x2goagent.xpm. - X2Go XPM icon: white background, not transparent. * debian/control: + Change D (x2goserver-xsession) on perl-modules to perl. The existence of the perl-modules package is an implementation detail of the Debian Perl packaging. + Multiarch hinter script recommends annotating perl dependency with :any. + Bump Standards-Version: to 4.1.4. No changes needed. * debian/copyright: + Update copyright.in reference template. * debian/*: Process with wrap-and-sort -a -s -t -k -b. * debian/x2goserver-printing.postinst: + Make sure /var/spool/x2goprint is always created. * debian/rules: + Add dh-missing --fail-missing override. * debian/*.{install,manpages}: + Utilize install target rather than picking all files from the source tree ourselves. * debian/: + Drop inert file (due to wrong file suffix): debian/x2goserver.link. + Drop x2goserver-xsession.links. Symlinking provided by main Makefile's install target. * debian/x2goserver.postinst: + When testing for existence of /etc/x2go/applications, also consider it being a dangling symlink (dangling symlinks are not caught by 'test -e', but need a 'test -L'. Thanks to Andreas Beckmann for helping with this. (Closes: DBTS#904515). Backported from a Debian patch. * debian/x2goserver-printing.postrm: + Remove x2goprint's spool dir on purgal. * debian/x2goserver-common.postrm: + Properly purge /etc/x2go and /var/lib/x2go. [ Mihai Moldovan ] * New upstream version (4.1.0.1): - Makefile.PL: adjust embedded version number. - x2goserver/lib/x2gocheckport: remove executable flag. This file is not meant to be executed directly, but rather sourced by other X2Go shell scripts. - x2goserver-x2goagent/Makefile: do not stage rgb file any longer. Obsoleted, is now hardcoded into nxagent directly. - x2goserver-x2goagent/etc: remove rgb file. - x2goserver-fmbindings/Makefile: install share/mime/packages/sshfs-x2go.xml as a plain file, not an executable. - x2goserver-x2goagent/share/x2go/x2gofeature.d/x2goserver-x2goagent*: make executable. - x2goserver-x2goagent/Makefile: replace ${PREFIX}/bin/x2goagent wrapper script with a symlink to the ... x2goagent symlink in the NXLIBDIR. - x2goserver-x2goagent/bin: remove x2goagent wrapper script. Unneeded and actually harmful nowadays. - x2goserver-x2goagent/bin: add .keep file to keep this directory around. - x2goserver-x2goagent/Makefile: it's $(NXLIBDIR), not $(NX_LIBDIR). - x2goserver-x2goagent/Makefile: add missing bin component in symlink target for ${PREFIX}/bin/x2goagent. - x2goserver-common/Makefile: stage tmpfiles.d config file into ${PREFIX}/lib/. File should not be modified by users. - x2goserver-common/: move etc/tmpfiles.d to lib/tmpfiles.d. - x2goserver/sbin/x2godbadmin: whitespace only. - x2goserver/sbin/x2godbadmin: use global variable instead of hardcoded string (since the global variable is used latter on anyway). - X2Go/Server/DB.pm: add high-level MySQL/MariaDB support. References the X2Go::Server::DB::MySQL module (and functions/subroutines in there) which currently does not yet exist. - x2goserver/sbin/x2godbadmin: wrap PostgreSQL code in own block, should not have any functional impact. - {X2Go/Server/DB/PostgreSQL.pm,x2goserver/sbin/x2godbadmin}: move /etc/x2go/x2gosql/passwords/x2goadmin or ${HOME}/.x2go/sqlpass to .../x2gopgadmin and .../pgsqlpass respectively. Move is done at run-time, so no user interaction should be required. It requires one database operation to be carried out first in order to trigger the move, but x2godbadmin does not actually use that account information (only generates it), so we should be in the clear. - x2goserver/sbin/x2godbadmin: generate more secure user-level database passwords. - x2goserver/sbin/x2godbadmin: split out subroutines into main namespace, call them generically with correct parameters from specialized namespace. - x2goserver/sbin/x2godbadmin: remove potentially confusing whitespace. - x2goserver/sbin/x2godbadmin: fix up other try blocks; whitespace only. - x2goserver/sbin/x2godbadmin: implement MySQL support, based on Walid Moghrabis changes, but slightly amended. Caveat: INCOMPATIBLE DATABASE SCHEMA! - x2goserver/sbin/x2godbadmin: update copyright header. - UNINSTALL: add reference to remove mysqladmin password file if uninstalling the tarball manually. - x2goserver/sbin/x2godbadmin: no need to specify or use database for list_users operation. - X2Go/Server/DB/PostgreSQL.pm: fix syntax error. - x2goserver/sbin/x2godbadmin: don't use prototypes when functions actually take arguments. - X2Go/Server/DB: add new file MySQL.pm, implementing the MySQL session storage backend. Based on original code by Walid Moghrabi, but modified. Will fail to execute correctly, so do not use yet. - X2Go/Server/DB/MySQL.pm: copy over some (modified) functions and use them for validating session IDs, check user names at some places and the like, which will come in handy at a later point. - x2goserver/sbin/x2godbadmin: whitespace-only change. - X2Go/Server/DB/MySQL.pm: move into new X2Go_in_progress_do_not_use top-level directory. - x2goserver/sbin/x2godbadmin: error out when encountering MySQL server config for now. - X2Go/Server/DB.pm: error out when encountering MySQL server config for now. - x2goserver-common/etc/x2gosql/sql: add example MySQL section and add to "supported" backends list. - x2goserver-common/etc/x2gosql/sql: reformat PostgreSQL comments. - X2Go/Server/DB.pm: don't use X2Go::Server::DB::MySQL for now. - X2Go/Server/DB.pm: comment out calls to X2Go::Server::DB::MySQL::*. - x2goserver-x2goagent/etc/x2goagent.options: typo fix in comment only. - x2goserver-x2goagent/etc/x2goagent.options: disable BIG-REQUESTS; leads to a lot of weird crashes and is currently not implemented correctly in nxagent. Fixes: #1266. - x2goserver/bin/x2gostartagent: fix calculation syntax errors, drop useless subshells, don't use -o operator in plain test calls. - x2goserver-printing/bin/x2goprint: work around atomicity problems with newer FUSE versions, create .ready file as .notready, move/copy to target file system and only then rename it in a hopefully atomic fashion. - *.{8,5}: pre-release date update. * debian/{control,compat}: + Bump DH compat level to 9. * debian/: + Rename config to x2goserver.config. + Remove obsolete x2goserver-{extensions,printing,xsession}.dirs files, should be correctly handled via the main Makefile and staging by *.install files. + Remove obsolete x2goserver-fmbindings.dirs file. + Rename x2goserver.dirs to x2goserver-common.dirs, moving /var/lib/x2go to the -common package. + New file x2goserver-printing.dirs: own /var/spool/x2goprint. * debian/x2goserver-x2goagent.install: + Do not install rgb file/symlink any longer. * x2goserver.spec: + Do not install rgb file/symlink any longer. + Bump nxagent requirement to 3.5.99.5+. + Remove stale symlinks check workaround now that we pull in nxagent >= 3.5.99.0 by default. + Move references from etc/tmpfiles.d to %{_prefix}/lib/tmpfiles.d. + Depend upon perl(DBD::mysql) for MySQL/MariaDB support in perl DBD. + Comment out perl(DBD::mysql) dependency for now. + Backport dangling symlink check for /etc/x2go/applications. + Pull in GCC as a build dependency. + Mask out variables in comments to avoid build-time warning messages. + Work around build failure on Fedora Rawhide/29+ by pulling annobin in explicitly. Shouldn't be necessary, but the current architecture around redhat-rpm-config requires that. * debian/copyright.in: + Remove reference to rgb file. + Remove reference to x2goagent wrapper script. + Add .keep file in x2goserver-x2goagent/bin directory. + Change reference from x2goserver-common/etc/tmpfiles.d to x2goserver-common/lib/tmpfiles.d. * debian/x2goserver.dirs: + Remove etc/x2go/x2gosql references, already handled by x2goserver-common. + Remove all other obsolete entries that should be handled by the main Makefile and x2goserver.install staging. * debian/control: + Bump versioned dependency upon nxagent for x2goserver-x2goagent to the first version that hardcoded the RGB file into nxagent. + Pre-Depend on new enough dpkg for the dpkg-maintscript-helper to be available. + Change http to https links. + Pull in other changes from Debian downstream. + Depend upon libdbd-mysql-perl for MySQL/MariaDB support in perl DBD. + Deactivate libdbd-mysql-perl dependency for now, but keep as comment. * debian/x2goserver-x2goagent.{{pre,post}inst,postrm}: + Handle /etc/x2go/rgb conffile removal gracefully. * debian/x2goserver*{pre,post}*: + Rework scriptlets, use updated templates, add missing templates, more and better quoting, fix other misc. errors within the scripts. * debian/rules: + Enable hardening and automatic passing of *FLAGS. * debian/x2goserver-xsession.lintian-overrides: + Whitespace/EOL change only. * debian/*.manpages: + Prepend paths with debian/tmp/ in order to work around pre-compat-11 levels not falling back to looking into debian/tmp/ for files. * debian/x2goserver.{install,manpages}: + Also install x2goumount_* symlinks. * debian/x2goserver-common.install: + Move etc/tmpfiles.d entry to usr/lib/tmpfiles.d. * debian/x2goserver-x2goagent.{{pre,post}inst,postrm}: + Handle /etc/tmpfiles.d/x2goserver.conf conffile (re-)move to /usr/lib/tmpfiles.d/ gracefully. * debian/libx2go-server-db-perl.post{inst,rm}: + Add support for mysqladmin password file. * debian/{libx2go-server-db-perl,x2goserver{,-common}}.postrm: + Do not try to run rmdir on /etc/x2go if it doesn't exist. Makes the scriptlet (and thus the purge operation) fail... * debian/*.{pre,post}*: + Rework scriptlets, use updated templates, add missing templates, more and better quoting, fix other misc. errors within the scripts. * debian/libx2go-server-db-perl.postrm: + Remove empty directory on purge if possible. + Only remove files that the package actually created. * debian/x2goserver-common.postrm: + Only remove files that the package actually owns (/etc/x2go/x2gosql/sql). -- X2Go Release Manager Fri, 27 Jul 2018 06:46:00 +0200 x2goserver (4.1.0.0-0x2go1.2) unstable; urgency=low [ Mike Gabriel ] * Bump development upstream version to 4.1.0.0. * New upstream version (4.1.0.0): - Transform x2gologlevel.pm into proper Perl module X2Go::Log. - Transform x2godbwrapper.pm into proper Perl module X2Go::Server::DB. - Transform x2gosqlitewrapper.pl into small wrapper script and move the SQLite3 into Perl package X2Go::Server::DB::SQLite3. - Move x2gosqlitewrapper into Perl package X2Go::Server::DB::SQLite3. - Move PostgreSQL DB code into Perl package X2Go::Server::DB::PostgreSQL. - Move X2Go SQL configuration files (/etc/x2go/x2gosql) into package libx2go-server-db-perl. - Install /etc/x2go/x2go_logout with its directory x2go_logout.d via Makefile installation. - Fix new SQLite3 wrapper for db_getmounts Perl call. - Fix list output in new SQLite3 wrapper. - Make session type label XFCE a valid session that starts xfce4-session. - Fix failures of x2gogetagent that was related to faulty regexp in SQLite3 DB wrapper script. - Add X2Go Server feature X2GO_LIST_SHADOWSESSIONS. - Break execution of x2gosuspend-session / x2goterminate-session if the script is called without session as first argument and $X2GO_SESSION not set. (Fixes: #82). - Make x2goruncommand aware of the Cinnamon desktop shell. (Fixes: #117). - Fix build-arch target in x2goserver/Makefile. (Fixes: #121). - Load config files from a Perl package (X2Go::Config). - Disable SupeReNicer by default. - Fix session handling for cross-user-account desktop sharing. Now session names of desktop sharing session start with the username of the user who is requesting the desktop sharing, rather than the username of the person who shares his/her desktop. - Do not superenice desktop sharing / shadow sessions. - Drop obsolete components x2goserver-compat, x2goserver-pyhoca. - Makefile: pre-set the PERL_INSTALLDIRS var with ,,vendor''. Use pure_install rather than install. - Avoid one argument system calls in x2golistshadowsessions. - Provide Perl functions to capture stdout/stderr with multi-argument system calls. - Avoid one argument system calls and backticks in SupeReNicer. - Handle situations in SupeReNicer where the agent PID is not set. - Start working on an abstraction layer (as Perl package X2Go::Server::Agent) that handles all (NX) agent specific actions. Move duplicate code into that new Perl package. - Security audit of complete code tree, avoid one-argument system calls where possible, avoid backticks, use more quotes in shell scripts. - Add tunneling port allocation for TeleKinesis framework. - Only use teki_* fields with PostgreSQL DB backend if TeKi is enabled. - Provide --updatedb feature in x2godbadmin if DB backend is PostgreSQL. - Execute post-start.d extension scripts _after_ the session information has been submitted to the session DB. This allows execution of x2golistsessions and other X2Go commands in post-start.d extension scripts. - Re-arrange parameter order of x2gocreatesession and related DB functions. Make sure the session ID comes first and we have only optional parameters towards the end of the parameter array. - Fix accessing ARGV in X2Go::Utils:check_x2go_sessionid sub. (Fixes: #575). - Fix TeKi storing Telekinesis ports in PgSQL-based session DB. Allow negative port numbers for the case that Telekinesis is not installed. - Fix db_insertmount (SQLite). Pathnames must not be enclosed by parentheses. - Make sure to return "1" in X2Go::Server::DB Perl functions that don't return anything by default. - Make it possible to change the state of shadow sessions. - Provide --debug option for x2gocleansession that allows running x2gocleansessions in foreground (and in debug mode). - Properly clean up shadow sessions for the session database. - Move x2goagent wrapper package around nxagent into X2Go Server. (Fixes: #1047). - Update execution logic of the x2goagent wrapper script. The script now sets the env var $NXAPP and then calls the nxagent wrapper script. For this to work properly, the x2goagent symlinks has to be placed into directory where the nxagent executable is installed ($LIBDIR/nx/bin/, normally). - Revisit packaging for latest change in x2goserver-x2goagent. Don't inject $(LIBDIR) rather than injecting $(NXLIBDIR) via debian/rules and x2goserver.spec. - x2goagent wrapper script: Use exec command to launch nxagent. Put "$@" in quotes. * debian/control: + Package X2Go::Log in separate package: libx2go-log-perl. + Package X2Go::Server::DB in separate package: libx2go-server-db-perl. + x2goserver package: Depend on libx2go-log-perl, libx2go-server-db-perl. + Move x2goserver.conf into separate package: x2goserver-common. + Use Breaks/Replaces to exchange x2goserver.conf in x2goserver package by x2goserver.conf in new x2goserver-common package. + Move several x2goserver-* package to x2goserver's Recommends field. + Add Reinhard Tartler to Uploaders. + Add libcatpure-tiny-perl to Depends: field of libx2go-server-perl. + Move x2gosql config to x2goserver-common. + Several style and dependency fixes. Use Conflicts: instead of Breaks: for unversioned package conflicts. + Test if telekinesis-server is installed server-side. If so, prepare the telekinesis session sub-directory. + Add D (bin:package libx2go-server-db-perl): libswitch-perl. + Fix B/R for x2goserver-x2goagent. We need to break/replace x2goagent (<< 3.5.99.2~). + Nooo... we need to break/replace x2goagent (<< 2:3.5.99.2~). * debian/x2goserver.postinst, debian/libx2go-server-db-perl: + Handle X2Go session DB creation in x2goserver _and_ perl-X2Go-Server-DB on postinst. - Make sure X2Go session DB files get updated during postinst. * debian/libx2go-server-db-perl installation scripts: + Remove dpkg-statoverride during remove on prerm, not on purge in postrm. * debian/x2goserver.init: + Rely on $PATH when invoking x2gocleansessions. * debian/x2goserver.service: + Provide systemd service file. * Move code in pre/post+inst/rm scripts around (from x2goserver package to libx2go-server-db-perl and x2goserver-common). * debian/copyright: + Provide DEP-5 compliant copyright file. + Add copyright.in auto-generated file (by licensecheck+CDBS) for later reference. * debian/x2goserver-x2goagent: + Make sure the .features file for x2goserver-x2goagent ends up in its bin:pkg. * x2goserver.spec: + Bring debian/control and x2goclient.spec in sync. + Make sure x2godbadmin is evoked from package x2goserver. + Handle X2Go session DB creation in x2goserver _and_ perl-X2Go-Server-DB on postinst. + Set buildroot if we build for EPEL-5. + Use deprecated %{_initrddir} macro for EPEL-5 builds. + Take advantage of native RHEL support (since 4.0.1.10). + Install SQLite3 wrapper as setgid x2gouser. (Fixes: 371). + Assure that SQLite3 session DB file gets created on install (unless PostgreSQL is used as session DB backend). + Make sure x2goserver-*.features files do not get installed multiple times into various packages. + Make sure X2Go Server (x2gocleansessions) starts after installation. + Make sure X2Go session DB files get updated during postinst. + Require Perl(Switch) (bin:package x2goserver). + Don't fail in %post during X2Go session DB creation. + Fix call of x2godbadmin --updatedb during package upgrade. + Hand over %{_prefix}/%{_libdir}/nx as $NXLIBDIR to x2goserver's Makefiles. Required for x2goagent symlink to be properly installed into the same folder where the nxagent executable gets installed. + Also hand over %{_prefix}/%{_libdir}/nx as $NXLIBDIR when executing make install. + Add B-R: nxagent. Needed for %{_prefix}/%{_libdir}/nx/bin to be owned. [ Guangzhou Nianguan Electronics Technology Co.Ltd. ] * New upstream version (4.1.0.0): - Add SupeReNicer support. - Provide string sanitizers. Esp. a sanitizer for X2Go session IDs. [ Otto Kjell ] * New upstream version (4.1.0.0): - Add markdown files for most of the X2Go Server project folders. (Fixes: #102). - Fix "server" command line option for x2golistsessions call in x2golistdesktops. [ Orion Poplawski ] * New upstream version (4.1.0.0): - Use new script x2gopath in Perl::API. (Fixes: #86). * x2goserver.spec: - Fix NXLIBDIR path to use %{_libdir} directly. [ Oleksandr Shneyder ] * New upstream version (4.1.0.0): - Fix x2godbadmin. Set right column name "tekidata_port" in create table. (Fixes: #557). - Unset LD_LIBRARY_PATH for the case when x2gostartagent started from x2godesktopsharing. [ Mark Pederson-Cook ] * debian/po: + Translate DebConf templates to Danish. [ Kaan Ozdincer ] * debian/po: + Translate DebConf templates to Turkish. [ Mihai Moldovan ] * New upstream version (4.1.0.0): - x2goserver/sbin/x2gocleansessions: add timestamp to debug output. - x2goserver/sbin/x2gocleansessions: also (correctly) log to syslog if started with --debug parameter. - libx2go-server-db-perl/lib/libx2go-server-db-sqlite3-wrapper.pl: don't use deprecated defined (@array) construct which never really did what one would expect (defined () can only be used on scalar values.) - x2goserver/bin/x2gofeaturelist: whitespace only. - x2goserver-x2goagent/: rename share/x2go/rgb back to etc/rgb. - x2goserver-x2goagent/Makefile: install etc/rgb as in ${SYSCONFDIR}/x2go/rgb again and create a symlink from that to ${DATADIR}/x2go/rgb. - x2goserver-x2goagent/Makefile: fix left-over reference to share/x2go/rgb. It's back to etc/rgb now. - x2goserver-x2goagent/share/x2go/x2gofeature.d/: rename x2goserver-agent.features to x2goserver-x2goagent.features. - x2goserver/sbin/x2gocleansessions: add -d short parameter for enabling debugging capabilities to POD. - README.md: whitespace fixes and typo correction. - X2Go/Server/DB/SQLite3.pm: fix command name in error messages. - X2Go/Utils.pm: backport user name regex changes. - x2goserver-x2goagent/etc/x2goagent.options: reenable XFIXES extension. - x2goserver/bin/x2gostartagent: fix most other shellcheck warnings, more quotes, curly braces et. al. - x2goserver/bin/x2goresume-session: fix most other shellcheck warnings, more quotes, curly braces et. al. - x2goserver/lib: add new perl wrapper script for X2Go::Utils::is_true called x2goistrue. - x2goserver/bin/x2gostartagent: replace inline perl with calls to x2goistrue and x2goqueryconfig. - x2goserver/bin/x2gostartagent: support disabling or enabling RANDR Xinerama in x2goagent via any parameter in the form randr_xinerama=value (with value interpreted by x2goistrue). Note that it is not possible to change the RRXinerama preference after a session has been started currently. - x2goserver/bin/x2gostartagent: pass in xinerama configuration value via environment. Doing it via an argument is just asking for trouble since we actually have optional parameters. - x2goserver/bin/x2gostartagent: add FIXME entry for the SHADREQ_USER optional parameter. No client actually uses it and it makes the whole parameter handling fragile. - x2goserver/bin/x2go{startagent,resume-ression}: instead of disabling RANDR Xinerama if no xinerama support has been requested, switch to modifying the xinerama nx/nx option. For x2gostartagent, that means a variable rename from X2GO_RANDR_XINERAMA to X2GO_XINERAMA with essentially the same semantics. For x2goresume-session, a new parameter is added. - x2goserver/bin/x2gostartagent: disable Xinerama support by default, more compatible with the old behavior (and python-x2go/PyHoca). - x2goserver/bin/x2go{resume-session,runcommand}: drop obsolete and now-unused NX_XINERAMA_CONF variable. - x2goserver/lib/x2gogetrandomport: fix function name, leading to startup failures. - x2goserver/lib/x2go{check,getfree}port: parameter expansion and single quotes don't mix well. Use double quotes instead. - x2goserver/lib/x2gocheckport: fix X2GO_LIB_PATH -> x2go_lib_path typo. - x2goserver/bin/x2gostartagent: output variable expects a string, not an integer. - x2goserver/lib/x2goistrue: perl strips empty parameters from @ARGV, so work around that gracefully. - x2goserver/lib/x2goistrue: use shift unconditionally and check the parameter to be defined instead. - x2goserver/bin/x2goresume-session: handle missing xinerama parameter in options string gracefully, skipping that part (and the other optional geometry string) correctly. - x2goserver-common/Makefile: whitespace (lineup) only. - */man/*/*: update dates and version in manpages. - */VERSION.*: remove -preview tag. * x2goserver.spec: - Only create session DB in x2goserver's post install script. Do use proper Requires(post) statements to make sure perl-X2Go-Server-DB and x2goserver-common are available when x2goserver's post install script is being executed. Fixes installation bugs reported by Michael DePaulo. - Add support for %{_datadir}/applications symlink in %{_sysconfdir}/x2go. + Add creation and deletion bits to %post and %preun scriptlets. + Refactor %post, %pre, %postun and %preun scriptlets to accommodate for last change. + Don't use %{_sbindir} for chkconfig and service on SLE{S,D}. %{_sbindir} is a macro for /usr/sbin/, whereas chkconfig and service reside in /sbin/. - Change deprecated and removed PreReq to Requires(pre) header. - Move shadow/shadow-utils/pwdutils Requires to x2goserver-common sub package (where they are actually needed.) - Re-add etc/rgb as a config file. - Correctly create and specify the x2goserver-x2goagent subpackage, instead of a standalone x2goagent package. - Fix dependency upon versioned nxagent. - Let x2goserver depend upon x2goagent-virtual, add Provides: keyword to x2goserver-x2goagent (also need to be implemented within X2Go's nx-libs master branch.) - Add script/symlink ${LIBDIR}/x2go/bin/x2goagent to installed file list. - Split up x2gosql installed file list part into actual directories and files. - Disable stale symlinks check for now (and add comment to re-enable it once we've switched to nx-libs 3.5.99 or higher for good.) - Actually export NO_BRP_STALE_LINK_ERROR in a correct way/with the correct value. Never blindly trust the internets if something looks odd. - Add %{_libdir}/x2go/bin as owned directory for x2goserver-x2goagent. Also owned by the alternative package x2goagent in nx-libs. - Exclude %{_bindir}/x2goagent from being packaged into x2goserver package. - x2goserver-x2goagent needs nxagent 3.5.99.3 and higher. - Actually add logcheck Requires. - Give the x2goagent-virtual package a specific version, derived from the x2goserver version. - Let x2goserver-x2goagent conflict with the former x2goagent package. - Let x2goserver depend upon its own x2goserver-virtual package for now. The release after that can drop the virtual package again. - Add x2goistrue to %files section. - Remove useless x2goagent-virtual Provides: and let x2goserver-x2goagent obsolete older x2goagent packages. * debian/control: - Maintainer change in package: X2Go Developers . - Depend upon newer x2goagent package that now provides the x2goagent.options file. - Fix nxagent dependency. Must be version 3.5.99.3 or higher. Epoch was missing. - Dip into cold water and depend solely upon x2goserver-x2goagent in a versioned fashion. * debian/: - Remove x2goserver-x2goagent.dirs and hope it's really unneeded, because the Makefile creates these directories correctly. * debian/x2goserver-x2goagent.install: - Re-add etc/rgb file. [ Martti Pitkänen ] * debian/po: - fi.po: update Finnish DebConf templates translation. -- X2Go Release Manager Thu, 15 Feb 2018 23:03:48 +0100 x2goserver (4.0.1.23-0x2go1) UNRELEASED; urgency=medium [ Mihai Moldovan ] * New upstream version (4.0.1.23): - x2goserver/bin/x2gostartagent: reenable XFIXES extension. The initial problem that required this workaround has been fixed a long time ago. - x2goserver/lib: new wrapper script x2goqueryconfig to fetch a config value out of the global x2goserver.conf file. - x2goserver/etc/x2goserver.conf: add x2goagent.port_randomization configuration option. Can be set to either "host-based" or "pure-random". - x2goserver/bin/x2gostartagent: use x2goagent.port_randomization configuration value. Currently only a value of "host-based" is directly mapped to the host-based algorithm, while any other value (or a failure of failure) are mapped to the "pure-random" code path. - x2goserver/bin/x2gostartagent: fix shellcheck warning related to arrays. - x2goserver/bin/x2gostartagent: update copyright notice. - x2goserver/bin/x2gostartagent: fix most shellcheck warnings, whitespace errors, use more quotes and curly braces. - x2goserver/bin/x2gostartagent: drop obsolete X2GO_BIN environment variable usage. - x2goserver/bin/x2gostartagent: make shellcheck happy by referencing "${SAVED_DISPLAY}" once. - x2goserver/bin/x2gostartagent: checking for the exit status of a variable assignment isn't helping us in finding out if x2goagent is still running. Even otherwise, the exit status would be useless since we spawn x2goagent in the background. Better check if the PID still exists and error out if it's gone. There certainly is potential for race conditions (i.e., x2goagent started, then exited, then another process took its place). On Linux, this situation is unlikely to happen, since PIDs are only recycled once the maximum PID value is reached, meaning that enough processes to overflow the PID + to get to the original PID value need to be spawned in a very short amount of time. Unlikely, but not impossible. - x2goserver/bin/x2gostartagent: replace perl call with bash pattern substitution. - x2goserver/bin/x2gostartagent: some shells do not handle quotes in pattern substitutions gracefully. Remove them. - x2goserver/lib: new script x2gogetfreeport, consists of duplicated functionality in x2gostartagent. - x2goserver/lib: new script x2gogetrandomport, contains the port randomization (or pseudo-randomization) features that are part of x2gostartagent, but need to be accessible by other scripts as well. - x2goserver/bin/x2gostartagent: remove spurious semicolon and add quotes on the lib path line. - x2goserver/bin/x2gostartagent: start using x2gogetrandomport, delete now-duplicate code. Also adjust return values accordingly. - x2goserver/bin/x2gostartagent: fix return code that should have been zero, indicating success. - x2goserver/bin/x2goresume-session: remove spurious semicolon and add quotes on the lib path line. - x2goserver/bin/x2goresume-session: properly randomize first port, just like in x2gostartagent. - x2goserver/bin/x2go{startagent,resume-session}: use x2gogetfreeport instead of duplicating the same code everywhere. Fixes: #1230. Also, rely on it returning a valid value and try at most 10 times to fetch a usable port value, then error out and make the session startup or resumption fail. - x2goserver/bin/x2gostartagent: fix hostname detection. Only error out if the hostname call actually failed, not the other way around. - x2goserver/bin/x2goresume-session: fix shellcheck warnings, use bash-style tests, more quotes, curly braces, wrap literal strings in single quotes, avoid useless constructs, fix whitespace errors and probably more. - x2goserver/bin/x2gostartagent: use single quotes for literal strings, bash-style checks, more curly braces, terminate options for commands that use outside input (variables), fix copyright notice. - x2goserver/lib/x2gogetfreeport: use single quotes for literal strings. - x2goserver/lib/x2gogetfreeport: use error code 1 for general failure, shift parameter sanitization failure codes up. - x2goserver/lib: new script x2gocheckport, containing common functionality for port checking. Duplicated code will be deleted next. - x2goserver/lib/x2gogetfreeport: check start and end paramters in a stricter fashion. - x2goserver/lib/x2gogetfreeport: use the check_*_port functions, require current host name as a parameter and adapt x2gogetfreeport usages accordingly. - x2goserver/bin/x2goresume-session: actually check if the old port values have been refurbished within the system and reassign them. - x2goserver/bin/x2goresume-ression: whitespace fix only. - x2goserver/bin/x2gostartagent: check and adapt exit codes. - x2goserver/etc: add new tmpfiles.d/x2goserver.conf file, protecting session directories from systemd's tmpfiles deletion. - x2goserver/Makefile: install and uninstall etc/tmpfiles.d/x2goserver.conf. - x2goserver-xsession/etc/Xsession: change interpreter to bash. Some tests do not work in other shells. * x2goserver.spec: - RPMify x2goserver-xsession description. - Remove qt4 stuff, we're not using the framework here. - Split out logcheck files into an x2goserver-logcheck subpackage. Avoids installing logcheck as a hard-dependency with X2Go Server for people who do not want or expect that. Logcheck users can install x2goserver-logcheck as a standalone package instead. - Add correct Group: to x2goserver-logcheck package. - Install new files x2go{checkport,get{free,random}port,queryconfig} into the lib dir. - Fix logic when checking for "distro version lower than X". - Add new conffile /etc/tmpfiles.d/x2goserver.conf on systems that actually use/have systemd. - Actually install /etc/sudoers.d/x2goserver conffile on non-SuSE systems. Got broken accidentally a while ago. - Backport /etc/x2g/applications behavior from upstream Fedora spec file. Own the file as part of a %ghost procedure and make sure that the removal is only executed on real package erases (i.e., not also during package upgrades). - Create applications file in %install section, not %pre. * debian/x2goserver.install: - Install new /etc/tmpfiles.d/x2goserver.conf conffile. -- X2Go Release Manager Sat, 11 Nov 2017 13:01:29 +0100 x2goserver (4.0.1.22-0x2go1) unstable; urgency=medium [ Mihai Moldovan ] * New upstream version (4.0.1.22): - x2goserver/bin/x2go{resume-session,startagent}: use the actual system's host name instead of the short name only. Fixes startup issues on a wide variety of systems that use a FQDN as their host name. In such a scenario, using the short name works iff the short name maps to 127.0.0.1. Otherwise, session startups fail. Using the actual host name does not require such hacks, so use this instead. -- X2Go Release Manager Sat, 11 Nov 2017 12:53:48 +0100 x2goserver (4.0.1.21-0x2go1) unstable; urgency=medium [ Mihai Moldovan ] * New upstream version (4.0.1.21): - x2goserver/sbin/x2gocleansessions: don't overzealously try to remove old nxagent sockets. If the nxagent process already vanished, simply forget the remembered session. Otherwise we might delete sockets that have been re-assigned to other sessions in the meantime. - x2goserver/bin/x2gostartagent: convert X2GO_PORT searching algorithm to pure bash and let script fail if no display port is available. - x2goserver/sbin/x2gocleansessions: fix syntax error introduced in last change to this file. - x2goserver/bin/x2gosetkeyboard: make compatible with changes in Arctica's nxagent. Also change to an all-bash algorithm. Fixes: #1151. - x2goserver/bin/x2gosetkeyboard: fix a typo that caused the script to not work properly - with or without Arctica's nx-libs. - x2goserver/bin/x2gosetkeyboard: rename ${setxkbcomp_opts} to ${setxkbmap_opts}, that's what it really is. - x2goserver/bin/x2gosetkeyboard: setxkbmap expects a parameter called "-option", but nxagent uses the key "options". Make setxkbmap happy. - x2goserver/bin/x2gosetkeyboard: $BASH_REMATCH is tricky, actually fetch the first match. In the $BASH_REMATCH array, index 0 contains the *full* match, while indices 1+ only contain the partial matches. We're only interested in the first partial match. - x2goserver/bin/x2gosetkeyboard: only match up the first ending quote character in a non-greedy way. This will not support nested quotes within values, but we probably don't need this feature anyway. - x2goserver/bin/x2gostartagent: try to enable lingering via systemd's loginctl utility before calling x2goagent. Fixes: #1198. - x2goserver-xsession/etc/Xsession: support Devuan just like Debian, give useful error message in case the OS is unknown. - x2goserver/bin/x2gostartagent: fetch hostname via "hostname -s" and do not rely on the HOSTNAME variable. The latter is only set automatically by bash if it's not already part of the environment. We might get "garbage" in this way (and one user actually did.) - x2goserver/bin/x2golistshadowsessions: whitespace only. - x2goserver/sbin/x2gocleansessions: close syslog at program exit. - x2goserver/sbin/x2gocleansessions: whitespace only. - x2goserver/bin/x2golistshadowsessions: copy and use a few needed utility functions from x2gocleansessions. - x2goserver/bin/x2golistshadowsessions: mark unavailable functionality with FIXME comments. - x2goserver-xsession/etc/Xsession: add support for OS RT via /etc/os-rt-release (file needs to be created by upstream first, bug pending.) - x2goserver/{bin/x2golistshadowsessions, lib/x2go{dbwrapper.pm,sqlitewrapper.pl}}: backport listshadowsessions* DB functions and unmark them as FIXME entries. - x2goserver/lib/x2go{sqlitewrapper.pl,utils.pm}: allow arbitrary-length user names, user names starting with digits and drop $ as a valid user name character. Fixes: #1229. - x2goserver/bin/x2goruncommand: use dbus-run-session to start a new dbus user session if available. Only for full desktop sessions. Backported from a Debian patch. - x2goserver/bin/x2goresume-session: backport HOSTNAME changes from x2goserver/bin/x2gostartagent. - x2goserver/bin/x2go{resume-session,startagent}: catch errors while inserting values into database more gracefully. Fixes: #1230. - x2goserver/bin/x2gostartagent: write hostname errors to stderr to make X2Go Client (and maybe PyHoca?) fail. - x2goserver/{bin/x2go{runcommand,suspend-session}, sbin/x2gocleansessions}: remove hopefully redundant HOSTNAME export commands. - x2goserver/etc/x2goagent.options: remove file, moved to x2goagent. - x2goserver/Makefile: actually unreference x2goagent.options file as well. - x2goserver/bin/x2go{resume-session,startagent}: revert error catching while inserting values into database. The current code structure relies on ignoring failures and retrying until an operation succeeded, which may eventually happen or just as well may never happen. We need something smarter here. - x2goserver/bin/x2gostartagent: log x2goagent startup command to syslog in debug mode. * x2goserver.spec: - Add mandatory perl-generators Build-Requires as per https://fedoraproject.org/wiki/Changes/Build_Root_Without_Perl - Correct usage of mime and desktop database upgrade scriptlets and dependencies. Fedora mandates to not depend upon shared-mime-info, even not for the scriplets. Additionally, FC24 has deprecated usage of the mime database update scriptlet and FC25 has deprecated usage of the desktop database update scriptlet. (Open)SUSE mandates to pull in shared-mime-info and desktop-file-utils as post/postun scriptlet dependencies and provides special macros since 11.4. Older versions are handled via the usual commands. - Simplify systemd usage a bit and make sure that it's restarted on Fedora and RHEL-based distros. FIXME: Not enabled by default on FC/RHEL/*SuSE. - Use Suggests instead of Recommends, as an even weaker dependency. We can live just fine without printing or fmbindings and no functions of the x2goserver package as well will be impacted. The DEB control file also uses "Suggests" for this. - Fix RPM spec syntax error in shared-mime-info dependency section. - Fix %{?fedora} macro usage. - Add the correct package name to the %posttrans scriptlet, we only need it for x2goserver-fmbindings. - Make sure that we don't go into branches just because a macro is not defined on our platform. - Work around a bug in SuSE's mime DB update script... - Make sure that there's always at least one (nil) command in the if command list. - Break older SLES builds on purpose to see what branch is *actually* taken. Will be reverted shortly. - Fix typo in %if condition (0%?{?fedora} instead of 0%{?fedora}.) - Contrary to other information that says "brackets" and consistent with RPM's source code, grouping is done via "(" and ")" in conditions. - More platform-specific condition fixup. - Pull in shared-mime-info as a build requirement only on *SuSE and add comment regarding why desktop-file-utils is always needed. - Also add a trans(action)-requirement on shared-mime-info for older RHEL-based distros. - RPM spec does not allow %elif or %elseif, which lead to all weird kinds of errors. Split these up into nested conditions. - There is no %trans scriptlet, we're using %posttrans, so the dependency should be specified as Requires(posttrans) as well. - Pull in dbus-run-session if possible. Only available on Fedora, SLE12+ and OpenSuSE 13+. - Pull in x2goagent >= 3.5.0.33 explicitly, first version that reflects the x2goagent.options file move. * debian/po: - Tiny fixup on author name. * debian/control: - Whitespace fixes. - Add BD on dh-systemd. We'll need it for systemd integration. - Depend upon dbus for dbus-run-session. - Pull in x2goagent >= 3.5.0.33 explicitly, first version that reflects the x2goagent.options file move. * debian/rules: - Call the systemd addon to process and install the systemd service file. - Don't fail if we don't have the systemd addon. Systems that don't have that will likely not use systemd in the first place. [ Martti Pitkänen ] * debian/po: - Translate DebConf templates to Finnish. [ Orion Paplowski ] * x2goserver.spec: - Requires(post) does not imply Requires, and missing ones on grep and the SQLite perl module. - Fedora >= 21 and (Open)SUSE >= 11 now allow Recommends. - perl(:MODULE_COMPAT...) is only needed for perl modules. Drop from x2goserver-printing and x2goserver-xsession. - Delete .packlist which may be in different locations. - Sort some %files entries. [ Mike Gabriel ] * New upstream version (4.0.1.21): - x2goserver/bin/x2goruncommand: stop exporting LD_LIBRARY_PATH when using Arctica's nx-libs and its new Xinerama feature. Fixes: #1153. - Make x2goruncommand aware of the LXQt desktop shell. - x2goserver/x2gosqlitewrapper.c: fix implicit declaration of execv(). - x2goserver/: backport x2golistshadowsessions. -- X2Go Release Manager Wed, 08 Nov 2017 15:01:58 +0100 x2goserver (4.0.1.20-0x2go1) unstable; urgency=low [ Mike DePaulo ] * New upstream version (4.0.1.20): - TERMINAL Session: Add support for qterminal (Lightweight terminal emulator written in Qt) - TRINITY: Add support for Q4OS [ Mihai Moldovan ] * New upstream version (4.0.1.20): - x2goserver/bin/x2gogetapps: respect NoDisplay and Hidden values, don't parse the full desktop file if there are non-Desktop Entries groups. Based on a patch submitted by Jason Alavaliant. Fixes: #812. - x2goserver/bin/x2gogetapps: do not print spurious newlines. - Change string "X2go" to "X2Go" where appropriate. - Add runcommand.d hooks to x2goserver-extensions Makefile. - x2goserver/bin/x2gosessionlimit: don't iterate over the whole groups file. Only check the primary and secondary groups as returned by getgid()/getgroups(). Fixes long delays in session startup on machines with a gazillion of groups. - x2goserver/sbin/x2gocleansessions: re-fetch the current sessions' status before handling it. Using the "cached" value from the initial x2golistsessions run may be desynchronized with the actual current value. Avoids a race condition logging users out after they attached to a session. - x2goserver/sbin/x2gocleansessions: rename %remembered_sessions_since to %remembered_sessions_status_since. That's what it really is. Add comments to further clarify what it's actually doing. Change it to include a timestamp instead of the "iteration count multiplied by two" value. Compare timestamps to see if killing hanging nxagent processes is necessary. - x2goserver/sbin/x2gocleansessions: rename %remembered_sessions_status_since to %remembered_sessions_status_since_time. Add %remembered_sessions_status_since_iterations that will come in handy for the next change. - x2goserver/sbin/x2gocleansessions: give suspended-but-running sessions a grace period of one iteration. Fixes: #888. - x2goserver/sbin/x2gocleansessions: fix ugly missing whitespace. - x2goserver/sbin/x2gocleansessions: move up session status sync a bit, don't update session state when session has been removed from the database. - x2goserver/sbin/x2gocleansessions: unify log messages. Move dangling line around. - x2goserver/sbin/x2gocleansessions: whitespace only. - x2goserver/sbin/x2gocleansessions: also delete entries in the other, overlooked hashes. - x2goserver/sbin/x2gocleansessions: move socket and lock file cleanup into time-based block for finished/failed sessions. - x2goserver/sbin/x2gocleansessions: add @remembered_finished_sessions array. Merge with session list as queried from the database (won't include finished/failed sessions) and remember F-state sessions via this array. Only delete elements once work on these has been finished. - x2goserver/sbin/x2gocleansessions: don't add failed/finished sessions to remembered list if that list already includes them. - x2goserver/sbin/x2gocleansessions: don't use gmtime (time ()) but merely time (). The former one returns a formatted date-time string, which can't be checked by forming a difference. The latter one returns an UNIX timestamp, which is what we really want... minus leap seconds. Let's hope this doesn't bite back some time or later... - x2goserver/sbin/x2gocleansessions: add debugging output to show the state change when updating the cached state result. - x2goserver/sbin/x2gocleansessions: only output status refreshing debug message if the old and new states actually differ. Prevents log spam. - x2goserver/bin/x2gostartagent: changes to Robert Nowotny's SSH_PORT patch. Fixes: #922. Use default outgoing interface to determine IP address. Use the whole range of ${RANDOM}'s pool. Seed it for good measure. Change the default method to randomization instead of IP-based initialization. If IP-based initialization was requested but the default outgoing IP address unavailable, fall back to randomization. - x2goserver/bin/x2goruncommand: whitespace and comment changes only. - x2goserver/bin/x2gocleansessions: replace system_capture_stdout_output() with actual implementation. We don't have that function on the release branch. - x2goserver-xsession/etc/Xsession: use /bin/bash explicitly on RedHat-, Gentoo- and SuSE-based systems. Users might change /bin/sh to point to a shell like mksh or dash, which do not support the -l or -c flags to exec. C.f., BGO #575022 (Gentoo.) - x2goserver/bin/x2gomountdirs: remove blowfish Cipher spec hardcoded for sshfs mounts. The speed improvement is probably mostly an illusion (unless talking about high-bandwidth links) and more importantly recent OpenSSH server versions seem to disable the Blowfish cipher by default, leading to errors like "Connection reset by peer." - x2goserver/bin/x2goruncommand: whitespace only. - x2goserver/sbin/x2gocleansessions: add Perl documentation and --help, -h, -? and --man options. Fixes: #1065. Also print a usage message on unknown options. - x2goserver/man/man8/x2gocleansessions.8: drop obsolete man page. - x2goserver-xsession/etc/Xsession: fix uname calls when (potentially) creating session log/error file and add uname call where necessary. - x2goserver-xsession/etc/Xsession: include hostname in xsession-x2go-errors file name. Part of #923. - x2goserver-xsession/etc/Xsession: rotate old log/error file before appending new data. Fixes: #923. - x2goserver-xsession/etc/Xsession: fix wrong variable usage. Fixes: #1073. - x2goserver/sbin/x2gocleansessions: move in-file POD to end of file, rather than "commenting" out all the remaining code. Fixes: #1068. - x2goserver/sbin/x2godbadmin: exit earlier when not finding the required "x2gouser" user. * x2goserver.spec: - Add sudo and logcheck as BuildRequires and Requires. Don't own directories that are owned by sudo and logcheck. Logcheck is not available on *SUSE, FC < 20 and RHEL, so for those distros still own the directories. - Typo fix in comment: Recommands -> Recommends. - Fix installation on OpenSUSE 12.3 and higher: has replaced pwdutils with shadow. Also affects SLE{S,D} 12. - Add workaround documentation for sudoers on *SUSE 11. - Add shadow/shadow-utils/pwdutils Requires to x2goserver-printing sub package. - Add new dependency on bash. - Add new dependency on xkeyboard-config to x2goserver. Fixes: #903. - Add new dependency on perl and the Cwd module to x2goserver-xsession. Part of #923. * debian/control: - Add new dependency on bash. - Add new dependency on xkb-data to x2goserver. - Maintainer change in package: X2Go Developers . - Uploaders: add myself. Also, force a rebuild due to the changed versioning. - Add new dependency on perl-modules for Cwd. Part of #923. [ Henning Heinold ] * New upstream version (4.0.1.20): - x2goserver/sbin/x2godbadmin: remove trailing whitespace. - x2goserver/sbin/x2godbadmin: revoke all PRIVILEGES before trying to delete a user on postgres. Fixes: #889. [ Mike Gabriel ] * debian/x2goserver.preinst: + Use proper comment header explaining about preinst script argument calls (not postinst). [ Robert Nowotny ] * New upstream version (4.0.1.20): - x2goserver/bin/x2gostartagent: original patch for SSH_PORT randomization/IP-based initialization. Submitted as #922. [ Stefan Baur ] * New upstream version (4.0.1.20): - x2goserver/bin/x2goruncommand: add the other trinity launcher scripts in order from newest to oldest. Fixes: #985. [ Tor Perkins ] * New upstream version (4.0.1.20): - x2goserver/bin/x2goruncommand: capture x2goruncommand debug output for x2gofeature X2GO_XSESSION. [ Orion Poplawski ] * New upstream version (4.0.1.20): - x2goserver/bin/x2golistdesktops: drop -u parameter to ss. Fixes: #799. We would filter out UDP sockets later anyway and the combination -lxu is known to be broken with some versions of iproute2. -- X2Go Release Manager Sun, 20 Nov 2016 12:39:36 +0100 x2goserver (4.0.1.19-0x2go2) UNRELEASED; urgency=low [ Mihai Moldovan ] * New upstream version (4.0.1.19): * x2goserver.spec: - Do not search for unavailable file in x2goserver's post install script. Fixes installation bugs reported by Michael DePaulo. - Add support for %{_datadir}/applications symlink in %{_sysconfdir}/x2go. + Add creation and deletion bits to %post and %preun scriptlets. + Refactor %post, %pre, %postun and %preun scriptlets to accommodate for last change. + Don't use %{_sbindir} for chkconfig and service on SLE{S,D}. %{_sbindir} is a macro for /usr/sbin/, whereas chkconfig and service reside in /sbin/. - Change deprecated and removed PreReq to Requires(pre) header. - Only use /etc/permissions.d on SUSE. Unsupported on RHEL/FC/EPEL. - Fix RPM build failure due to misplaced fi in %pre scriptlet. - %defattr must come before %doc, OR ELSE. Fixes SLE{S,D} 11 builds. -- X2Go Release Manager Fri, 06 Mar 2015 05:37:18 +0100 x2goserver (4.0.1.19-0x2go1) unstable; urgency=medium [ Mike Gabriel ] * New upstream version (4.0.1.19): - Use File::Which to detect if sshfs command is available before trying to mount a client-side folder. - Be a bit more tolerant when trying to detect if a desktop icon is to be removed (using regexp, not eq). - Xsession script: Prevent bash failures when sourcing external bash scripts beyond our scope. (Fixes: #632, #675). - x2gogetapps: Support scanning of sub-directories when searching for .desktop files. We allow to dive down one level into subdirs, we on purpose do not recursively dive into the complete subtree. (Fixes: #633). - Make man2html an optional tool. Don't fail if it is missing on the build system (required for openSUSE/SLES builds). - Fix x2goserver-xsession/Makefile on SUSE. Detect SUSE distro and create Xsession related directory symlinks (xinitrc.d and Xclients.d). - Hack for x2goserver-xsession/Makefile during SUSE builds. If directoy /usr/share/doc/packages/brp-check-suse is present, the build env is also considered to be a SUSE system. - Trigger Xsession code for SUSE systems (look for /etc/SUSE-brand or /etc/SuSE-release for SUSE system recognition). (Fixes: #671). - x2gosqlitewrapper.c: Fix rpmlint error: no-return-in-nonvoid-function. Return the exitcode of execve(). - Fix gramma in error message (in x2goresume-session). - x2gocleansessions: Call x2gormforward also on terminated sessions. This will make sure that re-assigned ports are really available on new session startup. - x2golistsessions(_root): Only update session state in session DB if x2goagent's state file really exists. This addresses a problem that occurs when x2golistsessions gets called via an x2gobroker-agent. The x2golistsessions script may show session states (--all-servers) of sessions on other servers that have session states files on their remote /tmp dirs. These files are not accessible for that x2golistsessions script and should simply be ignored. (Fixes: #638). - Provide pam_namespace support for has_agent_state_file() function. - Fix missing session list output if state file does not exist on the machine that runs x2golistsessions(_root). - Accept more verbose "DENY" output from x2godesktopsharing. - Make sure that all "su"-to-user-contexts use /bin/sh for wrapping around the executed command (in x2gocleansessions and x2golistsessions_root). - Also enforce /bin/sh as shell in su command in x2goprint. - README.i18n: Add file that explains the translation workflow for this package. Thanks to Mark Pedersen-Cook for drafting this file. - Make SSH agent forwarding work after having reconnected via SSH and having resumed a session. (Fixes: #672). Thanks to Robert Siemer for coming up with that idea. - Fix cross-user X2Go Desktop Sharing after being broken by implementing clipboard mode feature (and probably other code changes). - Document session startup / resumption failures (and their reasons) in server-side log output. - Handle AD domain users gracefully when X2Go is used with SQLite DB backend. (Fixes: #664). - Improve sanitizer, use 'x2gosid' sanitizer for session IDs everywhere. Drop unused 'pnixusername' sanitizer in 4.0.1.x release of X2Go Server. - Allow usernames in session IDs of length 48 chars. - Start sshfs with a timeout of 30 seconds (because it never finishes if something is wrong with the client-side TCP socket). Also remove/unmount mountpoints erroneously registered sshfs mountpoints if sshfs command times out. Furthermore, print errors to STDERR (not STDOUT). (Fixes: #405). - Handle execution of ss command from Perl script x2golistdesktops in a way that not only works on Debian, but also on Fedora et al. (Fixes: #727). - Provide legacy support for old File::Path packages in x2godbadmin. (Fixes: #715). - Fix wrong evocation of x2gosyslog ("error" -> "err"). - Use "undef $dbh" instead of "$dbh->disconnect()". Fixes SQLite3 issues on SLE 11.x. - Only call $dbh->sqlite_busy_timeout() if the $dbh object is capable of that. Works around a too-old DBD::SQLite package on SLE 11.x. - Legacy for applications (and X2Go scripts) that expect $SSH_CLIENT to be set in the X2Go session's environment. (Fixes: #644). - Add man page for x2gogetapps. Weave into that a security / disclaimer message as proposed by Stefan Baur. (Fixes: #728). * debian/control: + Add D (x2goserver): libfile-which-perl. + Add C (x2goserver: x2godesktopsharing (<< 3.1.1.2-0~). (Fixes: #700). + Bump Standards: to 3.9.6. No changes needed. + Don't depend on libdb-pg-perl for armhf builds. (Fixes: #712). Thanks to Heinrich Schuchardt for providing information on this. + Upgrade to D again (bin:package x2goserver): xfonts-base (Fixes: #770). * debian/x2goserver.docs: + Install README.i18n file into bin:package x2goserver. * x2goserver.spec: + Add to R: perl(File::Which). + Additionally adapt to building on openSUSE/SLES. + No shell expansion possible in obs-build, detect perl version only for non-SUSE builds. + Add to R: x2goserver-xsession. + Don't mention /etc/x2go/x2gosql/sql twice (directly and with wildcard). + No %{_sysconfdir}/x2go/Xclients.d on SUSE systems. + Use %{_localstatedir} instead of %{_sharedstatedir}. + Use proper if... then... clauses. + For SUSE builds: Add to R: shadow (useradd, groupadd). + Replace historical "egrep" with "grep -E". + Systemd support for SUSE >= 12.10. + Set %defattr macro for every bin:package. + SUSE and Fedora/RHEL have different package group names. + Add x2goserver-rpmlintrc file to handle some rpmlint errors and warnings. + SUSE has openssh, but no openssh-server. + Add to R (x2goserver): perl-X2Go-Server. + Add to R (diverse): perl(Config::Simple), perl(Switch) and perl(Capture::Tiny). + Add to R (x2goserver): perl(File::BaseDir). + Don't hard-code /var/lib/ in $HOME path of to-be-created user "x2gouser". + Add to BR: findutils. + For Fedora-like systems, don't make x2goserver bin:package authoritative for non-X2Go directories. (Fixes: #676). + Remove macro call %systemd_pre for Fedora/EPEL-7 builds. No such macro in Fedora/RHEL7. (Fixes: 698). + Create system user x2gouser with $HOME in /var/lib/x2go. (Fixes: #697). + Always set BuildRoot: parameter. + BuildRequires: SUSE <= 11.3 has xorg-x11, not xinit. + Requires (x2goserver-xsession): SUSE <= 11.3 has xorg-x11, not xinit. + No Bashisms in scriptlets. + rpmlint requires shared-mime-info at build time on SLE <= 11.3. + "%set_permissions" / "%verify_permissions" macros are not know in SLE <= 11.3. Using "%run permissions" and "%verify permissions" instead. + On SUSE, add permissions.d/x2goserver. + Fix SQLite wrapper permissions (02775 -> 02755) + Use if then clauses for creating user/group x2goprint. [ Matthew L. Dailey ] * New upstream version (4.0.1.19): - x2gocleansessions: Redirect stdin, stdout and stderr to /dev/null, test for the existence of the file descriptor before issuing the close, only capture the file descriptor backreference in the regex and send any close failures to syslog. (Fixes: #678). [ Lars Wendler ] * New upstream version (4.0.1.19): - Use "printf" instead of "echo -n". (Fixes: #668). -- X2Go Release Manager Tue, 24 Feb 2015 21:49:22 +0100 x2goserver (4.0.1.18-0x2go1) unstable; urgency=medium [ Horst Schirmeier ] * New upstream release (4.0.1.18): - Remove stale X11 lock files in cases where x2goagent mysteriously disappeared (e.g., due to kill -9 or a crash). (Fixes: #630). -- Mike Gabriel Mon, 06 Oct 2014 22:27:42 +0200 x2goserver (4.0.1.17-0x2go1) unstable; urgency=medium * New upstream release (4.0.1.17): - Fix breakage of X2Go Server when upgrading from 4.0.1.15 while sessions are still in running / suspended state. (Fixes: #623). - Handle stale X11 socket files in cases where x2goagent has mysteriously disappeared (e.g. kill -9). (Fixes: #626). - Make sure that incompletely started up sessions get wiped from the session DB after 10 seconds. - Fix unreliable removal of client-side folder sharing desktop icons. - Update date in several man pages. * debian/control: + Upgrade x2goserver-xsession from Suggests: to Recommends:. -- Mike Gabriel Fri, 03 Oct 2014 17:09:23 +0200 x2goserver (4.0.1.16-0x2go1) unstable; urgency=low [ Mike DePaulo ] * New upstream release (4.0.1.16): - Make X2Go Server aware of the Openbox desktop environment (Command: OPENBOX) (Fixes: #605) - Make X2Go Server aware of the IceWM desktop environment (Command: ICEWM) (Fixes: #606) - Support GNOME Flashback session (GNOME 3.8+) on distro releases such as Ubuntu 13.10+ and debian Jessie (NOTE: For most users, GNOME Flashback currently will not work. This requires that gnome-flashback.session actually be installed. Not every Linux distro has it available. It also requires that the gnome-session binary not require hardware 3D acceleration for said session. Currently, upstream GNOME and GNOME 3.8+ in all Linux distros do require this, only 3rd party builds do not. See X2Go bug #599 for example.) (Thanks Eugene San (eugenesan@gmail.com)) - Fix launching GNOME 3 Fallback session (GNOME 3.4 & 3.6) on distros other than Ubuntu and Debian (Fixes: #599) - Fix support for Cinnamon 1.4 (Linux Mint 13) (Fixes: #569) - Fix the logic for launching Cinnamon 2.0 and 2.2 (Linux Mint 17). (Fixes: #572) NOTE: Fixing this bug in x2goserver is not sufficient to make Cinnamon 2.0 & 2.2 to work properly with X2Go. Bug #150 in nx-libs is still a problem. Fixing this bug enables Cinnamon 2.0 and 2.2 to launch to their "fallback mode", which has many bugs and missing features when compared to "software rendering" mode (cinnamon2d), but is still better than nothing. * debian/rules: + Improve dh_auto_clean override. [ Mike Gabriel ] * New upstream version (4.0.1.16): - Let x2goversion exit with an error if the X2Go component cannot be found. - Detect terminated sessions from NX log file. Also interpret a session as terminated if terminating just has started. - Detect started/starting/resumed/resuming sessions by explicitly scanning the NX session log file for those keywords. - Interpret NX sessions marked as "aborting session" as (not yet) terminated sessions. - Provide config option for server-side/global clipboard behaviour in x2goagent.options. (Fixes: #506). - Be aware of poly-instantiated /tmp directories bind-mounted under /tmp-inst. (Fixes: #406). - On suspend: Call x2goumount-session before sending SIGHUP to x2goagent. - Refuse client communcation if server-side hostname is not set up correctly (Fixes: #468). - Fix string comparison in x2goumount-session. - Fix problems with unmounting shared folders on session suspension/ termination. Remove extra parentheses from the fusermount execution call. (Fixes: #407). - Use type -p instead of which in x2goumount-session. Suppress output to stdout properly. - Use if--then--else--fi during x2goagent resuming in x2goresume-session script. - More reliably sync the NX session state with the status information in the X2Go session DB. - x2golistdesktops: Also detect sharable desktop sessions behind abstract kernel namespace sockets. - Add logcheck rules for X2Go Server. Thanks to Frank Werner for sending them in. - Correctly use diversions from stderr to stdout in shell commands. (Fixes: #520). - Don't die if no session state file is found, as it will break X2Go completely after upgrading from versions << 4.0.1.16 if sessions are still running/suspended during package upgrade. - Provide support for client-side choice of clipboard security. (Fixes: #524). - Use more quotes in x2goruncommand. - Detect the exit of rootless applications that forked to background on application execution. (Fixes: #122). - Make x2goruncommand more robust. - Don't fail Xsession startup if any of the profile scripts returns with an error. - Silently timeout in x2golistdesktops if calls to x2golistsessions and/or xwininfo don't produce output within one second. (Fixes: #543). - Allow email addresses as login usernames. (Fixes: #573). - Abort session startup if env var $USER or $SSH_CLIENT are not set. (Fixes: #558). - Allow length of username up to 48 characters (was: 32 characters). (Fixes: #574). - Abort session if env var $HOME is not set or if $HOME contains non-ASCII characters. (Fixes: #397). - Export XAUTHORITY env var in x2goruncommand to enable privilege upgrade for applications started via pkexec. (Fixes: #458). - x2gocleansessions: Don't print to stderr if the session state file cannot be found. This can happen during session startups. Report to system log instead. - Don't use Perl package File::ReadBackwards anymore. - Fix x2gormforward for 4.0.1.x release series (the X2Go::Log Perl module only exists in X2Go Server >= 4.1.0.0, the 4.0.1.x release series has to use x2gologlevel.pm in `x2gopath lib`. (Fixes: #617). - Pick x2gogetagentstate from 4.1.0.0 release series and adapt to usage with X2Go Server 4.0.1.x. (Fixes: #619). * debian/control, x2goserver.spec: + Update versioned D: x2goagent (>= 3.5.0.25). This assures that X2Go works with poly-instantiated /tmp directories. + Make sure x2gogetagentstate gets packaged in bin:package x2goserver. + Bump Standards: to 3.9.5. No changes needed. + Mark x2goserver-pyhoca bin:package as deprecated. + Drop D (x2goserver): libfile-readbackwards-perl. * x2goserver.spec: + Install {libdir}/x2go/x2gormforward into bin:package x2goserver. + Drop R (x2goserver): perl(File::ReadBackwards). [ Oleksandr Shneyder ] * New upstream version (4.0.1.16): - x2gostartagent, x2golistsession, x2gosuspend-session and x2goresume-session getting agent state from ~/.x2go/C-$SID/state. This should help to avoid session damage. Remove nxcleanup. (Fixes: #302, #511). - Move session file to /tmp/.x2go-$USER. (Fixes: #523). - Fix x2gostartagent failures if kbd is not "auto". Remove comma at end of options file. - Set default value for clipboard to "both" in x2gostartagent and x2goresume-session. - Clean user SSHD process if connection between server and client lost. This should fix error "Global request tcpip-forward failed". (Fixes: #495, #547). [ Orion Paplowski ] * x2goserver.spec: + Sync Fedora .spec file with our upstream-provided x2goserver.spec. -- Mike Gabriel Fri, 26 Sep 2014 00:36:32 +0200 x2goserver (4.0.1.15-0x2go1) unstable; urgency=low * New upstream release (4.0.1.15): + Fix hanging of x2goserver init script. Cherry-pick a322d8c from master branch. (Fixes: #471). + Add COPYING (GPL-2) file to base project folder. -- Mike Gabriel Thu, 03 Apr 2014 11:35:50 +0200 x2goserver (4.0.1.14-0x2go1) unstable; urgency=low [ Mike Gabriel ] * New upstream release (4.0.1.14): - Log SSHFS output and errors to ~/.x2go/C-/sshfs-mounts.log. (Fixes: #415). - If x2golistmounts is used without cmd option , then the env var $X2GO_SESSION (current session) will be attempted to use. - If x2goumount-session is used without cmd option , then the env var $X2GO_SESSION (current session) will be attempted to use. - Fix x2gostartagent. Make sure the -nolisten tcp option is configurable via x2goagent.options. (Fixes: #424). - Safely remove desktop files for client-side shared folders. Remove the correct desktop file, even if the shared folder has already been (forcefully) umounted. Such situations occur in cases where the connection gets interrupted. SSHFS will then get removed by the Linux kernel and we have to "guess" what desktop icons is actually to be removed. - Fix broken file descriptor closures in x2gocleansessions. (Fixes: #441). - Provide proper Gentoo support in x2goserver-xsession portion of X2Go Server. (Fixes: #445). - x2gofm.desktop: Drop obsolete Encoding key from .desktop file. - Fix typos / hyphen-as-minus signs issues in x2goversion.8 and x2gomountdirs.8. * x2goserver.spec: - Let builds for EPEL-7 behave like recent Fedora builds. - Spcial handling of x2gofm.desktop. In EPEL-5 the Encoding key is still required for .desktop files. * debian/*.doc-base: + Provide *.doc-base files for bin:packages containing HTML man pages or other documentation. * debian/x2goserver.init: + Add status option for init script (test if x2gocleansessions is running or not). + Add Description key to LSB header. * debian/config: + Explicitly call set -e. Makes lintian happier. * debian/rules: + Detect Git-created ChangeLog file if present (created by X2Go upstream's build scripts during package build). [ Harald Nordgard-Hansen ] * New upstream release (4.0.1.14): - Correctly quote the tests against $DISTRIB_RELEASE in x2goruncommand that were badly quoted (which caused them to report the wrong result and to create a file called "=" in the user home directory). Aligning all tests to use the same style of quoting fixes this. (Fixes: #409). [ Orion Poplawski ] * New upstream release (4.0.1.14): - Fix wrong path to xinitrd.d in Xsession (section for RPM based distros). Also, add some existence/readability checking. (Fixes: #414). - Fix the x2goserver.service unit file. Allow systemd to track the service after startup. (Fixes: #428). -- Mike Gabriel Wed, 02 Apr 2014 14:32:39 +0200 x2goserver (4.0.1.13-0x2go1) unstable; urgency=low * New upstream version (4.0.1.13): - Include all achievements from LTS release branch (as of version 4.0.0.11). -- Mike Gabriel Mon, 20 Jan 2014 14:04:01 +0100 x2goserver (4.0.1.12-0x2go2) unstable; urgency=low * Build hotfix for RPM packages (x2goserver.spec): + Add perl(Capture::Tiny) to Requires: field of x2goserver. -- Mike Gabriel Tue, 07 Jan 2014 18:36:38 +0100 x2goserver (4.0.1.12-0x2go1) unstable; urgency=low * Hotfix release including changes from LTS release version 4.0.0.10 (see below). -- Mike Gabriel Tue, 07 Jan 2014 18:26:28 +0100 x2goserver (4.0.1.11-0x2go1) unstable; urgency=low * New upstream version (4.0.1.11): - Fix x2gofm.desktop syntax. (Fixes: #391). - Include all achievements from LTS release branch (as of version 4.0.0.9). * x2goserver.spec: - Enhance requirement of desktop-file-utils, validate x2gofm.desktop during package build. -- Mike Gabriel Mon, 06 Jan 2014 18:24:49 +0100 x2goserver (4.0.1.10-0x2go1) unstable; urgency=low * New upstream version (4.0.1.10): - Fix x2goresume-session. The several parameters placed into the NX options file are expected by x2goresume-session at very specific positions. This we broke by trying to fix the fullscreen/geometry issue in x2gostartagent. Thanks to Harvey Eneman for tracking this down!!! (Fixes: #353, #355). - x2goserver-fmbindings/Makefile: install x2gofm. - x2goserver-fmbindings/Makefile: install share/applications and share/mime. - x2goserver-printing/Makefile: create feature.d directory before installing files into it. - Handle TCP listening of x2goagent in x2goagent.options. (Fixes: #354). - Clean up Makefiles, remove commented out lines. - Use xkb ruleset 'base' rather than xfree86 as on RHEL systems the xfree86 symlink to base ruleset does not exist. - Grab systemd service file from Fedora and ship it upstream. - Provide RHEL/Fedora support in x2goserver-xsession. - Only sanity check for existence of /etc/x2go/Xsession.d on Debian (derived) systems. - Provide man page for x2goserver.conf. * x2goserver.spec: + Ship x2goserver.spec (RPM package definitions) in upstream project. (Thanks to the Fedora package maintainers). File differs from the Fedora file already. + Add init script for RPM based distro. Taken from the Fedora package. + Clear (Fedora package) changelog. -- Mike Gabriel Fri, 03 Jan 2014 11:34:36 +0100 x2goserver (4.0.1.9-0x2go1) unstable; urgency=low * Silent bugfix release (4.0.1.9): - Incorporate changes from LTS release 4.0.0.7. No other changes performed on this release branch. (Fixes: #348). -- Mike Gabriel Thu, 28 Nov 2013 16:06:44 +0100 x2goserver (4.0.1.8-0~x2go1) unstable; urgency=low * New upstream version (4.0.1.8): - Fix resizing when resuming sessions. -- Mike Gabriel Fri, 22 Nov 2013 22:14:50 +0100 x2goserver (4.0.1.7-0~x2go1) unstable; urgency=low [ Orion Poplawski ] * New upstream version (4.0.1.7): - Install Xsession file as executable, make Xsession.d directory location configurable during build process, do not create unused Xsession.options. (Fixes: #278). [ Mike Gabriel ] * New upstream version (4.0.1.7): - Fine-tune x2goserver-xsession/Makefile: if /etc/X11 has Xsession.d and/or Xsession.options they get symlinked into /etc/x2go. Otherwise Xsession.d and Xsession.options are created under /etc/x2go as empty dir/file. (Fixes: #278). - Fix automatic keyboard setup (via x2gosetkeyboard) while resuming a session. (Fixes: #285). - Provide sudoers.d/x2goserver file that allows sudoed commands under KDE (by pertaining the env var QT_GRAPHICSSYSTEM. (Fixes: #276). - With PostgreSQL as session db backend, prevent the root user from launching sessions. Also, prevent x2gouser_root from being added as a PostgreSQL user. (Fixes: #310). - Execute DB status changes as late as possible during suspend / terminate. - Start/resume rootless sessions without geometry parameter. Esp. using X2GO_GEOMETRY=fullscreen for rootless sessions lead to an extra 1x1 px session window (nxagentCreateIconWindow in nxagent's Window.c). - Typo fix in x2goruncommand (for MATE session startup). * debian/control: + Update LONG_DESCRIPTIONS. + Raise Standards: to 3.9.4 (no changes needed). + Move xfonts-base to Recommends: field of bin:package x2goserver. * debian/x2goserver.init: + Make init script LSB compliant. [ Helmer Teles ] * New upstream version (4.0.1.7): - Make umask that is used when mounting client-side folders via SSHFS configurable in x2goserver.conf. (Fixes: #331). [ Jürgen Hötzel ] * New upstream version (4.0.1.7): - Use bash-builtin 'type' instead of to be avoided 'which'. (Fixes: #305). [ Oleksandr Shneyder ] * New upstream version (4.0.1.7): - Fix x2goruncommand: "type -P $cmd" can create new lines in EXEC variable if command have the arguments wich have same names as existing commands, for example "rdesktop -k nl" -> "/usr/bin/rdesktop\n/usr/bin/nl". Now we splitting $cmd and taking only first part. -- Mike Gabriel Fri, 22 Nov 2013 21:58:27 +0100 x2goserver (4.0.1.6-0~x2go1) unstable; urgency=low * New upstream version (4.0.1.6): - Fix client-side unmounting of shared folders. -- Mike Gabriel Sun, 28 Jul 2013 13:37:12 +0200 x2goserver (4.0.1.5-0~x2go1) unstable; urgency=low * New upstream version (4.0.1.5): - Do not hard-code paths to NX code in x2goruncommand anymore. Use x2gopath instead. (Fixes: #273). -- Mike Gabriel Sun, 28 Jul 2013 02:06:47 +0200 x2goserver (4.0.1.4-0~x2go1) unstable; urgency=low [ Mike Gabriel ] * New upstream version (4.0.1.4): - Multiply query USED_DISPLAYS and USED_PORTS in x2gostartagent to minimize race conditions in cases where many clients launch session simultaneously. - Make X2Go Server aware of the MATE desktop environment. - x2goumount-session: allow args $X2GO_SESSION in addition to $X2GO_SESSION . [ Rok Mandeljc ] * New upstream version (4.0.1.4): - The gnome-terminal TERMINAL returns immediately and runs in background starting with GNOME 3.8. Thus, set IMEXIT to false for gnome-terminal. (Fixes: #268). -- Mike Gabriel Sat, 27 Jul 2013 00:08:15 +0200 x2goserver (4.0.1.3-0~x2go1) unstable; urgency=low * New upstream version (4.0.1.3): - Improve session status management in x2gocleansessions. -- Mike Gabriel Sat, 22 Jun 2013 14:32:41 +0200 x2goserver (4.0.1.2-0~x2go1) unstable; urgency=low * New upstream version (4.0.1.2): - Accelerate resuming of sessions. Fix failures when resuming sessions that result from the latest changes in x2gocleansessions. (Fixes: #247). -- Mike Gabriel Sat, 22 Jun 2013 11:48:09 +0200 x2goserver (4.0.1.1-0~x2go1) unstable; urgency=low * New upstream version (4.0.1.1): - Syntax fix in x2goumount-session. -- Mike Gabriel Thu, 13 Jun 2013 13:12:54 +0200 x2goserver (4.0.1.0-0~x2go1) unstable; urgency=low * New upstream version (4.0.1.0): - Make x2gomountdirs / x2goumount-session UNC path aware. - Add support to x2gocleansessions to suspend session via state changes in the session DB. - Add support for terminating sessions via the session DB. - Raise the frequency of the x2gocleansessions loop to every two seconds. - Send SIGKILL to blocked X-Server (x2goagent) processes, if they do not disappear within 20secs. (Fixes: #32). -- Mike Gabriel Fri, 07 Jun 2013 23:07:40 +0200 x2goserver (4.0.0.12-0x2go1) UNRELEASED; urgency=low [ Mike Gabriel ] * Adopt this patch from stable release branch and apply to LTS branch: - Start/resume rootless sessions without geometry parameter. Esp. using X2GO_GEOMETRY=fullscreen for rootless sessions lead to an extra 1x1 px session window (nxagentCreateIconWindow in nxagent's Window.c). - Fix x2goresume-session. The several parameters placed into the NX options file are expected by x2goresume-session at very specific positions. This we broke by trying to fix the fullscreen/geometry issue in x2gostartagent. Thanks to Harvey Eneman for tracking this down!!! - Detect suspended sessions from NX log file. Also interpret a session as suspended if suspending just has started. - Interpret NX display failures as (about to be) suspended sessions. [ Oleksandr Shneyder ] * New upstream version (4.0.0.12): - Fix datetime output format in x2godbwrapper.pm. -- Mike Gabriel Fri, 21 Feb 2014 14:25:43 +0100 x2goserver (4.0.0.11-0x2go1) unstable; urgency=low * New upstream version (4.0.0.11): - Use perl instead of sed for search+replace in session names sanitizing. (Fixes: #404). -- Mike Gabriel Mon, 20 Jan 2014 14:00:42 +0100 x2goserver (4.0.0.10-0x2go1) unstable; urgency=low * New upstream version (4.0.0.10): - Add forgotten import of Perl package Capture::Tiny in x2goutils.pm. * debian/control: - Depend on libcapture-tiny-perl. -- Mike Gabriel Tue, 07 Jan 2014 18:05:28 +0100 x2goserver (4.0.0.9-0x2go1) unstable; urgency=low * New upstream version (4.0.0.9): - Sanitize session name in x2gostartagent, as well. Fixes problems with custom session commands containing characters that get sanitized out. - Allow dots (".") in sanitized session names. -- Mike Gabriel Mon, 06 Jan 2014 18:21:36 +0100 x2goserver (4.0.0.8-0x2go1) unstable; urgency=low * New upstream version (4.0.0.8): - Use mktemp instead of tempfile (because Fedora does not have the tempfile binary). (Fixes: #347). - Replace makepasswd by pwgen (because Fedora does not have makepasswd). - Improve parsing of the NX session.log file where unexpected extra logging takes place during session suspension/resumption. Thanks to Gerald Richter for finding this!!! (Fixes: #356). - Avoid one argument system calls and backticks in x2gocleansessions and x2golistsessions_root. - Avoid one argument system calls and backticks in x2golistsessions. - Avoid one argument system calls and backticks in x2goprint. - Avoid backticks in x2goshowblocks, move script to /sbin/ as it is for being run with root privileges. - Sanitize session ID string, port numbers, display numbers and agent PID numbers before writing them as strings to the session DB. -- Mike Gabriel Fri, 03 Jan 2014 11:30:54 +0100 x2goserver (4.0.0.7-0x2go1) unstable; urgency=low * New bugfix upstream version (4.0.0.7): - Revert keyboard workaround for Mac OS X, as it causes other issues. (Fixes: #348). * debian/source/format: + Switch to format 1.0. -- Mike Gabriel Thu, 28 Nov 2013 16:00:37 +0100 x2goserver (4.0.0.6-0~x2go1) unstable; urgency=low * New upstream version (4.0.0.6): - Work around buggy X2Go Client on Mac OS. If the keyboard type is set to "query", we force X2GO_SET_KBD to 1. (Partly resolves: #112). -- Mike Gabriel Fri, 22 Nov 2013 21:56:44 +0100 x2goserver (4.0.0.5-0~x2go1) unstable; urgency=low * New upstream version (4.0.0.5): - Make x2goumount-session tolerant towards usernames that contain spaces (Fixes: #202). -- Mike Gabriel Sun, 28 Jul 2013 01:47:03 +0200 x2goserver (4.0.0.4-0~x2go1) unstable; urgency=low [ Jan Engelhardt ] * New upstream version (4.0.0.4): - Fix Perl include path for X2Go related Perl packages (which do not get installed to some system default path for this version of x2goserver). -- Mike Gabriel Thu, 13 Jun 2013 13:10:28 +0200 x2goserver (4.0.0.3-0~x2go1) unstable; urgency=low * New upstream version (4.0.0.3): - Make pre-set DESTDIR and PREFIX traverse through all Makefiles. Do not include DESTDIR in Makefile-hard-coded path in x2gosqlitewrapper. - Partially revert USED_PORTS detection code back to the old-style awk-way. (Fixes: #155). -- Mike Gabriel Fri, 07 Jun 2013 23:03:20 +0200 x2goserver (4.0.0.2-0~x2go1) unstable; urgency=low [ Matthew L. Dailey ] * New upstream version (4.0.0.2): - Do parse profile/xprofile files in X2Go's Xsession file. (Fixes: #149). [ Jan Engelhardt ] * New upstream version (4.0.0.2): - Use x2gopath in Perl scripts to set the lib path. (Fixes: #103). [ Mike Gabriel ] * New upstream version (4.0.0.2): - Use make_path from File::Path in x2godbadmin to create user directory if not present. (Fixes: #200). - Security fix for setgid wrapper x2gosqlitewrapper.c. Hard-code path to x2gosqlitewrapper.pl during build via defining a macro in the Makefile. Thanks to Richard Weinberger for spotting this!!! /debian/control: + Let x2goserver bin:package depend on xfonts-base and fontconfig. (Fixes: #163). + Create session log symlink after launching x2goagent. Fix order of target and symlink name when executing the command. -- Mike Gabriel Sun, 19 May 2013 00:54:34 +0200 x2goserver (4.0.0.1-0~x2go1) unstable; urgency=low [ Bernard Cafarelli ] * New upstream version (4.0.0.1): - Make CFLAGS usable in x2goserver. (Fixes: #83). [ Matthew L. Dailey ] * New upstream version (4.0.0.1): - Fix command/version detection for GNOME/Unity on Ubuntu. (Fixes: #105). [ Mike Gabriel ] * New upstream version (4.0.0.1): - Allow for deploying X2Go Published Applications system-wide on a per-user basis (in /etc/x2go/applications-per-user/). -- Mike Gabriel Fri, 22 Mar 2013 13:52:43 +0100 x2goserver (4.0.0.0-0~x2go1) unstable; urgency=low [ Jan Engelhardt ] * New upstream version (4.0.0.0): - Replace script x2gobasepath by script x2gopath that makes it much easier for distro packagers to tweak the installation paths of X2Go Server components. [ Mike Gabriel ] * Bump version to 4.0.0.0 (for Baikal bundle release). * New upstream version (4.0.0.0): - Adapt Xinerama path in x2gopath: use $base for detecting the path to the Xinerama libs, as well, as is done with all the other paths. - Fix mounting of multiple paths, thanks to Pascal Vibet. (Fixes: #67). [ Orion Poplawski ] * New upstream version (4.0.0.0): - Honour CFLAGS when compiling the server's sgid wrapper script (Fixes: #83). [ Oleksandr Shneyder ] * New upstream version (4.0.0.0): - Fix SSHFS mounting from Ubuntu clients. - Create /tmp/.X11-unix if not exists. (Fixes: #93). [ Reinhard Tartler ] * New upstream version (4.0.0.0): - Introduce /etc/x2go/x2goagent.options to allow overriding x2goagent options. This new configuration file specifies default options that clients can override. - Disable XFIXES and GLX. Both are known to cause certain problems. Hopefully we find better solutions so that we can reenable them soon. -- Mike Gabriel Sun, 30 Dec 2012 17:39:44 +0100 x2goserver (3.1.1.9-0~x2go1) unstable; urgency=low * New bugfix release (3.1.1.9): - Fix x2godesktopsharing, we had added to many quotation marks in x2gostartagent. -- Mike Gabriel Fri, 23 Nov 2012 15:32:11 +0100 x2goserver (3.1.1.8-0~x2go1) unstable; urgency=low * New bugfix release (3.1.1.8): - Fix startup of GNOME and UNITY sessions (issue introduced with 3.1.1.7). -- Mike Gabriel Fri, 23 Nov 2012 12:01:01 +0100 x2goserver (3.1.1.7-0~x2go1) unstable; urgency=low * New upstream+bugfix release (3.1.1.7): - Use DISTRIB_RELEASE to query Ubuntu release versions and detect Unity launch command. - Detect GNOME and UNITY startup commands via DISTRIB_RELEASE version number and by using the bc command for comparing versions. - Do not fail if source_environment() cannot find the file to be sourced. -- Mike Gabriel Thu, 22 Nov 2012 18:11:15 +0100 x2goserver (3.1.1.6-0~x2go1) unstable; urgency=low * Bugfix release (3.1.1.6): - Fix for non-well-tested x2gomountdirs script. -- Mike Gabriel Wed, 07 Nov 2012 20:57:54 +0100 x2goserver (3.1.1.5-0~x2go1) unstable; urgency=low [ Stéphane Graber ] * New upstream version (3.1.1.5): - Add a very basic SIGCHLD handler to x2gocleansessions. on SIGCHLD let the script wait for cleaning up after its children. (Fixes: #38). [ Mike Gabriel ] * New upstream version (3.1.1.5): - Fix x2gogetapps when rendering multi-section .desktop files. (Fixes: #43). - Remove redundant setting of loglevel in x2gogetapps. - Fix ,,Only extend LD_LIBRARY_PATH by Xrandr extension for KDE. Breaks GNOME.'' from last release. - Detect i18n name of Desktop folder via XDG_DESKTOP_DIR environment variable. - Put option of database call in x2gogetagent into parantheses. * /debian/control: + Depend on libfile-basedir-perl. -- Mike Gabriel Wed, 07 Nov 2012 16:36:36 +0100 x2goserver (3.1.1.4-0~x2go1) unstable; urgency=low [ Jan Engelhardt ] * New upstream version (3.1.1.4): - Add -pie as linker flag. Fixes non-position-independent-executable (x2gosqlitewrapper.c). The executable is now completely position independent. [ Mike Gabriel ] * New upstream version (3.1.1.4): - Fix x2gosessionlimit script. - Wrap padsp around rdesktop calls if pulse is used as audio protocol. - Add option ,,-r sound:local'' to rdesktop calls if pulse is enabled. - Proxy X2Go client-side shares into remote desktop session. - For applications inside of a session, use NX's Xrandr library instead of Xorg's Xrandr library (partially fixes #28). - Make sure when launching desktop session through the Xsession mechanism that the LD_LIBRARY_PATH variable stays intact. (Fixes: #29). - Only extend LD_LIBRARY_PATH by Xrandr extension for KDE. Breaks GNOME. * /debian/control: + Maintainer change in package: X2Go Developers . + Depend on nx-libs (>=3.5.0.15-0~) which has the Xrandr symlinks folder. + Add rdesktop and pulseaudio-utils to Suggests. + Priority: optional. [ Oleksandr Shneyder ] * New upstream version (3.1.1.4): - Remove "-nolisten tcp" option with XDMCP sessions. -- Mike Gabriel Tue, 25 Sep 2012 13:15:11 +0200 x2goserver (3.1.1.3-0~x2go1) unstable; urgency=low [ Jan Engelhardt ] * New upstream version (3.1.1.3): - Do not block /etc/X11/Xresources with a directory (in Makefile). - Avoid using archaic tools during free port detection. - Avoid using ls in Makefiles. [ Mike Gabriel ] * New upstream version (3.1.1.3): - Fix broken X2Go client-side printing. Adapt x2goprint to new spool job directory. * /debian/x2goserver.init: + Orthography fix: X2Go instead of x2go. -- Mike Gabriel Tue, 03 Jul 2012 10:00:32 +0200 x2goserver (3.1.1.2-0~x2go1) unstable; urgency=low [ Mike Gabriel ] * New upstream version (3.1.1.2): - Place session.log into /tmp directory, make x2gocleansessions and x2golistsessions_root work even if home directories are mounted via NFSv4+Krb5 and not accessible by root. - Use -fPIE gcc (position independed executable) for building x2gosqlitewrapper.c (as suggested by Jan Engelhardt). - Clean up session.log tmp directory if empty. - Move all X2Go tmp folders (mount points) to /tmp/.x2go-. Make sure all tmp folders get removed if not used any more. Drop symlink ~/media if no client-side folders are mounted into a session. - Fix crashes of x2gocleansessions due to faulty syslog calls. - Drop redundant hostname calls in x2gocleansessions. - Launch x2goagent with $NX_TEMP=/tmp, otherwise it will fail to create the X11 Unix domain sockets. -- Mike Gabriel Fri, 29 Jun 2012 17:44:57 +0200 x2goserver (3.1.1.1-0~x2go1) unstable; urgency=low [ Mike Gabriel ] * New upstream version (3.1.1.1): - Add/fix Python X2Go folder sharing/unsharing support from Windows. - Handle whitespace in folder names appropriately. - Allow .desktop file parameter Terminal=... to pass through to X2Go client-side. - Avoid error messages in x2gocmdexistmessage if cmdoutput file could not be found. - Provide nx-X11 libraries for applications launched via x2goruncommand. - Add feature X2GO_SERVERSIDE_DESKTOPCOMMANDS. Let client provide a generic desktop shell command (GNOME, UNITRY, KDE, etc.) which then gets translated into an executable command by x2goruncommand. - Detect desktop session mode to use for Ubuntu precise and later. - Complete UNITY/GNOME support for Ubuntu/Debian. - Use ,,-nolisten tcp'' option when evoking x2goagent from within x2gostartagent. - Export NX_ROOT=$HOME/.x2go in x2gostartagent. Makes the keyboard file in X2Go session cache directory. - Add support for client-side keyboard detection. Moved script x2gosetkeyboard from x2goserver-pyhoca into x2goserver package. - Make x2gosetkeyboard set the client-side keyboard on session start and resume if usekbd is set to True and the keyboard type is set ,,auto''. - Reset keyboard settings to pc104/us before setting client-side keyboard parameters. - For finished sessions purge all mount points that still hover in the DB's mounts table. - Make sure we run fusermount from within a directory that the user has read access to. * Depend on x2goagent (>= 2:3.5.0.12), make sure that x2goagent has the patch 105_nxagent_export-remote-keyboard-config.full.patch included. -- Mike Gabriel Thu, 21 Jun 2012 14:16:08 +0200 x2goserver (3.1.1.0-0~x2go1) unstable; urgency=low [ Mike Gabriel ] * New upstream version (3.1.1.0): - Syslog warnings have to be named ,,warning'' not ,,warn''. - Add usage output to x2goserver-run-extensions. - Fix syslog output of x2goserver-run-exentions. - Fix x2goserver extension calls in x2goruncommand. - Add feature name ,,X2GO_PUBLISHED_APPLICATIONS''. - Add new command ,,x2gofeaturelist''. This command can be used by X2Go client applications to retrieve a list of server-side supported X2Go features. - Update date and version number in man pages. - Fix race condition between session.log of x2goagent and x2gocleansessions. The old situation was: in cases that x2goagent was not fast enough with appending the new session state to the session.log file, the x2gocleansessions script marked the session as suspended during the session resuming process. - Wait one second for x2goagent to write to session.log before updating the session state from 'S' to 'R' in the X2Go session database. - Add X2Go server script x2gogetstatus. - Add/enable debugging of x2gocleansessions. - Silence error messages if the agent's session.log file is not accessible (e.g. on NFSv4+Krb5-mounted homes). - Improve concurrent database access with session db backend SQLite. * Remove /etc/x2go/applications on package removal if it is a symlink, keep it, if it is a directory. Remove /etc/x2go (if empty after purge) on package purge. * Bump Debian packaging standards version to 3.9.3. * Use dh_link to symlink X11 directories into /etc/x2go. [ Oleksandr Shneyder ] * New upstream version (3.1.1.0): - Support for "published applications". Sponsored by Stefan Baur (http://www.baur-itcs.de). -- Mike Gabriel Wed, 04 Apr 2012 11:41:02 +0200 x2goserver (3.1.0.1-0~x2go1) unstable; urgency=low * New upstream version (3.1.0.1): - Provide infrastructure for on-logout script calls. - Do only run session cleanup scripts from within x2goruncommand. Dropping them from x2goterminate-session. - Be tolerant against x2go_logout script failures. - Fix Makefile of x2goserver-fmbindings (thanks to Oliver Burger), improve uninstall code in Makefiles. -- Mike Gabriel Wed, 07 Mar 2012 21:05:28 +0100 x2goserver (3.1.0.0-0~x2go1) unstable; urgency=low [ Oleksandr Shneyder ] * New upstream version (3.1.0.0): - remove ports used by X2Go session from database after session was finished if postgres backend is used. - before resuming X2Go session check if reserved ports still available in other case find new free ports, save them in database and send to x2goclient - run netstat -tl --all to find free ports for graphic, sound and sshfs tunnels in x2gostartagent and x2goresume-session [ Milan Knížek ] * New upstream version (3.1.0.0): - Fix removal of desktop link on x2goumount-session if local folder of a Windows client gets unmounted. - Remove redundant -S option from x2goagent start-up command line. - Use -f $XAUTHORITY with xauth calls. [ Sören Plönnigs ] * New upstream version (3.1.0.0): - Only run kdialog/zenity from x2goumount-session if either of them exists in the system's $PATH. [ Jan Engelhardt ] * New upstream version (3.1.0.0): - Use /cgi-bin/man/ path in web'ified man pages. - Use ,,${MAKE}'' instead of ,,make'' in Makefile. [ Mike Gabriel ] * New upstream version (3.1.0.0): - Provide new package x2goserver-fmbindings. Derived from a package draft provided by Milan Knížek (Thanks!). - Do not create desktop icons for rootless (i.e. non-desktop) sessions. - Allow other $XAUTHORITY values than the default ($HOME/.Xauthority). - For x2gomountdirs / x2goumount-session allow other TMP paths than /tmp. Use ENV{'TMP'} instead, unless it is empty. Then use /tmp. - Place quotations where appropriate into shell scripts. - Fix call to x2goterminate-desktopsharing in x2goruncommand. - Tolerate user names containing "-" characters (SQLite DB backend). - Make sure x2gocleansessions close _all_ open file handles after forking as a daemon. - Add copyright header for x2gofm script. - Add man page for x2gogetservers script. - Add man page for x2gofm wrapper script. - Update date and release version in man pages. * Let x2goserver package suggest x2goserver-fmbindings. * Add package upgrade warning for installation using PostgreSQL. The upgrade warning refers to README.upgrade-pgsql-database. * x2goserver-fmbindings does not have to depend on ${shlibs:Depends}. -- Mike Gabriel Wed, 22 Feb 2012 14:37:34 +0100 x2goserver (3.0.99.10-0~x2go1) unstable; urgency=low [ Mike Gabriel ] * New upstream version (3.0.99.10): - Replace all string ,,X2go.' with ,,X2Go''. - Use $(MAKE) -C calls to run Makefiles in subfolders. - Disable rastering in >= KDE4.8 and Qt4.8. * x2goserver.postinst script leaves the DB file alone if a DB backend different from SQLite is configured. Thanks to Jochen Schulz for bringing this into awareness. [ Jochen Schulz ] * New upstream version (3.0.99.10): - Escape DB user names in x2godbadmin. - Export KRB5CCNAME in x2goruncommand, make Kerberos ticket cache known inside X2Go sessions. [ Moritz Strübe ] * New upstream version (3.0.99.10): - Check whether the associated TCP/IP port is available before assigning a display number. * Add net-tools package as dependency. [ John Williams ] * New upstream version (3.0.99.10): - Fix xserver-xsession/Makefile: add missing $(DESTDIR) expressions. -- Mike Gabriel Wed, 01 Feb 2012 13:40:31 +0100 x2goserver (3.0.99.9-0~x2go1) unstable; urgency=low [ Mike Gabriel ] * New upstream version (3.0.99.9): - Fix for install stanzas in several Makefiles. - Give X2Go session windows a human readable title. - Desktop sharing: fix username of user who requests desktop sharing. - Fix x2gobasepath for Perl versions < 5.10.x. - Fix x2godbadmin for Perl versions < 5.10.x. - Remove x2gosetkeyboard from x2goserver-extensions package. - Re-add x2gosetkeyboard via new subproject x2goserver-pyhoca. - Call x2golistmounts with user privileges instead of using db_getmounts in x2goprint script. - Avoid potentially empty LD_LIBRARY_PATH path in x2goruncommand. - Install x2gogetservers to $PREFIX/bin instead of $PREFIX/lib/x2go. * Add psmisc package as dependency. * Add new binary package to x2goserver source: x2goserver-pyhoca. * x2goserver package suggests x2goserver-pyhoca. * Fix directory permissions of $HOME directory of x2goprint system user. [ Hayawardh Vijayakumar ] * New upstream version (3.0.99.9): - Fix potentially empty LD_LIBRARY_PATH in x2gostartagent. [ Oleksandr Shneyder ] * New upstream version (3.0.99.9): - Add Xinerama support. -- Mike Gabriel Wed, 18 Jan 2012 14:39:57 +0100 x2goserver (3.0.99.8-0~x2go1) unstable; urgency=low * New upstream version (3.0.99.8): - Fix feature list in x2goserver-extensions. - Add Xsession.d processing to X2Go (as x2goserver-xsession add-on package). - Ignore failures of x2gofeature calls, fixes x2goserver being installed without x2goserver-extensions. - Set X2Go log level to info when running Xsession parts. * Make sure that package scripts (postinst, postrm, etc.) exit with exit code 0 at the end of the script. * Fix non-local printing with X2Go: x2goprint user on X2Go server host needs a shell to accept incoming print jobs from the central CUPS server(s). -- Mike Gabriel Sun, 20 Nov 2011 18:54:26 +0100 x2goserver (3.0.99.7-0~x2go1) unstable; urgency=low * New upstream version (3.0.99.7): - Move x2golistmounts script from x2goserver-extensions to x2goserver core. - X2Go server extensions: fix regular expression when scanning modality dirs. -- Mike Gabriel Wed, 26 Oct 2011 13:04:54 +0200 x2goserver (3.0.99.6-0~x2go1) unstable; urgency=low [ Mike Gabriel ] * New upstream version (3.0.99.6): - Rename x2goumount_session calls to x2goumount-session calls in x2goserver internal scripts. - Re-arranged script files into /bin and /lib directories. - Tab'ified all script files, proper indentation, coding style. - Fix for x2gomountdirs, now also usernames containing blanks can use local folder sharing. - Provide C wrapper for setgid call of x2gosqlitewrapper.pl. Remove dependency from perlsuid. - Store SQLite db in /var/lib/x2go to comply to latest FHS. - Add x2gobasepath script to reliably detect x2goserver install path. - Add man page for x2gobasepath. - Remove Debianisms from INSTALL howto. - Add chromium-browser as possible WWWBROWSER to x2goruncommand. - Add lxterminal as possible TERMINAL to x2goruncommand. - Add LibreOffice.org as possible OFFICE application to x2goruncommand. - Fix for TERMINAL command execution if konsole (KDE4) is installed on the server. - Silence x2golistsessions on missing session.log files. - Add x2goprint user creation information to INSTALL howto. - Add sanity checks to x2goprint, script can only be run as root. - Fix x2goprint, add syslogging, add inline comments. - Add script lib/x2gologlevel: introduce [log] section in x2goserver.conf with only parameter ,,loglevel''. - Initialize Syslog module for all Perl scripts in x2goserver package. - Add debugging support for almost all DB functions in x2godbwrapper.pm, fix for Syslog module initialization in all Perl scripts. - Add info loglevel messages for all scripts in bin dir. - Add notice messages for start, suspend, resume, terminate, mountdirs actions. - Fix for x2godbwrapper.pm: we can't open/close the syslog socket in a package. This has to be done by the scripts that use x2godbwrapper.pm. - Add info loglevel messages for x2goserver-extensions scripts. - Use usermapping for SSHFS mount points. - Cleanup of man page area, thanks to Ivan Kabaivanov for pointing that out. - Rename example user and group for session limits in x2goserver.conf so that people do not get the idea to put users in x2gouser group. - Add real error message if client fails to resume/suspend/terminate a session. - Present an ISO-8601 compliant datetime string in session lists rendered by x2golistsessions (and similar) command(s). - Silence knotify SIGHUP signals in case that no knotify is running in the X2Go session. - Fix x2goumount-session for individual paths (folder type: disk), ToDo: folder type CDROM and removable media. - Let db_insertmount create a proper return value (success vs. failed). - If resuming or suspending of a session fails, mark the session as finished (because the session's x2goagent is very probably dead). Do not write an error to stderr if x2goterminate-session fails (i.e. if x2goagent is dead). - Identified x2goumount script (x2goserver-compat) as a necessary component of x2gognomebindings and moved it there (with new name: x2goumount-session-gnome). - Add x2golistmounts script to X2Go server extensions. - Add x2gofeature script and x2gofeature.d subscripts. - Add x2gofeature man page. - Move x2goversion script into x2goserver core. - Add debug output around shadow session startup (in x2gostartagent). - Pass extra argument $USER to client-mode x2godesktopsharing, requires x2godesktopsharing (>=3.0.1.3) for it to work. - Clean session dir ~/.x2go/C- after session terminates, if not running in debug mode. - Change of Desktop icons for shared folders. This change is needed for parallel installation of x2gognomebindings and x2golxdebindings. - Terminate x2godesktopsharing cleanly for current session on x2goterminate-session or when x2goruncommand is about to exit. - Resume/suspend x2godesktopsharing during x2goresume-session, x2gosuspend-session. - Provide pluggable X2Go extension system for main X2Go server functions. - Provide man page for x2goserver-run-extensions that explains the new plug-in mechanism of x2goserver. * React to Debian bug #627990, prefer man2html-base over man2html. * Do not depend on package perlsuid anymore. * Use source format 3.0 (native). * Fix of Debian clean rules, fix of Makefile's clean rules. * Breaks/replaces packages: x2goserver-one, x2goserver-home, x2goprint (instead ofB Conflicts). * Tab'ified postinst/postrm scripts. * Install internal x2goserver scripts to /usr/lib/x2go, make sure scripts in /usr/bin find these scripts. * x2goserver.postinst: fix home path updates if new home path already exists * Provide separate package x2goserver-printing: x2goprint script + man page + adduser x2goprint. [ Moritz Strübe ] * Improvements for new upstream version (3.0.99.6): - Make digits at the beginning of X2Go server extension scripts a must, not a suggestion. [ Ivan Kabaivanov ] * Improvements for new upstream version (3.0.99.6): - Many Makefile fixes around man page installation. - Proof-reading code, fixing typos. [ Martin Oehler ] * Fixes for new upstream version (3.0.99.6): - Removes old debug code fragment, fixes x2golistsessions parsing. [ Oleksandr Shneyder ] * Improvements for new upstream version (3.0.99.6): - Remove session directory after 10 sec delay to let x2goclient check cmdoutput file. -- Mike Gabriel Wed, 12 Oct 2011 11:44:59 +0200 x2goserver (3.0.99.5-0~x2go2) unstable; urgency=low * splitting up x2goserver package into x2goserver and x2goserver-extensions (x2goserver provides full functionality to legacy x2goclient, x2goserver-extensions is a container/namespace for add-on tools/scripts needed for other client implementations like Python X2Go. -- Mike Gabriel Tue, 31 May 2011 10:57:15 +0200 x2goserver (3.0.99.5-0~x2go1) unstable; urgency=low * adds x2goprint to x2goserver package * implements X2Go MIME Box feature * fixes installation conflicts with x2goserver-one, x2goserver-home and x2goprint * change of version numbering scheme * re-organization of folder structure * adds several man pages * adds x2goversion script -- Mike Gabriel Tue, 03 May 2011 10:42:02 +0200 x2goserver (3.0.99-5) unstable; urgency=low * fixed db_getserver -- Oleksandr Shneyder Wed, 30 Mar 2011 18:16:48 +0200 x2goserver (3.0.99-4) unstable; urgency=low * support for ssl connect (postgresql) -- Oleksandr Shneyder Wed, 16 Mar 2011 11:16:21 +0100 x2goserver (3.0.99-3) unstable; urgency=low * fixed wrong path to dbfile, thanks Moritz Struebe -- Oleksandr Shneyder Mon, 31 Jan 2011 18:38:13 +0100 x2goserver (3.0.99-2) unstable; urgency=low * menu=0 option in x2gostartagent, to avoid crash in single app mode -- Oleksandr Shneyder Thu, 27 Jan 2011 18:38:17 +0100 x2goserver (3.0.99-1) unstable; urgency=low * not use sudo with postgresql, wrappers in perl instead of bash * use unprivileged user x2gouser with sqlite -- Oleksandr Shneyder Tue, 25 Jan 2011 17:09:01 +0100 x2goserver (3.0.1-9) unstable; urgency=low * changes in x2gomountdir to use with plasmoid -- Oleksandr Shneyder Mon, 07 Jun 2010 18:51:50 +0200 x2goserver (3.0.1-8) unstable; urgency=low * changes in db warppers - do not show shadow sessions in listsessions and listsessions_all -- Oleksandr Shneyder Tue, 01 Jun 2010 19:08:53 +0200 x2goserver (3.0.1-7) unstable; urgency=low * support for fs encodings in x2gomountdirs -- Oleksandr Shneyder Thu, 06 May 2010 18:34:42 +0200 x2goserver (3.0.1-6) unstable; urgency=low * fixed access mode for key in x2gomountdirs * supoort for session sharing -- Oleksandr Shneyder Wed, 10 Feb 2010 10:52:34 +0100 x2goserver (3.0.1-5) unstable; urgency=high * force mcookie auth for x2goagent -- Oleksandr Shneyder Mon, 14 Dec 2009 20:58:42 +0100 x2goserver (3.0.1-4) unstable; urgency=low * Fix x2gosessionslimit -- Oleksandr Shneyder Thu, 02 Dec 2009 22:14:27 +0100 x2goserver (3.0.1-3) unstable; urgency=low * libconfig-simple-perl in dependency section -- Oleksandr Shneyder Thu, 02 Dec 2009 22:00:56 +0100 x2goserver (3.0.1-2) unstable; urgency=low * setting dpi for x2goagent in x2gostartagent * session limits for users and groups in /etc/x2go/x2goserver.conf * ssh option ServerAliveInterval=300 in x2gomountdirs -- Oleksandr Shneyder Mon, 02 Nov 2009 16:30:15 +0100 x2goserver (3.0.1-1) unstable; urgency=low * Support for sqlite * fixed problem with HOSTNAME variable in perl scripts when users shell is zsh. Thank Ralf Schulze -- Oleksandr Shneyder Thu, 16 Jul 2009 10:56:23 +0200 x2goserver (3.0.0-2) unstable; urgency=low * Support for rdesktop sessions * Transform xorg rules to evdev in x2goserver * Changes in keyboard settings -- Oleksandr Shneyder Fri, 10 Jul 2009 08:26:41 +0200 x2goserver (3.0.0-1) unstable; urgency=low * Printing support (need x2goprint and cups-x2go) * add group x2gousers and configure sudo in preinstall script -- Oleksandr Shneyder Wed, 04 Mar 2009 16:49:59 +0100 x2goserver (2.0.1-19) unstable; urgency=low * fixed installinit script break if x2goserver not running -- Oleksandr Shneyder Fri, 30 Jan 2009 08:38:03 +0100 x2goserver (2.0.1-18) unstable; urgency=low * fixed preinst script to work with ubuntu -- Oleksandr Shneyder Thu, 29 Jan 2009 10:09:25 +0100 x2goserver (2.0.1-17) unstable; urgency=low * changes in database (start x2gocreatebase.sh): * session_id - varchar(500) * column "fsport" for fs tunnel * changes in x2gostartagent: add fsport to session info * changes in x2gopgwrapper_(local/net): fsport in listsessions * changes in x2gomountdirs: mount using reverse ssh tun -- Oleksandr Shneyder Thu, 15 Jan 2009 17:25:54 +0100 x2goserver (2.0.1-16) unstable; urgency=low * added x2gosuspend-agent to suspend session on clicking "close" button on x2goagent -- Oleksandr Shneyder Mon, 03 Nov 2008 16:11:56 +0100 x2goserver (2.0.1-15) unstable; urgency=low * Fixed: run command with arguments * Error message if command not exists -- Oleksandr Shneyder Thu, 09 Oct 2008 15:42:29 +0000 x2goserver (2.0.1-14) unstable; urgency=low * added: list sessions from all servers -- Oleksandr Shneyder Wed, 08 Oct 2008 10:16:18 +0200 x2goserver (2.0.1-13) unstable; urgency=low * changes to enable "rootless" mode -- Oleksandr Shneyder Thu, 25 Sep 2008 17:33:18 +0200 x2goserver (2.0.1-12) unstable; urgency=low * changes in x2gomount/umount to use with gnome -- Oleksandr Shneyder Fri, 29 Aug 2008 11:18:43 +0200 x2goserver (2.0.1-11) unstable; urgency=low * now x2gomountdirs can mount dirs on client hosts with ssh ports other then 22 -- Oleksandr Shneyder Fri, 21 Sep 2007 12:12:34 +0200 x2goserver (2.0.1-10) unstable; urgency=low * x2gomountdirs fixed mounting directories with " " in path * changed /bin/sh to /bin/bash in scripts * x2gostartgent append color depth to session's name -- Oleksandr Shneyder Thu, 13 Sep 2007 14:01:17 +0200 x2goserver (2.0.1-9) unstable; urgency=low * esd support -- Oleksandr Shneyder Tue, 7 Aug 2007 15:31:51 +0200 x2goserver (2.0.1-8) unstable; urgency=low * changed architecture to "all" -- Oleksandr Shneyder Thu, 28 Jun 2007 10:11:10 +0200 x2goserver (2.0.1-7) unstable; urgency=low * support for amd64 -- Oleksandr Shneyder Tue, 26 Jun 2007 16:32:53 +0200 x2goserver (2.0.1-6) unstable; urgency=low * close std file descriptors in daemon -- Oleksandr Shneyder Wed, 25 Apr 2007 10:40:22 +0200 x2goserver (2.0.1-5) unstable; urgency=low * fix listsusp in wrapper -- Oleksandr Shneyder Tue, 20 Mar 2007 12:06:00 +0100 x2goserver (2.0.1-4) unstable; urgency=low * fix getdisplays and getports in wrapper -- Oleksandr Shneyder Tue, 20 Mar 2007 12:06:54 +0100 x2goserver (2.0.1-3) unstable; urgency=low * listallrunning and listsusp in postgress wrapper * changes in database template, unique display and ports -- Oleksandr Shneyder Mon, 19 Mar 2007 15:13:32 +0100 x2goserver (2.0.1-2) unstable; urgency=low * get server name with `hostname` in cleansessions -- root Wed, 28 Feb 2007 09:49:48 +0100 x2goserver (2.0.1-1) unstable; urgency=low * Initial release -- Oleksandr Shneyder Thu, 8 Feb 2007 15:21:30 +0100 x2goserver-4.1.0.3/COPYING0000644000000000000000000004325413377671145011732 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. x2goserver-4.1.0.3/INSTALL0000644000000000000000000000564213377671145011727 0ustar TARBALL INSTALLATION OF x2goserver ================================== 1.) USERS + GROUPS for X2Go --------------------------- Set up x2gouser account and its group if they do not exist already: $ groupadd --system x2gouser $ useradd --system --no-create-home \ --shell /bin/false --home /var/lib/x2go x2gouser Set up x2goprint account and its group if they do not exist already: $ groupadd --system x2goprint $ useradd --system \ --shell /bin/false --home /var/spool/x2goprint x2goprint $ chown x2goprint:x2goprint ~x2goprint $ chmod 0770 ~x2goprint 2.) BUILD + INSTALL x2goserver FILES ----------------------------- Extract tarball and run $ make && sudo make install in base folder of the extracted tarball. 3.) SGID GROUP -------------- Configure ownership, permissions and setgid group bits of libx2go-server-db-sqlite3-wrapper and x2goprint: NOTE: The described actions have already been performed by the Makefile run, leaving this here for documentation only. $ chown root:x2gouser /usr/lib/x2go/libx2go-server-db-sqlite3-wrapper $ chmod 2755 /usr/lib/x2go/libx2go-server-db-sqlite3-wrapper $ chown root:x2goprint /usr/bin/x2goprint $ chmod 2755 /usr/bin/x2goprint $ chown 0440 /etc/sudoers.d/x2goserver 4.) INIT SCRIPT --------------- Create a simple init script that starts $PREFIX/sbin/x2gocleansessions on system start (runlevel 2-3-4-5). Alternatively, you can add a single line to /etc/rc.local: /usr/local/sbin/x2gocleansessions & 5.) LOCAL FOLDER SHARING ------------------------ Users that shall be able to use X2Go's local folder sharing functionality (via sshfs) have to be members of your server system's ,,fuse'' group $ usermod -a -G fuse 6.) PRINTING ------------ Also users that shall be able to send print jobs to client-side printers have to be members of the server-side ,,fuse'' group (see above). As X2Go printing setups can be rather versatile, details on X2Go printing are explained in the project's wiki: https://www.x2go.org/doku.php/wiki:components:printing https://www.x2go.org/doku.php/wiki:advanced:multi-node:x2goserver-printing 7.) DATABASE SETUP (SQLite3 only) --------------------------------- $ x2godbadmin --createdb 7a.) DEFAULT: SQLite3 setup --------------------------- This variant is the default X2Go database setup. The X2Go database keeps track of running/suspended/finished X2Go sessions, mounted devices, etc. If you use SQLite3 as DB backend, X2Go will run on one single server. For multi-X2GoServer support use the PostgreSQL setup variant of X2Go server. All files are already resent for this setup. If not, please report it as a bug. 7b.) ALTERNATIVE: PostgreSQL setup ---------------------------------- This variant is for a setup of x2goserver that uses a PostgreSQL database backend... The exact installation of x2goserver with PostgreSQL support is described here: https://www.x2go.org/doku.php/wiki:advanced:multi-node:x2goserver-pgsql x2goserver-4.1.0.3/libx2go-server-db-perl/lib/libx2go-server-db-sqlite3-wrapper.pl0000755000000000000000000000375713377671145024503 0ustar #!/usr/bin/perl -XU # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Switch; use X2Go::Server::DB::SQLite3; #### NOTE: this script is run setgid and it cannot do system() calls. sub print_result { my $retval = shift; if ( $retval =~ /^(0|1)$/ ) { if ( $retval ) { print "ok"; } } else { print $retval; } } sub print_result_list { my @list = @_; print join("\n", @list); } my $result; my @result_list; my $cmd=shift or die "command not specified"; # call the corresponding function in the X2Go::Server:DB:SQLite3 package switch ($cmd) { case /.*listsessions.*root/ { @result_list = eval("X2Go::Server::DB::SQLite3::dbsys_$cmd(\@ARGV)") } case /.*(list.*sessions|getmounts).*/ { @result_list = eval("X2Go::Server::DB::SQLite3::db_$cmd(\@ARGV)") } case /.*(root|deletemounts)/ { $result = eval("X2Go::Server::DB::SQLite3::dbsys_$cmd(\@ARGV)") } else { $result = eval("X2Go::Server::DB::SQLite3::db_$cmd(\@ARGV)") } } if (@result_list) { print_result_list(@result_list); } elsif ( defined($result) ) { print_result($result); } exit (0); x2goserver-4.1.0.3/libx2go-server-db-perl/Makefile0000755000000000000000000000317613377671145016536 0ustar #!/usr/bin/make -f SRC_DIR=$(CURDIR) SHELL=/bin/bash CC ?= gcc override CFLAGS += -fPIE override LDFLAGS += -pie INSTALL_DIR=install -d -o root -g root -m 755 INSTALL_FILE=install -o root -g root -m 644 INSTALL_PROGRAM=install -o root -g root -m 755 RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty DESTDIR ?= PREFIX ?= /usr/local ETCDIR=/etc/x2go BINDIR=$(PREFIX)/bin SBINDIR=$(PREFIX)/sbin LIBDIR=$(PREFIX)/lib/x2go MANDIR=$(PREFIX)/share/man SHAREDIR=$(PREFIX)/share/x2go #BIN_SCRIPTS=$(shell cd bin && echo *) #SBIN_SCRIPTS=$(shell cd sbin && echo *) LIB_FILES=libx2go-server-db-sqlite3-wrapper libx2go-server-db-sqlite3-wrapper.pl #FEATURE_SCRIPTS=$(shell cd share/x2gofeature.d && echo *.features) #man_pages = `cd man && find * -type f` #MAN2HTML_BIN = man2html #MAN2HTML_SRC = man #MAN2HTML_DEST = .build_man2html/html all: clean build build: build-arch build-indep build-arch: $(CC) $(CFLAGS) $(LDFLAGS) -DTRUSTED_BINARY=\"$(LIBDIR)/libx2go-server-db-sqlite3-wrapper.pl\" -o lib/libx2go-server-db-sqlite3-wrapper src/libx2go-server-db-sqlite3-wrapper.c build-indep: clean: clean-arch clean-indep clean-arch: rm -f lib/libx2go-server-db-sqlite3-wrapper clean-indep: install: install_scripts install_scripts: $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) $(INSTALL_PROGRAM) lib/* $(DESTDIR)$(LIBDIR)/ getent group x2gouser &>/dev/null && chown root:x2gouser $(DESTDIR)$(LIBDIR)/libx2go-server-db-sqlite3-wrapper || true chmod 2755 $(DESTDIR)$(LIBDIR)/libx2go-server-db-sqlite3-wrapper uninstall: uninstall_scripts uninstall_scripts: for file in $(LIB_FILES); do $(RM_FILE) $(DESTDIR)$(LIBDIR)/$$file; done x2goserver-4.1.0.3/libx2go-server-db-perl/src/libx2go-server-db-sqlite3-wrapper.c0000644000000000000000000000304413377671145024315 0ustar /* * This file is part of the X2Go Project - https://www.x2go.org * Copyright (C) 2011-2015 Mike Gabriel * Copyright (C) 2011-2015 Moritz 'Morty' Strübe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * */ #include #include #include #include #include int main(int argc, char **argv) { const char *x2gosqlitewrapper = TRUSTED_BINARY; argv[0] = "libx2go-server-db-sqlite3-wrapper.pl"; // execute the script, running with user-rights of this binary int ret = execv(x2gosqlitewrapper, argv); int saved_errno = errno; if (ret) { fprintf (stderr, "unable to execute script '"); fprintf (stderr, "%s", TRUSTED_BINARY); fprintf (stderr, "': "); fprintf (stderr, "%s", strerror (saved_errno)); return (EXIT_FAILURE); } /* Should not be reached. */ return (EXIT_SUCCESS); } x2goserver-4.1.0.3/Makefile0000755000000000000000000000623113377671145012334 0ustar #!/usr/bin/make -f RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty DESTDIR ?= PREFIX ?= /usr/local ETCDIR=/etc/x2go LIBDIR ?= $(PREFIX)/lib/x2go SHAREDIR=$(PREFIX)/share/x2go PERL ?= /usr/bin/perl PERL_INSTALLDIRS ?= vendor all: build build: build-arch build-indep # make man2html build available from project's base folder... build_man2html: $(MAKE) -C x2goserver-common $@ $(MAKE) -C x2goserver $@ $(MAKE) -C libx2go-server-db-perl $@ $(MAKE) -C x2goserver-x2goagent $@ $(MAKE) -C x2goserver-printing $@ $(MAKE) -C x2goserver-extensions $@ $(MAKE) -C x2goserver-xsession $@ $(MAKE) -C x2goserver-fmbindings $@ $(MAKE) -C x2goserver-desktopsharing $@ clean: -$(MAKE) -f Makefile.perl clean $(MAKE) -C x2goserver-common $@ $(MAKE) -C x2goserver $@ $(MAKE) -C libx2go-server-db-perl $@ $(MAKE) -C x2goserver-x2goagent $@ $(MAKE) -C x2goserver-printing $@ $(MAKE) -C x2goserver-extensions $@ $(MAKE) -C x2goserver-xsession $@ $(MAKE) -C x2goserver-fmbindings $@ $(MAKE) -C x2goserver-desktopsharing $@ distclean: -$(MAKE) -f Makefile.perl realclean $(MAKE) -C x2goserver-common clean $(MAKE) -C x2goserver clean $(MAKE) -C libx2go-server-db-perl clean $(MAKE) -C x2goserver-x2goagent clean $(MAKE) -C x2goserver-printing clean $(MAKE) -C x2goserver-extensions clean $(MAKE) -C x2goserver-xsession clean $(MAKE) -C x2goserver-fmbindings clean $(MAKE) -C x2goserver-desktopsharing $@ build-arch: $(MAKE) -C x2goserver-common $@ $(MAKE) -C x2goserver $@ $(MAKE) -C libx2go-server-db-perl $@ $(MAKE) -C x2goserver-x2goagent $@ $(MAKE) -C x2goserver-printing $@ $(MAKE) -C x2goserver-extensions $@ $(MAKE) -C x2goserver-xsession $@ $(MAKE) -C x2goserver-fmbindings $@ $(MAKE) -C x2goserver-desktopsharing $@ build-indep: $(PERL) Makefile.PL INSTALLDIRS=$(PERL_INSTALLDIRS) $(MAKE) -f Makefile.perl $(MAKE) -C x2goserver-common $@ $(MAKE) -C x2goserver $@ $(MAKE) -C libx2go-server-db-perl $@ $(MAKE) -C x2goserver-x2goagent $@ $(MAKE) -C x2goserver-printing $@ $(MAKE) -C x2goserver-extensions $@ $(MAKE) -C x2goserver-xsession $@ $(MAKE) -C x2goserver-fmbindings $@ $(MAKE) -C x2goserver-desktopsharing $@ install: $(MAKE) -f Makefile.perl pure_install $(MAKE) -C x2goserver-common $@ $(MAKE) -C x2goserver $@ $(MAKE) -C libx2go-server-db-perl $@ $(MAKE) -C x2goserver-x2goagent $@ $(MAKE) -C x2goserver-printing $@ $(MAKE) -C x2goserver-extensions $@ $(MAKE) -C x2goserver-xsession $@ $(MAKE) -C x2goserver-fmbindings $@ $(MAKE) -C x2goserver-desktopsharing $@ uninstall: $(MAKE) -C x2goserver-printing $@ $(MAKE) -C x2goserver-x2goagent $@ $(MAKE) -C x2goserver-xsession $@ $(MAKE) -C x2goserver-desktopsharing $@ $(MAKE) -C x2goserver-fmbindings $@ $(MAKE) -C x2goserver-extensions $@ $(MAKE) -f Makefile.perl uninstall $(MAKE) -C libx2go-server-db-perl $@ $(MAKE) -C x2goserver $@ $(MAKE) -C x2goserver-common $@ if test -d $(DESTDIR)$(LIBDIR); then $(RM_DIR) $(DESTDIR)$(LIBDIR); fi if test -d $(DESTDIR)$(SHAREDIR)/x2gofeature.d; then $(RM_DIR) $(DESTDIR)$(SHAREDIR)/x2gofeature.d; fi if test -d $(DESTDIR)$(SHAREDIR); then $(RM_DIR) $(DESTDIR)$(SHAREDIR); fi if test -d $(DESTDIR)$(ETCDIR); then $(RM_DIR) $(DESTDIR)$(ETCDIR); fi x2goserver-4.1.0.3/Makefile.docupload0000644000000000000000000000414613377671145014305 0ustar #!/usr/bin/make -f # Makefile.docupload file - for x2goserver # Copyright (C) 2010-2015 Mike Gabriel # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. VERSION=`head -n1 debian/changelog | sed 's,.*(\(.*\)).*,\1,' | cut -d"-" -f1` DOC_HOST=code.x2go.org DOC_PATCH_x2goserver=/srv/sites/x2go.org/packages/doc/x2goserver/man/ DOC_PATCH_printing=/srv/sites/x2go.org/packages/doc/x2goserver-printing/man/ DOC_PATCH_extensions=/srv/sites/x2go.org/packages/doc/x2goserver-extensions/man/ DOC_USER=x2go-admin all: doc doc: clean docbuild docupload docbuild: ${MAKE} -f Makefile build_man2html docupload: ssh -l${DOC_USER} ${DOC_HOST} "{ mkdir -p ${DOC_PATCH_x2goserver}; rm -Rfv ${DOC_PATCH_x2goserver}/*; }" ssh -l${DOC_USER} ${DOC_HOST} "{ mkdir -p ${DOC_PATCH_printing}; rm -Rfv ${DOC_PATCH_printing}/*; }" ssh -l${DOC_USER} ${DOC_HOST} "{ mkdir -p ${DOC_PATCH_compat}; rm -Rfv ${DOC_PATCH_compat}/*; }" ssh -l${DOC_USER} ${DOC_HOST} "{ mkdir -p ${DOC_PATCH_extensions}; rm -Rfv ${DOC_PATCH_extensions}/*; }" scp -r x2goserver/.build_man2html/html/* ${DOC_USER}@${DOC_HOST}:${DOC_PATCH_x2goserver}/ scp -r x2goserver-printing/.build_man2html/html/* ${DOC_USER}@${DOC_HOST}:${DOC_PATCH_printing}/ scp -r x2goserver-extensions/.build_man2html/html/* ${DOC_USER}@${DOC_HOST}:${DOC_PATCH_extensions}/ clean: rm -Rf x2goserver/.build_man2html/html/* rm -Rf x2goserver-printing/.build_man2html/html/* rm -Rf x2goserver-extensions/.build_man2html/html/* x2goserver-4.1.0.3/Makefile.PL0000644000000000000000000000026313377671145012642 0ustar #!/usr/bin/perl use ExtUtils::MakeMaker; WriteMakefile(FIRST_MAKEFILE => 'Makefile.perl', PMLIBDIRS => ['X2Go'], NAME => '', VERSION => '4.1.0.3', ); x2goserver-4.1.0.3/README.i18n0000644000000000000000000000617513377671145012336 0ustar Translating X2Go Server ====================== Translating with gettext ------------------------ X2Go Server uses gettext as translation service/mechanism (.po/.mo/.pot files). The translation files can be found in the /debian/po folder of this source project. The x2goserver X2Go component currently only requires translation for the DebConf templates (configuration screens of Debian/Ubuntu/ packages. A translation of upstream code is currently not necessary, but this may vary in the future. New team member --- new language for X2Go Server ----------------------------------------------- If you are a new member in the x2go-i18n team, the first we say is: WELCOME!!! and THANKS!!! for the time you give to the X2Go project. And, if you are new to the team and language files for the language you want to feel responsible for do not yet exist, please subscribe to this mailing list first: https://lists.x2go.org/listinfo/x2go-i18n Once you are subscribed, send an email to x2go-i18n@lists.x2go.org that explains your willingness to translate this-and-that language. The developers will then provide a language file for you in the above mentioned /po folder. Git cloning ----------- Next thing to do is to obtained the latest sources from X2Go Git. $ # git needs to be installed, on Debian/Ubuntu this is $ sudo apt-get install git $ # then checkout the code $ git clone git://code.x2go.org/x2goserver.git In your current working directory there should now be a subfolder named ,,x2goserver''. Creating Your Language File --------------------------- First, Copy the de.po file with terminal. you do this by typing the following commands: 1. cd x2goserver/debian/po 2. sudo cp templates.pot da.po (or whatever langauge you are going to work on) Now the file is ready for translating it into the language you are going to work on. Editing Your Language File -------------------------- The recommended tool for editing gettext translation files is ,,poedit'' $ aptitude install poedit <--for debian $ sudo apt-get install poedit <--for ubuntu Run poedit and configure it first (mostly personalizing, full name, email address, etc.). Now open your language file in /x2goserver/debian/po/.po and edit it with poedit. NOTE: Make sure you translate all boldly marked items: non-translated as well as fuzzy (i.e. inaccurate) items. Sending in the Translation File ------------------------------- When done, please send the complete translation file /x2goserver/debian/po/.po to x2go-i18n@lists.x2go.org and remove your working copy of X2Go Server from your system (or read how to use Git and keep the folder). Next time... ------------ You will get informed on x2go-i18n if a translation update is necessary. So check your mails there regularly. For updating a translation, either keep the X2Go Server source project folder and read more on Git by your self. Alternatively, just remove the folder (once you have sent in the translation file) and start with this documentation all over again. THANKS AGAIN FOR YOUR TIME!!! light+love, Mike Gabriel x2goserver-4.1.0.3/README.md0000644000000000000000000000361413377671145012152 0ustar # X2Go Server This document provides an overview of the sources of the X2Go Server project and its codebase. The most of different folders are documented with README.md files, as well. The goal of this documentation is to provide a quick overview of what is where and how the different components interact. * debian This folder contains all the stuff that is needed to build the Debian package. * x2goserver This folder contains the X2Go Server core component. Look into this folder's README.md file. * x2goserver-compat This folder contains the compatibility scripts. * x2goserver-extensions This folder contains the extensions to the X2Go Server's core component. The x2goserver-run-extensions is called from within a number of X2Go Server core scripts. * x2goserver-fmbindings X2Go wrapper for Browsing X2Go Shared Folders * x2goserver-printing This folder contains the X2Go print jobs library. * x2goserver-pyhoca This folder contains the pyhoca extension for including the pyhoca libraries from the pyhoca libraries. The approach is to move everything provided in this package over to one of the other components (once new ideas have been accepted by the other developers). * x2goserver-xsession This folder contains the project for fiddling around with Xsession files of your own system and the X2Go Server's Xsession files. * INSTALL This file contains installation instructions for building and installing it from a tarball. * Makefile This file is used by [https://www.gnu.org/software/make/manual/make.html](make) to build and install the code with the appropriate compiler. * Makefile.docupload This file is used by [https://www.gnu.org/software/make/manual/make.html](make) to build and upload the x2goserver documentation. * UNINSTALL This File contains instructions for uninstalling X2GO Server in case it was installed via tarball. x2goserver-4.1.0.3/rpm/x2goserver.init0000644000000000000000000000321013377671145014454 0ustar #!/bin/sh # # x2goserver - Starts/stop the "x2goserver" daemon # # chkconfig: 2345 99 1 # description: Cleans the X2Go session database ### BEGIN INIT INFO # Provides: x2goserver at batch # Required-Start: $local_fs # Required-Stop: $local_fs # Default-Start: 2345 # Default-Stop: 016 # Short-Description: Starts/stop the "x2goserver" daemon # Description: Cleans the X2Go session database ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions exec=/usr/sbin/x2gocleansessions prog="X2Go Server" config=/etc/sysconfig/x2goserver XSOCKDIR=/tmp/.X11-unix [ -e $config ] && . $config lockfile=/var/lock/subsys/x2goserver start() { [ -x $exec ] || exit 5 # Make sure these are created by default so that nobody else can if [ ! -d $XSOCKDIR ] then mkdir $XSOCKDIR chmod 1777 $XSOCKDIR fi printf '%s' $"Starting $prog: " daemon $exec $OPTS retval=$? echo [ $retval -eq 0 ] && touch $lockfile } stop() { printf '%s' $"Stopping $prog: " killproc $exec retval=$? echo rm -f $lockfile } restart() { stop start } reload() { restart } force_reload() { restart } rh_status() { # run checks to determine if the service is running or use generic status status x2goserver } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 restart ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" exit 2 esac exit $? x2goserver-4.1.0.3/rpm/x2goserver-rpmlintrc0000644000000000000000000000122213377671145015523 0ustar setBadness("permissions-unauthorized-file", 0); setBadness("permissions-file-setuid-bit", 0); addFilter("non-standard-group"); addFilter("non-standard-uid /var/spool/x2goprint x2goprint"); addFilter("non-standard-gid /usr/bin/x2goprint x2goprint"); addFilter("non-standard-gid /usr/lib/x2go/libx2go-server-db-sqlite3-wrapper x2gouser"); addFilter("non-standard-gid /usr/lib64/x2go/libx2go-server-db-sqlite3-wrapper x2gouser"); addFilter("non-standard-gid /var/lib/x2go x2gouser"); addFilter("non-standard-gid /var/lib/x2go/x2go_sessions x2gouser"); addFilter("non-standard-gid /var/spool/x2goprint x2goprint"); addFilter("filename-too-long-for-joliet *"); x2goserver-4.1.0.3/UNINSTALL0000644000000000000000000000120113377671145012155 0ustar TARBALL UNINSTALL OF x2goserver =============================== 1.) Remove SQLite database -------------------------- $ rm -vf /var/lib/x2go/x2go_sessions 2.) Remove PostgreSQL passwords ------------------------------- $ rm -vf /etc/x2go/x2gosql/passwords/pgadmin 3.) Remove MySQL passwords ------------------------------- $ rm -vf /etc/x2go/x2gosql/passwords/mysqladmin 4.) Remove x2gouser and groups from the system ---------------------------------------------- $ deluser x2gouser $ delgroup x2gouser 5.) Run Makefile's uninstall ---------------------------- $ cd /path/to/extracted/x2goserver/tarball $ make uninstall x2goserver-4.1.0.3/X2Go/Config.pm0000644000000000000000000000303513377671145013212 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. package X2Go::Config; =head1 NAME X2Go::Config - X2Go Config package for Perl =head1 DESCRIPTION X2Go::Config Perl package for X2Go components. =cut use strict; use Config::Simple; use base 'Exporter'; our @EXPORT = ( 'get_config', 'get_sqlconfig', ); my $Config; my $SqlConfig; sub get_config { if (! defined $Config) { $Config = new Config::Simple(syntax=>'ini'); $Config->read('/etc/x2go/x2goserver.conf' ); } return $Config; } sub get_sqlconfig { if (! defined $SqlConfig) { $SqlConfig = new Config::Simple(syntax=>'ini'); $SqlConfig->read('/etc/x2go/x2gosql/sql' ); } return $SqlConfig; } 1; x2goserver-4.1.0.3/X2Go_in_progress_do_not_use/Server/DB/MySQL.pm0000644000000000000000000006076113377671145021346 0ustar # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # Copyright (C) 2017-2018 Walid Moghrabi # Copyright (C) 2018 Mihai Moldovan # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. package X2Go::Server::DB::MySQL; =head1 NAME X2Go::Server::DB::MySQL - X2Go Session Database package for Perl (MySQL backend) =head1 DESCRIPTION X2Go::Server::DB::MySQL Perl package for X2Go::Server. =cut use strict; use DBI; use POSIX; use Sys::Syslog qw( :standard :macros ); use X2Go::Log qw( loglevel ); use X2Go::Config qw( get_config get_sqlconfig ); use X2Go::Utils qw( sanitizer system_capture_stdout_output is_true ); setlogmask( LOG_UPTO(loglevel()) ); use base 'Exporter'; our @EXPORT=('db_listsessions','db_listsessions_all', 'db_getservers', 'db_getagent', 'db_resume', 'db_changestatus', 'db_getstatus', 'db_getdisplays', 'db_insertsession', 'db_insertshadowsession', 'db_getports', 'db_insertport', 'db_rmport', 'db_createsession', 'db_insertmount', 'db_getmounts', 'db_deletemount', 'db_getdisplay', 'dbsys_getmounts', 'dbsys_listsessionsroot', 'dbsys_listsessionsroot_all', 'dbsys_rmsessionsroot', 'dbsys_deletemounts', 'db_listshadowsessions','db_listshadowsessions_all'); my ($uname, $pass, $uid, $pgid, $quota, $comment, $gcos, $homedir, $shell, $expire) = getpwuid(getuid()); my $host; my $port; my $db="x2go_sessions"; my $dbpass; my $dbuser; my $sslmode; my $with_TeKi; sub init_db { # the $Config is required later (see below...) my $Config = get_config; $with_TeKi = is_true($Config->param("telekinesis.enable")); if ( ! ( $dbuser and $dbpass ) ) { my $SqlConfig = get_sqlconfig; my $x2go_lib_path=system_capture_stdout_output("x2gopath", "libexec"); my $backend=$SqlConfig->param("backend"); if ( $backend ne "mysql" ) { die "X2Go server is not configured to use the MySQL session db backend"; } $host=$SqlConfig->param("mysql.host"); $port=$SqlConfig->param("mysql.port"); if (!$host) { $host='localhost'; } if (!$port) { $port='3306'; } my $passfile; if ($uname eq 'root') { $dbuser='x2godbuser'; $passfile="/etc/x2go/x2gosql/passwords/x2gomysqladmin"; } else { $dbuser="x2gouser_$uname"; $passfile="$homedir/.x2go/mysqlpass"; } open (FL,"< $passfile") or die "Can't read password file $passfile
Use x2godbadmin on server to configure database access for user $uname
"; $dbpass=; close(FL); chomp($dbpass); } my $dbh = DBI->connect ("dbi:mysql:database=$db;host=$host;port=$port", "$dbuser", "$dbpass", {AutoCommit => 1}) or die $_; return $dbh; } sub check_root { die "$uname is not authorized to perform this operation" unless ($uname eq "root"); } sub validate_session_id { my $sid = shift or die "argument \"session_id\" missing"; return if $uname eq "root"; # session id looks like someuser-51-1304005895_stDgnome-session_dp24 # during DB insertsession it only looks like someuser-51-1304005895 # derive the session's user from the session name/id my $user = "$sid"; my $uname_ = "$uname"; # handle ActiveDirectory Domain user accounts gracefully $uname_ =~ s/\\//; # perform the user check $user =~ s/($uname_-[0-9]{2,}-[0-9]{10,}_st(D|R).*|.*-[0-9]{2,}-[0-9]{10,}_stS(0|1)XSHAD$uname_.*)/$uname_/; die "$uname_ is not authorized to perform this operation" unless ($uname_ eq $user); } sub check_error { my $sth = shift or die "Invalid or no statement handle parameter supplied"; my $fatal = shift; my $func_name = (caller(1))[3]; $fatal = 1 unless defined($fatal); if ($sth->err()) { syslog('error', "$func_name (MySQL session DB backend) failed with exitcode: " . $sth->err() . ": " . $sth->errstr()); if ($fatal) { die "$func_name (MySQL session DB backend): " . $sth->err() . ": " . $sth->errstr(); } } } sub fetchrow_array_datasets { my $sth = shift or die "Invalid or no statement handle parameter supplied"; my @lines; while (my @data = $sth->fetchrow_array()) { push @lines, join('|', @data); } return @lines; } sub fetchrow_array_datasets_single_framed { my $sth = shift or die "Invalid or no statement handle parameter supplied"; my @lines; while (my @data = $sth->fetchrow_array()) { push @lines, "|" . @data[0] . "|"; } return @lines; } sub fetchrow_array_datasets_double_spacelim { my $sth = shift or die "Invalid or no statement handle parameter supplied"; my @lines; while (my @data = $sth->fetchrow_array()) { push @lines, @data[0] . " " . @data[1]; } return @lines; } sub fetchrow_array_single_single { my $sth = shift or die "Invalid or no statement handle parameter supplied"; my $ret = ''; if (my @data = $sth->fetchrow_array()) { $ret = @data[0]; } return $ret; } sub dbsys_rmsessionsroot { my $dbh = init_db(); check_root(); my $sid = shift or die "argument \"session_id\" missing"; my $sth=$dbh->prepare("delete from sessions where session_id=?"); $sth->execute($sid); check_error($sth); $sth->finish(); undef $dbh; return 1; } sub dbsys_deletemounts { my $dbh = init_db(); my $sid = shift or die "argument \"session_id\" missing"; validate_session_id($sid); my $sth=$dbh->prepare("delete from mounts where session_id=?"); $sth->execute($sid); check_error($sth); $sth->finish(); undef $dbh; return 1; } sub dbsys_listsessionsroot { my $dbh = init_db(); check_root(); my $server = shift or die "argument \"server\" missing"; my @sessions; my $sth = undef; if ($with_TeKi) { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, DATE_FORMAT(init_time, '%Y-%m-%dT%H:%i:%S'), cookie, client, gr_port, sound_port, DATE_FORMAT(last_time, '%Y-%m-%dT%H:%i:%S'), uname, MOD(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(init_time), 86400), fs_port, tekictrl_port, tekidata_port from sessions where server=? order by status desc"); } else { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, DATE_FORMAT(init_time, '%Y-%m-%dT%H:%i:%S'), cookie, client, gr_port, sound_port, DATE_FORMAT(last_time, '%Y-%m-%dT%H:%i:%S'), uname, MOD(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(init_time), 86400), fs_port from sessions where server=? order by status desc"); } $sth->execute($server); check_error($sth); @sessions = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @sessions; } sub dbsys_listsessionsroot_all { my $dbh = init_db(); check_root(); my @sessions; my $sth = undef; if ($with_TeKi) { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, DATE_FORMAT(init_time, '%Y-%m-%dT%H:%i:%S'), cookie, client, gr_port, sound_port, DATE_FORMAT(last_time, '%Y-%m-%dT%H:%i:%S'), uname, MOD(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(init_time), 86400), fs_port, tekictrl_port, tekidata_port from sessions order by status desc"); } else { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, DATE_FORMAT(init_time, '%Y-%m-%dT%H:%i:%S'), cookie, client, gr_port, sound_port, DATE_FORMAT(last_time, '%Y-%m-%dT%H:%i:%S'), uname, MOD(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(init_time), 86400), fs_port from sessions order by status desc"); } $sth->execute(); check_error($sth); @sessions = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @sessions; } sub dbsys_getmounts { my $dbh = init_db(); my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); my @mounts; my $sth=$dbh->prepare("select client, path from mounts where session_id=?"); $sth->execute($sid); check_error($sth); @mounts = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @mounts; } sub db_getmounts { my $dbh = init_db(); my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); my @mounts; my $sth=$dbh->prepare("select client, path from mounts where session_id=?"); $sth->execute($sid); check_error($sth); @mounts = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @mounts; } sub db_deletemount { my $dbh = init_db(); my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); my $path = shift or die "argument \"path\" missing"; my $sth=$dbh->prepare("delete from mounts where session_id=? and path=?"); $sth->execute($sid, $path); check_error($sth); $sth->finish(); undef $dbh; return 1; } sub db_insertmount { my $dbh = init_db(); my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); my $path = shift or die "argument \"path\" missing"; my $client = shift or die "argument \"client\" missing"; my $sth=$dbh->prepare("insert into mounts (session_id, path, client) values (?, ?, ?)"); $sth->execute($sid, $path, $client); check_error($sth, 0); my $success = (!($sth->err())); $sth->finish(); undef $dbh; return $success; } sub db_insertsession { my $dbh = init_db(); my $display = shift or die "argument \"display\" missing"; $display = sanitizer('num', $display) or die "argument \"display\" malformed"; my $server = shift or die "argument \"server\" missing"; my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); my $sth=$dbh->prepare("insert into sessions (display, server, uname, session_id) values (?, ?, ?, ?)"); $sth->execute($display, $server, $uname, $sid); check_error($sth); $sth->finish(); undef $dbh; return 1; } sub db_insertshadowsession { my $dbh = init_db(); my $display = shift or die "argument \"display\" missing"; $display = sanitizer('num', $display) or die "argument \"display\" malformed"; my $server = shift or die "argument \"server\" missing"; my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $shadreq_user = shift or die "argument \"shadreq_user\" missing"; (my $fake_sid = $sid) =~ s/$shadreq_user-/$uname-/; validate_session_id($fake_sid); my $sth=$dbh->prepare("insert into sessions (display, server, uname, session_id) values (?, ?, ?, ?)"); $sth->execute($display, $server, $shadreq_user, $sid); check_error($sth); $sth->finish(); undef $dbh; return 1; } sub db_createsession { my $dbh = init_db(); my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); my $cookie = shift or die "argument \"cookie\" missing"; my $pid = shift or die "argument \"pid\" missing"; $pid = sanitizer('num', $pid) or die "argument \"pid\" malformed"; my $client = shift or die "argument \"client\" missing"; my $gr_port = shift or die "argument \"gr_port\" missing"; $gr_port = sanitizer('num', $gr_port) or die "argument \"gr_port\" malformed"; my $snd_port = shift or die "argument \"snd_port\" missing"; $snd_port = sanitizer('num', $snd_port) or die "argument \"snd_port\" malformed"; my $fs_port = shift or die "argument \"fs_port\" missing"; $fs_port = sanitizer('num', $fs_port) or die "argument \"fs_port\" malformed"; my $sth; if ($with_TeKi) { my $tekictrl_port = shift or die "argument \"tekictrl_port\" missing"; $tekictrl_port = sanitizer('pnnum', $tekictrl_port) or die "argument \"tekictrl_port\" malformed"; my $tekidata_port = shift or die"argument \"tekidata_port\" missing"; $tekidata_port = sanitizer('pnnum', $tekidata_port) or die "argument \"tekidata_port\" malformed"; $sth=$dbh->prepare("update sessions set status='R', last_time=NOW(), cookie=?, agent_pid=?, client=?, gr_port=?, sound_port=?, fs_port=?, tekictrl_port=?, tekidata_port=? where session_id=?"); $sth->execute($cookie, $pid, $client, $gr_port, $snd_port, $fs_port, $tekictrl_port, $tekidata_port, $sid); } else { $sth=$dbh->prepare("update sessions set status='R', last_time=NOW(), cookie=?, agent_pid=?, client=?, gr_port=?, sound_port=?, fs_port=? where session_id=?"); $sth->execute($cookie, $pid, $client, $gr_port, $snd_port, $fs_port, $sid); } check_error($sth); $sth->finish(); undef $dbh; return 1; } sub db_insertport { my $dbh = init_db(); my $server = shift or die "argument \"server\" missing"; my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); my $sshport = shift or die "argument \"port\" missing"; my $sth=$dbh->prepare("insert into used_ports (server, session_id, port) values (?, ?, ?)"); $sth->execute($server, $sid, $sshport); check_error($sth); $sth->finish(); undef $dbh; return 1; } sub db_rmport { my $dbh = init_db(); my $server = shift or die "argument \"server\" missing"; my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); my $sshport = shift or die "argument \"port\" missing"; my $sth=$dbh->prepare("delete from used_ports where server=? and session_id=? and port=?"); $sth->execute($server, $sid, $sshport); check_error($sth); $sth->finish(); undef $dbh; return 1; } sub db_resume { my $dbh = init_db(); my $client = shift or die "argument \"client\" missing"; my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); my $gr_port = shift or die "argument \"gr_port\" missing"; $gr_port = sanitizer('num', $gr_port) or die "argument \"gr_port\" malformed"; my $snd_port = shift or die "argument \"snd_port\" missing"; $snd_port = sanitizer('num', $snd_port) or die "argument \"snd_port\" malformed"; my $fs_port = shift or die "argument \"fs_port\" missing"; $fs_port = sanitizer('num', $fs_port) or die "argument \"fs_port\" malformed"; my $sth; if ($with_TeKi) { my $tekictrl_port = shift or die "argument \"tekictrl_port\" missing"; $tekictrl_port = sanitizer('pnnum', $tekictrl_port) or die "argument \"tekictrl_port\" malformed"; my $tekidata_port = shift or die "argument \"tekidata_port\" missing"; $tekidata_port = sanitizer('pnnum', $tekidata_port) or die "argument \"tekidata_port\" malformed"; $sth=$dbh->prepare("update sessions set last_time=NOW(), status='R', client=?, gr_port=?, sound_port=?, fs_port=?, tekictrl_port=?, tekidata_port=? where session_id=?"); $sth->execute($client, $gr_port, $snd_port, $fs_port, $tekictrl_port, $tekidata_port, $sid); } else { $sth=$dbh->prepare("update sessions set last_time=NOW(), status='R', client=?, gr_port=?, sound_port=?, fs_port=? where session_id=?"); $sth->execute($client, $gr_port, $snd_port, $fs_port, $sid); } check_error($sth); $sth->finish(); undef $dbh; return 1; } sub db_changestatus { my $dbh = init_db(); my $status = shift or die "argument \"status\" missing"; my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); # we need to be able to change the state of normal sessions (real user == effective user) # _and_ desktop sharing session (real user != effective user). Thus, extracting the effective # username from the session ID... (my $effective_user = $sid) =~ s/\-[0-9]+\-[0-9]{10}_.*//; my $sth=$dbh->prepare("update sessions set last_time=NOW(), status=? where session_id=? and uname=?"); $sth->execute($status, $sid, $effective_user); check_error($sth); $sth->finish(); undef $dbh; return 1; } sub db_getstatus { my $dbh = init_db(); my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); my $status = ''; my $sth=$dbh->prepare("select status from sessions where session_id=?"); $sth->execute($sid); check_error($sth); $status = fetchrow_array_single_single($sth); $sth->finish(); undef $dbh; return $status; } sub db_getdisplays { my $dbh = init_db(); my $server = shift or die "argument \"server\" missing"; my @displays; my $sth=$dbh->prepare("select display from sessions where server=?"); $sth->execute($server); check_error($sth); @displays = fetchrow_array_datasets_single_framed($sth); $sth->finish(); undef $dbh; return @displays; } sub db_getports { my $dbh = init_db(); my @ports; my $server = shift or die "argument \"server\" missing"; my $sth=$dbh->prepare("select port from used_ports where server=?"); $sth->execute($server); check_error($sth); @ports = fetchrow_array_datasets_single_framed($sth); $sth->finish(); undef $dbh; return @ports; } sub db_getservers { my $dbh = init_db(); my @servers; my $sth=$dbh->prepare("select server,count(*) from sessions where status!='F' group by server"); $sth->execute(); check_error($sth); @servers = fetchrow_array_datasets_double_spacelim($sth); $sth->finish(); undef $dbh; return @servers; } sub db_getagent { my $dbh = init_db(); my $agent; my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); my $sth=$dbh->prepare("select agent_pid from sessions where session_id=?"); $sth->execute($sid); check_error($sth); $agent = fetchrow_array_single_single($sth); $sth->finish(); undef $dbh; return $agent; } sub db_getdisplay { my $dbh = init_db(); my $display; my $sid = shift or die "argument \"session_id\" missing"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; validate_session_id($sid); my $sth=$dbh->prepare("select display from sessions where session_id=?"); $sth->execute($sid); check_error($sth); $display = fetchrow_array_single_single($sth); $sth->finish(); undef $dbh; return $display; } sub db_listsessions { my $dbh = init_db(); my $server = shift or die "argument \"server\" missing"; my @sessions; my $sth; if ($with_TeKi) { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, DATE_FORMAT(init_time, '%Y-%m-%dT%H:%i:%S'), cookie, client, gr_port, sound_port, DATE_FORMAT(last_time, '%Y-%m-%dT%H:%i:%S'), uname, MOD(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(init_time), 86400), fs_port, tekictrl_port, tekidata_port from sessions where status!='F' and server=? and (session_id not like '%XSHAD%') order by status desc"); } else { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, DATE_FORMAT(init_time, '%Y-%m-%dT%H:%i:%S'), cookie, client, gr_port, sound_port, DATE_FORMAT(last_time, '%Y-%m-%dT%H:%i:%S'), uname, MOD(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(init_time), 86400), fs_port from sessions where status!='F' and server=? and (session_id not like '%XSHAD%') order by status desc"); } $sth->execute($server); check_error($sth); @sessions = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @sessions; } sub db_listsessions_all { my $dbh = init_db(); my @sessions; my $sth; if ($with_TeKi) { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, DATE_FORMAT(init_time, '%Y-%m-%dT%H:%i:%S'), cookie, client, gr_port, sound_port, DATE_FORMAT(last_time, '%Y-%m-%dT%H:%i:%S'), uname, MOD(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(init_time), 86400), fs_port, tekictrl_port, tekidata_port from sessions where status!='F' and (session_id not like '%XSHAD%') order by status desc"); } else { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, DATE_FORMAT(init_time, '%Y-%m-%dT%H:%i:%S'), cookie, client, gr_port, sound_port, DATE_FORMAT(last_time, '%Y-%m-%dT%H:%i:%S'), uname, MOD(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(init_time), 86400), fs_port from sessions where status!='F' and (session_id not like '%XSHAD%') order by status desc"); } $sth->execute(); check_error($sth); @sessions = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @sessions; } sub db_listshadowsessions { my $dbh = init_db(); my $server = shift or die "argument \"server\" missing"; my @sessions; my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, DATE_FORMAT(init_time, '%Y-%m-%dT%H:%i:%S'), cookie, client, gr_port, sound_port, DATE_FORMAT(last_time, '%Y-%m-%dT%H:%i:%S'), uname, MOD(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(init_time), 86400), fs_port from sessions where status!='F' and server=? and (session_id like '%XSHAD%') order by status desc"); $sth->execute($server); check_error($sth); @sessions = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @sessions; } sub db_listshadowsessions_all { my $dbh = init_db(); my @sessions; my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, DATE_FORMAT(init_time, '%Y-%m-%dT%H:%i:%S'), cookie, client, gr_port, sound_port, DATE_FORMAT(last_time, '%Y-%m-%dT%H:%i:%S'), uname, MOD(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(init_time), 86400), fs_port from sessions where status!='F' and (session_id is like '%XSHAD%') order by status desc"); $sth->execute(); check_error($sth); @sessions = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @sessions; } 1; x2goserver-4.1.0.3/X2Go/Log.pm0000644000000000000000000000353313377671145012531 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. package X2Go::Log; =head1 NAME X2Go::Log - X2Go Logging package for Perl =head1 DESCRIPTION X2Go::Log Perl package for X2Go components. =cut use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Config qw( get_config ); use base 'Exporter'; our @EXPORT = ( 'loglevel' ); my $Config = get_config(); my $strloglevel = $Config->param("log.loglevel"); sub loglevel { my $loglevel = LOG_NOTICE; if ( $strloglevel eq "emerg" ) { $loglevel = LOG_EMERG; } elsif ( $strloglevel eq "alert" ) { $loglevel = LOG_ALERT; } elsif ( $strloglevel eq "crit" ) { $loglevel = LOG_CRIT; } elsif ( $strloglevel eq "err" ) { $loglevel = LOG_ERR; } elsif ( $strloglevel eq "warning" ) { $loglevel = LOG_WARNING; } elsif ( $strloglevel eq "notice" ) { $loglevel = LOG_NOTICE; } elsif ( $strloglevel eq "info" ) { $loglevel = LOG_INFO; } elsif ( $strloglevel eq "debug" ) { $loglevel = LOG_DEBUG; } return $loglevel; } 1; x2goserver-4.1.0.3/X2Go/Server/Agent/NX.pm0000644000000000000000000000515013377671145014636 0ustar # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. package X2Go::Server::Agent::NX; =head1 NAME X2Go::Server::Agent::NX - X2Go Server NX Agent package for Perl =head1 DESCRIPTION X2Go::Server::Agent::NX Perl package for X2Go::Server. =cut use strict; use POSIX; use Sys::Syslog qw( :standard :macros ); use X2Go::Log qw( loglevel ); setlogmask( LOG_UPTO(loglevel()) ); sub session_has_terminated { my $state=get_agent_state(@_); if(($state eq 'TERMINATING')||($state eq 'TERMINATED')) { return 1; } return 0; } sub session_is_suspended { my $state=get_agent_state(@_); if(($state eq 'SUSPENDING')||($state eq 'SUSPENDED')) { return 1; } return 0; } sub session_is_running { my $state=get_agent_state(@_); if(($state eq 'STARTING')||($state eq 'RESUMING')||($state eq 'RUNNING')) { return 1; } return 0; } sub get_agent_state_file { my $sess=@_[1]; my $user; if ( $sess =~ m/.*-[0-9]{2,}-[0-9]{10,}_stS(0|1)XSHAD.*XSHADPP.*/ ) { my $shadow_user = $sess; $shadow_user =~ s/.*XSHAD(.*)XSHADPP.*/$1/; $user = $shadow_user; } else { $user=@_[2]; } my $stateFile; if ( -d "/tmp-inst/${user}/.x2go-${user}" ) { $stateFile="/tmp-inst/${user}/.x2go-".$user."/C-".$sess."/state"; } else { $stateFile = "/tmp/.x2go-".$user."/C-".$sess."/state"; } return $stateFile; } sub has_agent_state_file { my $stateFile = get_agent_state_file(@_); if ( -e "$stateFile" ) { return 1; } return 0; } sub get_agent_state { my $state; my $stateFile = get_agent_state_file(@_); if (! -e "$stateFile" ) { syslog('warning', "@_[1]: state file for this session does not exist: $stateFile (this can be ignored during session startups)"); $state="UNKNOWN"; } else { open(F,"<$stateFile"); $state=; close(F); } return $state; } 1; x2goserver-4.1.0.3/X2Go/Server/Agent.pm0000644000000000000000000000377413377671145014323 0ustar # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. package X2Go::Server::Agent; =head1 NAME X2Go::Server::Agent - X2Go Server Agent package for Perl =head1 DESCRIPTION X2Go::Server::Agent Perl package for X2Go::Server. =cut use strict; use X2Go::Utils qw( load_module ); # TODO: when other agents may come into play, the AGENT var has to be read from config file or # somehow else... my $DEFAULT_AGENT="NX"; my $AGENT=$DEFAULT_AGENT; my $agent_module = "X2Go::Server::Agent::$AGENT"; load_module $agent_module; use base 'Exporter'; our @EXPORT=( 'session_has_terminated', 'session_is_running', 'session_is_suspended' , 'get_agent_state_file', 'has_agent_state_file', 'get_agent_state' ); sub session_has_terminated { return $agent_module->session_has_terminated(@_); } sub session_is_running { return $agent_module->session_is_running(@_); } sub session_is_suspended { return $agent_module->session_is_suspended(@_); } sub get_agent_state_file { return $agent_module->get_agent_state_file(@_); } sub has_agent_state_file { return $agent_module->has_agent_state_file(@_); } sub get_agent_state { return $agent_module->get_agent_state(@_); } 1; x2goserver-4.1.0.3/x2goserver/bin/x2gobasepath0000755000000000000000000000004413377671145016060 0ustar #!/bin/sh exec x2gopath base "$@"; x2goserver-4.1.0.3/x2goserver/bin/x2gocmdexitmessage0000755000000000000000000000255413377671145017303 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. X2GO_LIB_PATH="$(x2gopath libexec)"; X2GO_ROOT="${HOME}/.x2go" MESSAGE_FILE="$X2GO_ROOT/C-$1/cmdoutput" "$X2GO_LIB_PATH/x2gosyslog" "$0" "info" "$(basename $0) called with options: $@" test -f "$MESSAGE_FILE" && { "$X2GO_LIB_PATH/x2gosyslog" "$0" "debug" "command output starts with: "$(head -n5 "$MESSAGE_FILE" | sed 's/\n/ /g') # return command output of the command that was issued by x2goruncommand cat "$MESSAGE_FILE" } x2goserver-4.1.0.3/x2goserver/bin/x2gofeature0000755000000000000000000000262313377671145015731 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2011-2018 Oleksandr Shneyder # Copyright (C) 2011-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. [ -z $1 ] && { echo usage: "$(basename $0) "; exit -2; } X2GO_LIB_PATH="$(x2gopath libexec)"; X2GO_SHARE_PATH="$(x2gopath share)"; "$X2GO_LIB_PATH/x2gosyslog" "$0" "info" "$(basename $0) called with options: $@" X2GO_FEATURE="$1" # run x2gofeature scripts of X2Go extensions test -d "$X2GO_SHARE_PATH/x2gofeature.d" && { for subscript in "$X2GO_SHARE_PATH/x2gofeature.d/"*.features; do "$subscript" $@ && exit 0 done } echo "not available" exit -1 x2goserver-4.1.0.3/x2goserver/bin/x2gofeaturelist0000755000000000000000000000240613377671145016624 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2011-2015 Mike Gabriel # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. X2GO_LIB_PATH="$(x2gopath 'libexec')" X2GO_SHARE_PATH="$(x2gopath 'share')" "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "$(basename "${0}") called with options: ${@}" # run x2gofeature scripts of X2Go extensions test -d "${X2GO_SHARE_PATH}/x2gofeature.d" && { for subscript in "${X2GO_SHARE_PATH}/x2gofeature.d/"*.features; do cat "${subscript}" | grep -E '.*\).*ok.*exit 0.*' | cut -d '"' -f '2' | cut -d '"' -f '1' done } x2goserver-4.1.0.3/x2goserver/bin/x2gogetapps0000755000000000000000000001340613377671145015742 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use MIME::Base64 qw(encode_base64); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my @iconext=("png","svg","jpeg","jpg","xpm","bmp"); my @icondirs=( "/usr/share/icons/hicolor/22x22/apps", "/usr/share/icons/hicolor/24x24/apps", "/usr/share/icons/hicolor/32x32/apps", "/usr/share/icons/hicolor/36x36/apps", "/usr/share/icons/hicolor/48x48/apps", "/usr/share/icons/hicolor/64x64/apps", "/usr/share/icons/hicolor/72x72/apps", "/usr/share/icons/hicolor/96x96/apps", "/usr/share/icons/hicolor/128x128/apps", "/usr/share/icons/hicolor/256x256/apps", "/usr/share/icons/hicolor/scalable/apps", "/usr/share/pixmaps", "/usr/share/icons/default.kde/22x22/apps", "/usr/share/icons/default.kde/24x24/apps", "/usr/share/icons/default.kde/32x32/apps", "/usr/share/icons/default.kde/36x36/apps", "/usr/share/icons/default.kde/48x48/apps", "/usr/share/icons/default.kde/64x64/apps", "/usr/share/icons/default.kde/72x72/apps", "/usr/share/icons/default.kde/96x96/apps", "/usr/share/icons/default.kde/128x128/apps", "/usr/share/icons/default.kde/256x256/apps", "/usr/share/icons/default.kde4/22x22/apps", "/usr/share/icons/default.kde4/24x24/apps", "/usr/share/icons/default.kde4/32x32/apps", "/usr/share/icons/default.kde4/36x36/apps", "/usr/share/icons/default.kde4/48x48/apps", "/usr/share/icons/default.kde4/64x64/apps", "/usr/share/icons/default.kde4/72x72/apps", "/usr/share/icons/default.kde4/96x96/apps", "/usr/share/icons/default.kde4/128x128/apps", "/usr/share/icons/default.kde4/256x256/apps" ); sub findicon { my $file=shift; foreach(@iconext) { my $icon=findicon_ext("$file.$_"); if( $icon ne "" ) { return "$icon"; } } return ""; } sub findicon_ext { my $file=shift; foreach(@icondirs) { if( -e "$_/$file" ) { return "$_/$file"; } } return ""; } sub geticon { my $file=shift; my @ret; if (open(I,"<$file")) { my $buf; push(@ret, ""); while (read(I, $buf, 60*57)) { push(@ret, encode_base64($buf)); } push(@ret, ""); close(I); } else { syslog ('info', "x2gogetapps:geticon - can't open file $file: $!"); } return @ret; } sub proc_desktop_file { my $file=shift; if (open(F,"<$file")) { my @output; my $nodisplay = 0; my $is_desktop_entry = 0; push(@output, ""); READ_FILE: while(!eof(F)) { my $line=; # Hopefully strip most whitespace and newlines surrounding $line. chomp($line); # Desktop Entry block search. if ( $line=~m/^\[Desktop Entry\] */ ) { $is_desktop_entry = 1; next; } # Consume random data. if ( ! $is_desktop_entry ) { next; } # Stop reading when seeing a non-Desktop Entry block. if ( $line=~m/^\[.*\] */ ) { $is_desktop_entry = 0; last READ_FILE; } # Breaking out when finding NoDisplay=true or Hidden=true. # Do not use \s here as newlines are not allowed within key-value sets. # Generally, we're reading lines anyway and a newline can't possibly be part of # a line, as lines are split on newlines, but play it safe still. if ( $line=~m/^NoDisplay[ \t]*?=[ \t]*?true/ || $line=~m/^Hidden[ \t]*?=[ \t]*?true/ ) { $nodisplay = 1; last READ_FILE; } if ( $line=~m/^Categories/i || $line=~m/^Name/i || $line=~m/^Terminal/i || $line=~m/^Comment/i || $line=~m/^Exec/i) { push(@output, $line); } if ( $line =~ m/^Icon/ ) { my $icon=$line; $icon =~ s/Icon[ \t]*?=//; #$line is not absolute path if(!($icon =~ m/\//)) { #$line have format ext. if ($line =~ m/\./) { $icon=findicon_ext($icon); } else { $icon=findicon($icon); } } @output = (@output, geticon($icon)); } } close (F); push(@output, ""); # Print out parsed entry if it's not hidden or marked NoDisplay. if (! $nodisplay) { print join("\n", @output); print "\n"; } } else { syslog ('info', "x2gogetapps:proc_desktop_file - can't open file $file: $!"); } } if ( @ARGV ) { syslog('info', "x2gogetapps has been called with options: @ARGV"); } else { syslog('info', "x2gogetapps has been called without options"); } my $file; my @dirs; @dirs[0]="/etc/x2go/applications"; my ($name, $pass, $uid, $gid, $quota, $comment, $gcos, $homedir, $shell, $expire) = getpwnam(getlogin || getpwuid($<)); @dirs[1]="/etc/x2go/applications-per-user/$name"; @dirs[2]="$homedir/.x2go/applications"; foreach(@dirs) { my $basedir=$_; opendir my $basedh, $basedir; for my $dirname (grep {-d "$basedir/$_" && ! /^\.{2}$/} readdir($basedh)) { if( opendir(DIR, "$basedir/$dirname")) { while (defined($file = readdir(DIR))) { if($file =~ m/.desktop/) { proc_desktop_file("$basedir/$dirname/$file"); } } closedir(DIR); } else { syslog ('info', "x2gogetapps - can't opendir $basedir/$dirname: $!"); } } } # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/bin/x2gogetservers0000755000000000000000000000230313377671145016462 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_getservers); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $servers = join("\n", db_getservers); print $servers; # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/bin/x2golistdesktops0000755000000000000000000000614213377671145017026 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Hostname; use Sys::Syslog qw( :standard :macros ); use X2Go::Log qw( loglevel ); use X2Go::Utils qw( system_capture_stdout_output ); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); if ( @ARGV ) { syslog('info', "x2golistdesktops has been called with options: @ARGV"); } else { syslog('info', "x2golistdesktops has been called without options"); } if ((hostname eq '(none)') || (hostname eq 'localhost')) { die "Hostname of X2Go Server not set-up correctly, check /etc/hostname. Exiting..." } my $serv=shift; if( ! $serv) { $serv=hostname; } # FIXME: finally get rid of this non-critical backtick expression my $rsess=`timeout 1s x2golistsessions x2goserver |grep _stR`; my @rsess=split("\n","$rsess"); my @rdisplays; for (my $i=0;$i<@rsess;$i++) { my @sinfo=split("\\|",@rsess[$i]); @rdisplays[$i]=@sinfo[2]; } my $rdisp=join("I",@rdisplays); $rdisp="I${rdisp}I"; my $uname=$ENV{'USER'}; # on Debian the ss command is in /usr/bin, on Fedora, it is in /usr/sbin... # -> so we need to tweak the PATH env var a little here... my $old_PATH=$ENV{'PATH'}; $ENV{'PATH'}="$ENV{'PATH'}:/usr/sbin:/sbin"; my $lines=system_capture_stdout_output("ss", "-lx"); $ENV{'PATH'}=$old_PATH; undef $old_PATH; my @lines=split("\n", "$lines"); my @outp = grep ( /(@| )\/tmp\/.X11-unix\/X.*/, @lines); my @displays; for(my $i=0;$i<@outp;$i++) { my $display=@outp[$i]; $display=~s|.*/tmp/.X11-unix/X([0-9]*).*|:$1|; my $checkdisp=$display; $checkdisp=~s/:/I/; $checkdisp="${checkdisp}I"; if (!( $rdisp =~ m/$checkdisp/ )) { if ( grep { $_ eq "$uname\@$display" } @displays ) { } else { my $inf=system_capture_stdout_output("timeout", "1s", "xwininfo", "-root", "-display", "$display"); if ( $inf=~ m/geometry/) { push (@displays, "$uname\@$display"); } } } } my $outp=`ls -1 /tmp/ | grep x2godesktopsharing_\@*\@:*`; @outp=split("\n","$outp"); for(my $i=0;$i<@outp;$i++) { if (( -r "/tmp/@outp[$i]" ) and ( -w "/tmp/@outp[$i]" )) { my @ln=split("\@",@outp[$i]); if ( @ln[1] ne $uname ) { push (@displays, "@ln[1]\@@ln[2]"); } } } for(my $i=0;$i<@displays;$i++) { if ( @displays[$i] ) { print "@displays[$i]\n"; } } # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/bin/x2golistmounts0000755000000000000000000000245613377671145016523 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_getmounts); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $session_id=shift || $ENV{'X2GO_SESSION'} or die "no valid session name that we can use"; my $mounts = join("\n", db_getmounts($session_id)); print "$mounts\n"; # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/bin/x2golistsessions0000755000000000000000000000520613377671145017040 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Hostname; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_listsessions db_listsessions_all db_changestatus); use X2Go::Server::Agent qw(session_is_suspended session_is_running has_agent_state_file); use X2Go::Log qw(loglevel); use X2Go::Utils qw( system_capture_stdout_output is_true ); my $x2go_lib_path = system_capture_stdout_output("x2gopath", "libexec"); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); if ( @ARGV ) { syslog('info', "x2golistsessions has been called with options: @ARGV"); } else { # hiding normal x2golistsessions calls into debug loglevel syslog('debug', "x2golistsessions has been called with no option"); } if ((hostname eq '(none)') || (hostname eq 'localhost')) { die "Hostname of X2Go Server is not set-up correctly, check /etc/hostname. Exiting..." } my $serv=shift; if( ! $serv) { $serv=hostname; } my @outp; if($serv eq "--all-servers") { @outp=db_listsessions_all(); } else { @outp=db_listsessions($serv); } for (my $i=0;$i<@outp;$i++) { @outp[$i] =~ s/ //g; @outp[$i] =~ s/\*/ /g; my @sinfo=split('\\|',"@outp[$i]"); if (@sinfo[4]eq 'F') { print "@outp[$i]\n"; } else { if (has_agent_state_file(@sinfo[1], @sinfo[11])) { if (@sinfo[4]eq 'R') { if(session_is_suspended(@sinfo[1], @sinfo[11])) { db_changestatus( 'S', @sinfo[1]); @outp[$i] =~ s/\|R\|/\|S\|/; system("x2goumount-session", "@sinfo[1]"); system("$x2go_lib_path/x2gormforward", "@sinfo[1]"); } } elsif (@sinfo[4]eq 'S') { if(session_is_running(@sinfo[1], @sinfo[11])) { db_changestatus( 'R', @sinfo[1] ); @outp[$i] =~ s/\|S\|/\|R\|/; } } } print "@outp[$i]\n"; } } # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/bin/x2golistshadowsessions0000755000000000000000000000420613377671145020245 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Hostname; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_listshadowsessions db_listshadowsessions_all); use X2Go::Server::Agent qw(session_is_suspended); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); if ( @ARGV ) { syslog('info', "x2golistshadowsessions has been called with options: @ARGV"); } else { # hiding normal x2golistshadowsessions calls into debug loglevel syslog('debug', "x2golistshadowsessions has been called with no option"); } my $serv=shift; if( ! $serv) { $serv=hostname; } my @outp; if($serv eq "--all-servers") { @outp=db_listshadowsessions_all(); } else { @outp=db_listshadowsessions($serv); } for (my $i=0;$i<@outp;$i++) { @outp[$i] =~ s/ //g; @outp[$i] =~ s/\*/ /g; my @sinfo=split('\\|',"@outp[$i]"); if (@sinfo[4]eq 'F') { print "@outp[$i]\n"; } else { if (@sinfo[4]eq 'R') { my $shadow_user = @sinfo[1]; $shadow_user =~ s/.*XSHAD(.*)XSHADPP.*/$1/; if(session_is_suspended(@sinfo[1], $shadow_user)) { db_changestatus( 'S', @sinfo[1] ); @outp[$i] =~ s/\|R\|/\|S\|/; system("x2goumount-session","@sinfo[1]"); } } print "@outp[$i]\n"; } } # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/bin/x2gomountdirs0000755000000000000000000002172313377671145016324 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use File::BaseDir qw( xdg_config_home ); use File::Which; use X2Go::Config qw( get_config ); use X2Go::Server::DB qw( db_insertmount db_deletemount ); use X2Go::Utils qw( source_environment system_capture_merged_output ); use X2Go::Log qw( loglevel ); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); syslog('info', "x2gomountdirs has been called with options: @ARGV"); my $msg; if (! which ("sshfs") ) { $msg = "the sshfs command is not installed on this X2Go Server, cannot share client-side folders"; syslog('warning', "WARNING: $msg"); print "$msg\n"; # closing syslog closelog; exit 0; } my $tmp_dir = '/tmp'; my $type=shift; my $session=shift; my $user=shift; my $key=shift; my @dl; my $i=0; @dl[$i]=shift; while(@dl[$i]) { $i++; @dl[$i]=shift; } my $dirlist=join(" ",@dl); chop($dirlist); my $reverse=0; my $port="22"; print "dirs:$dirlist\n"; if ($dirlist =~ m/__REVERSESSH_PORT__/) { @dl=split("__REVERSESSH_PORT__","$dirlist"); $dirlist=@dl[0]; $port=@dl[1]; $reverse=1; } if ($dirlist =~ m/__SSH_PORT__/) { @dl=split("__SSH_PORT__","$dirlist"); $dirlist=@dl[0]; $port=@dl[1]; } print "ssh port:$port\n"; my $host; if($reverse == 0) { $host=(split(" ",$ENV{'SSH_CLIENT'}))[0]; } else { $host='127.0.0.1'; } print "Host:$host\n"; print "User:$user\n"; open (F,"<$key"); my @lines=; close(F); my $lines=join("",@lines); my $dsa_key=(split("----BEGIN RSA IDENTITY----",$lines))[0]; my $rsa_identity=(split("----BEGIN RSA IDENTITY----",$lines))[1]; open (F,">$key"); print F $dsa_key; close(F); open (F,">$key.ident"); print F "\[$host\]:$port $rsa_identity"; close(F); chmod(0600,"$key"); chmod(0600,"$key.ident"); my $mdir="$tmp_dir/.x2go-$ENV{'USER'}/media"; my $ldir="$ENV{'HOME'}/media"; my $sessiondir="$ENV{'HOME'}/.x2go/C-$session"; my $spooldir_lnk="$sessiondir/spool"; my $spooldir="$tmp_dir/.x2go-$ENV{'USER'}/spool"; my $mimeboxdir_lnk="$sessiondir/mimebox"; my $mimeboxdir="$tmp_dir/.x2go-$ENV{'USER'}/mimebox"; source_environment(xdg_config_home() . "/user-dirs.dirs"); if (! -e $mdir) { mkdir($mdir); } chmod(0700,$mdir); if (! -e "$mdir/disk") { mkdir("$mdir/disk"); } chmod(0700,"$mdir/disk"); if (! -e "$mdir/cd") { mkdir("$mdir/cd"); } chmod(0700,"$mdir/cd"); if (! -e "$mdir/rm") { mkdir("$mdir/rm"); } chmod(0700,"$mdir/rm"); my $plasmstamp=$mdir."/".$session.".plasmoid"; if (! -e $spooldir) { mkdir($spooldir); } chmod(0700,$spooldir); $spooldir="$spooldir/C-$session"; if (! -e $spooldir) { mkdir($spooldir); } chmod(0700,$spooldir); if (! -e $mimeboxdir) { mkdir($mimeboxdir); } chmod(0700,$mimeboxdir); $mimeboxdir="$mimeboxdir/C-$session"; if (! -e $mimeboxdir) { mkdir($mimeboxdir); } chmod(0700,$mimeboxdir); if ( -d $ldir) { rmdir($ldir); } if ( ! -l $ldir) { system ("ln", "-s", "$mdir", "$ldir"); } if ( -d $spooldir_lnk) { rmdir($spooldir_lnk); } if ( ! -l $spooldir_lnk) { system ("ln", "-s", "$spooldir", "$spooldir_lnk"); } if ( -d $mimeboxdir_lnk) { rmdir($mimeboxdir_lnk); } if ( ! -l $mimeboxdir_lnk) { system ("ln", "-s", "$mimeboxdir", "$mimeboxdir_lnk"); } my $uname=$ENV{'USER'}; my @dirs=split(':',$dirlist); for (my $i=0;$i<@dirs;$i++) { my $printspool=0; my $mimeboxspool=0; my $mntpath; my $this_mdir = $mdir; if(@dirs[$i]=~m/__PRINT_SPOOL_/) { @dirs[$i]=~s/__PRINT_SPOOL_//; $printspool=1; $mntpath=$spooldir; syslog('debug', "mounting $spooldir, mount point type is print spool directory"); } elsif(@dirs[$i]=~m/__MIMEBOX_SPOOL_/) { @dirs[$i]=~s/__MIMEBOX_SPOOL_//; $mimeboxspool=1; $mntpath=$mimeboxdir; syslog('debug', "mounting $mimeboxdir, mount point type is MIME box directory"); } else { my $p=@dirs[$i]; if ($type ne "dir") { $p=~s/\/ramdrive\/mnt\///; if ($p =~ m/CDROM/) { $this_mdir=$this_mdir."/cd"; } else { $this_mdir=$this_mdir."/rm"; } } else { $this_mdir=$this_mdir."/disk"; } $p=~s/\//_/g; $p=~s/ /_/g; $p=~s/~_cygdrive_//; $p=~s/~_windrive_//; $p=~s/~_uncpath_//; $p=~s/~//g; mkdir("$this_mdir/$p"); $mntpath="$this_mdir/$p"; } if (db_insertmount( $session, $mntpath, $host)) { syslog('debug', "insertion of shared folder into session DB has been successful"); my $Config = get_config(); my $umask=$Config->param("security.umask"); my $umaskstr=""; if ($umask ne "") { $umaskstr="umask=$umask"; } else { $umaskstr="default_permissions"; } my $code_conv=$ENV{'X2GO_ICONV'}; if ($code_conv ne "") { $code_conv="-o $code_conv"; } if ( -f "$key" ) { syslog('debug', "SSH key file has arrived: $key"); } if ( -f "$key.ident" ) { syslog('debug', "SSH host key has arrived: $key.ident"); } $msg = "timeout 30 sshfs $code_conv -o idmap=user,uid=`id -u`,gid=`id -g`,$umaskstr,ServerAliveInterval=300,IdentityFile=$key,UserKnownHostsFile=$key.ident \"$user\"\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port"; syslog('debug', "executing: $msg"); print "inserted, $msg\n"; # FIXME: this system call should be converted to a multi-argument system call while pertaining the redirect of stderr to the mounts.log file if (system("timeout 30 sshfs $code_conv -o idmap=user,uid=`id -u`,gid=`id -g`,$umaskstr,ServerAliveInterval=300,IdentityFile=$key,UserKnownHostsFile=$key.ident \"$user\"\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port 1>>$sessiondir/sshfs-mounts.log 2>&1")==0) { print "mount @dirs[$i] ok\n"; syslog('notice', "successfully mounted $user\@$host:$port@dirs[$i] to $mntpath"); # check if kde4 plasmoid running my $useplasmoid=0; if ( -e $plasmstamp ) { open(STMP,"<$plasmstamp"); my $stamp=; close (STMP); if (abs($stamp-time())<15) { $useplasmoid=1; } } if (! $printspool && ! $mimeboxspool && ! $useplasmoid ) { my $fname; if ( $ENV{'XDG_DESKTOP_DIR'} ) { $fname=$ENV{'XDG_DESKTOP_DIR'}; } else { $fname="$ENV{'HOME'}/Desktop"; } my $current_desktop = "NONE"; if (($session =~ m/_stDGNOME_dp/) && system_capture_merged_output("x2gofeature", "X2GO_GNOMEBINDINGS") == 0) { $current_desktop="-gnome"; } elsif (($session =~ m/_stDMATE_dp/) && system_capture_merged_output("x2gofeature", "X2GO_MATEBINDINGS") == 0) { $current_desktop="-mate"; } elsif (($session =~ m/_stDLXDE_dp/) && system_capture_merged_output("x2gofeature", "X2GO_LXDEBINDINGS") == 0) { $current_desktop="-lxde"; } elsif (($session =~ m/_stD.*_dp/) && system_capture_merged_output("x2gofeature", "X2GO_FMBINDINGS") == 0) { $current_desktop=""; } my $p=@dirs[$i]; $p=~s/\/cygdrive\///; $p=~s/\/windrive\///; $p=~s/\/uncpath\///; $p=~s/ /_/g; $p=~s/\//_/g; $fname="$fname/$p"; if ("$current_desktop" ne "NONE") { if ($type eq "dir") { $fname="$fname\ (sshfs-disk$current_desktop)"; syslog('info', "creating desktop icon for ,,@dirs[$i]'' at ,,$fname'', media type is: client-side folder on harddrive"); } else { if ($fname =~ m/CDROM/) { $fname="$fname\ (sshfs-cdrom$current_desktop)"; syslog('info', "creating desktop icon for ,,@dirs[$i]'' at ,,$fname'', media type is: optical disc"); } else { $fname="$fname\ (sshfs-removable$current_desktop)"; syslog('info', "creating desktop icon for ,,@dirs[$i]'' at ,,$fname'', media type is: removable device"); } $fname=~s/_ramdrive_mnt_//; } print "fname: $fname\n"; open(F,">$fname"); print F "$mntpath\n$session\n\n\0"; close(F); } } } else { $msg = "mounting of @dirs[$i] failed"; print STDERR "$msg\n"; syslog('warning', "WARNING: $msg"); db_deletemount( $session, $mntpath); # it maybe possible that the sshfs mount is already registered with the # kernel, but dysfunctional. Attempting removal... system("fusermount", "-u", "$mntpath"); rmdir($mntpath); } } else { $msg = "insertion of @dirs[$i] failed (already mounted?), not mounting"; syslog('warning', "WARNING: $msg"); print STDERR "$msg\n"; } } unlink($key); unlink("$key.ident"); # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/bin/x2gopath0000755000000000000000000000303213377671145015225 0ustar #!/bin/sh # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2012-2018 Oleksandr Shneyder # Copyright (C) 2012-2018 Heinz-Markus Graesing # Copyright (C) 2012-2015 Mike Gabriel # Copyright (C) 2012-2015 Jan Engelhard # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. base="${0%/*}"; if test "$base" = "$0"; then base="."; fi; base=$(readlink -f "$base/.."); # The following section is subject to substitution by distro packaging tools. case "$1" in "base") printf '%s' "$base";; "lib") printf '%s' "$base/lib/x2go";; "libexec") printf '%s' "$base/lib/x2go";; "share") printf '%s' "$base/share/x2go";; "nx-x11") printf '%s' "$base/lib/nx/X11";; "xinerama") printf '%s' "$base/lib/nx/X11/Xinerama";; *) exit 1;; esac; if test -t 1; then echo ""; fi; x2goserver-4.1.0.3/x2goserver/bin/x2goresume-session0000755000000000000000000003365013377671145017263 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. X2GO_LIB_PATH="$(x2gopath 'libexec')" if [[ "${#}" -lt '7' ]]; then typeset msg='not enough command line arguments' echo "${msg}" >&2 "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" exit '1' fi SESSION_NAME="${1}" X2GO_GEOMETRY="${2}" X2GO_LINK="${3}" X2GO_PACK="${4}" #X2GO_KBD_LAYOUT="${5}" X2GO_KBD_TYPE="${6}" X2GO_SET_KBD="${7}" X2GO_CLIPBOARD="${8}" typeset X2GO_XINERAMA="${9}" X2GO_AGENT_PID="$("${X2GO_LIB_PATH}/x2gogetagent" "${SESSION_NAME}")" X2GO_ROOT="${HOME}/.x2go" X2GO_RESIZE='1' X2GO_FULLSCREEN='0' # ${HOSTNAME} should be automatically set by bash via gethostname(2), IFF this # variable is not already set in the environment. # # This leads to two problems: # - export HOSTNAME="malbox"; x2gostartagent will override the actual system # host name and lead to authorization failures when connecting to # x2goagent/nxagent later on. # - even if the above is not the case, we want to be sure to get the actual # system host name. # # Workaround: use hostname. typeset current_host_name='' if ! current_host_name="$(hostname)"; then typeset msg="Unable to retrieve machine's hostname. This is required. Aborting session startup." "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" # Make x2goclient fail. echo "${msg}" >&2 exit '2' fi # refresh up ssh-agent-forwarding socket file symlink X2GOSSH_AUTH_SOCK="${X2GO_ROOT}/C-${SESSION_NAME}/ssh-agent.PID" if [[ -L "${X2GOSSH_AUTH_SOCK}" ]]; then rm -f -- "${X2GOSSH_AUTH_SOCK}" fi if [[ -S "${SSH_AUTH_SOCK}" ]]; then ln -sf -- "${SSH_AUTH_SOCK}" "${X2GOSSH_AUTH_SOCK}" fi STATE="$("${X2GO_LIB_PATH}/x2gogetagentstate" "${SESSION_NAME}")" # exit if session terminated if [[ "${STATE}" = 'TERMINATED' ]] || [[ "${STATE}" = 'TERMINATING' ]]; then typeset msg="session ${SESSION_NAME} terminated" echo "${msg}" >&2 "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" exit '3' fi typeset -i i='0' # wait 15 sec. for starting session while [[ "${STATE}" = 'RESUMING' ]] || [[ "${STATE}" = 'STARTING' ]]; do sleep '1' ((++i)) #if session still not started, try to suspend it if [[ "${i}" -gt '15' ]]; then x2gosuspend-session "${SESSION_NAME}" sleep '2' i='0' fi STATE="$("${X2GO_LIB_PATH}/x2gogetagentstate" "${SESSION_NAME}")" done #suspend running session if [[ "${STATE}" = 'RUNNING' ]]; then x2gosuspend-session "${SESSION_NAME}" sleep '2' STATE="$("${X2GO_LIB_PATH}/x2gogetagentstate" "${SESSION_NAME}")" fi i='0' # wait 45 sec., while session suspending while [[ "${STATE}" = 'SUSPENDING' ]]; do sleep '1' ((++i)) if [[ "${i}" -gt '45' ]]; then msg='it is taking too long to suspend the session-to-be-resumed; it is possible that the session is in a damaged state' echo "${msg}" >&2 "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" exit '4' fi STATE="$("${X2GO_LIB_PATH}/x2gogetagentstate" "${SESSION_NAME}")" done "${X2GO_LIB_PATH}/x2gormforward" "${SESSION_NAME}" "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "$(basename "${0}") called with options: ${*}" X2GO_TELEKINESIS_ENABLED="$(perl -e 'use X2Go::Config qw( get_config ); use X2Go::Utils qw( is_true ); my $Config= get_config(); print is_true($Config->param("telekinesis.enable"));')" # rootless sessions of geometry fullscreen are invalid if [[ "${X2GO_GEOMETRY}" = 'fullscreen' ]] && [[ "${SESSION_TYPE}" = 'R' ]]; then X2GO_GEOMETRY='' fi # no geometry for desktop sessions shall result in fullscreen desktop sessions if [[ -z "${X2GO_GEOMETRY}" ]] && [[ "${SESSION_TYPE}" = 'D' ]]; then X2GO_GEOMETRY="fullscreen" fi if [[ "${X2GO_GEOMETRY}" = 'fullscreen' ]]; then X2GO_FULLSCREEN='1' fi SESSIONINFO="$(x2golistsessions | grep "${SESSION_NAME}" | sed 's/|/,/g')" GR_PORT="$(awk -F ',' '{print $9}' <<< "${SESSIONINFO}")" SOUND_PORT="$(awk -F ',' '{print $10}' <<< "${SESSIONINFO}")" FS_PORT="$(awk -F ',' '{print $14}' <<< "${SESSIONINFO}")" #SERVER="$(awk -F ',' '{print $4}' <<< "${SESSIONINFO}")" "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "old ports: ${GR_PORT}, ${SOUND_PORT}, ${FS_PORT}" typeset X2GO_INTERNAL_SOURCE='1' # Make shellcheck happy. : "${X2GO_INTERNAL_SOURCE}" . "${X2GO_LIB_PATH}/x2gocheckport" unset X2GO_INTERNAL_SOURCE # define the full path to the ss utility typeset ss="$(PATH="${PATH}:/usr/sbin:/sbin" type -P 'ss')" #check if saved in DB ports free if ! check_system_port "${ss}" "${GR_PORT}"; then "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "port ${GR_PORT} is already in use" "${X2GO_LIB_PATH}/x2gormport" "${current_host_name}" "${SESSION_NAME}" "${GR_PORT}" GR_PORT='' fi if ! check_system_port "${ss}" "${SOUND_PORT}"; then "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "port ${SOUND_PORT} is already in use" "${X2GO_LIB_PATH}/x2gormport" "${current_host_name}" "${SESSION_NAME}" "${SOUND_PORT}" SOUND_PORT='' fi if ! check_system_port "${ss}" "${FS_PORT}"; then "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "port ${FS_PORT} is already in use" "${X2GO_LIB_PATH}/x2gormport" "${current_host_name}" "${SESSION_NAME}" "${FS_PORT}" FS_PORT='' fi if [[ "${X2GO_TELEKINESIS_ENABLED}" = '1' ]]; then TEKICTRL_PORT="$(awk -F ',' '{print $15}' <<< "${SESSIONINFO}")" TEKIDATA_PORT="$(awk -F ',' '{print $16}' <<< "${SESSIONINFO}")" if ! check_system_port "${ss}" "${TEKICTRL_PORT}"; then "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "port ${TEKICTRL_PORT} is already in use" "${X2GO_LIB_PATH}/x2gormport" "${current_host_name}" "${SESSION_NAME}" "${TEKICTRL_PORT}" TEKICTRL_PORT='' fi if ! check_system_port "${ss}" "${TEKIDATA_PORT}"; then "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "port ${TEKIDATA_PORT} is already in use" "${X2GO_LIB_PATH}/x2gormport" "${current_host_name}" "${SESSION_NAME}" "${TEKIDATA_PORT}" TEKIDATA_PORT='' fi else "${X2GO_LIB_PATH}/x2gormport" "${current_host_name}" "${SESSION_NAME}" "${TEKICTRL_PORT}" "${X2GO_LIB_PATH}/x2gormport" "${current_host_name}" "${SESSION_NAME}" "${TEKIDATA_PORT}" TEKICTRL_PORT='0' TEKIDATA_PORT='0' fi if ! SSH_PORT="$("${X2GO_LIB_PATH}/x2gogetrandomport")"; then typeset msg="Unable to get (pseudo-)randomized starting port value." "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" # Make x2goclient fail. echo "${msg}" >&2 exit '5' fi typeset -i retry='0' typeset -i max_retry='10' typeset -i free_port='0' typeset output='' while [[ -z "${GR_PORT}" ]] || [[ -z "${SOUND_PORT}" ]] || [[ -z "${FS_PORT}" ]] || [[ -z "${TEKICTRL_PORT}" ]] || [[ -z "${TEKIDATA_PORT}" ]]; do output='' for ((retry = 0; retry < max_retry; ++retry)); do free_port='0' if free_port="$("${X2GO_LIB_PATH}/x2gogetfreeport" "${current_host_name}" "${ss}" 'lowlevel' "${SSH_PORT}")"; then SSH_PORT="${free_port}" output="$("${X2GO_LIB_PATH}/x2goinsertport" "${current_host_name}" "${SESSION_NAME}" "${SSH_PORT}")" if [[ "${output}" = 'inserted' ]]; then break else "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'warning' "unable to insert port into database. Retrying (run $((retry + 1)))." fi else "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'warning' "no free port available, cannot start new session. Retrying (run $((retry + 1)))." fi done if [[ "${output}" != 'inserted' ]]; then typeset msg="Unable to find free port or insert new session into database; parameters: hostname (${current_host_name}), session name (${SESSION_NAME}) and port (${SSH_PORT})." "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" # Make x2goclient fail. echo "${msg}" >&2 exit '6' fi if [[ -z "${GR_PORT}" ]]; then GR_PORT="${SSH_PORT}" elif [[ -z "${SOUND_PORT}" ]]; then SOUND_PORT="${SSH_PORT}" elif [[ -z "${FS_PORT}" ]]; then FS_PORT="${SSH_PORT}" elif [[ -z "${TEKICTRL_PORT}" ]]; then TEKICTRL_PORT="${SSH_PORT}" elif [[ -z "${TEKIDATA_PORT}" ]]; then TEKIDATA_PORT="${SSH_PORT}" fi done SESSION_DIR="${X2GO_ROOT}/C-${SESSION_NAME}" OPTIONS="$(< "${SESSION_DIR}/options")" LSTR="$(awk -F ',' '{print $2}' <<< "${OPTIONS}")" PSTR="$(awk -F ',' '{print $3}' <<< "${OPTIONS}")" KTSTR="$(awk -F ',' '{print $12}' <<< "${OPTIONS}")" GSTR="$(awk -F ',' '{print $13}' <<< "${OPTIONS}")" typeset xinerama_orig='' test_GSTR="$(sed -e 's/geometry=.*//' <<< "${GSTR}")" if [[ -n "${test_GSTR}" ]]; then GSTR='geometry=' xinerama_orig="$(awk -F ',' '{print $13}' <<< "${OPTIONS}")" else xinerama_orig="$(awk -F ',' '{print $14}' <<< "${OPTIONS}")" fi # Sessions started with older X2Go Server versions do not feature # a xinerama option, so handle this gracefully. # Note that Xinerama support defaulted to on and was handled by the client, # so keep it like that. typeset test_xinerama="$(sed -e 's/xinerama=.*//' <<< "${xinerama_orig}")" if [[ -n "${test_xinerama}" ]]; then # Will not actually be replaced by anything, so the value provided # here does not matter. xinerama_orig='xinerama=1' fi # Only one component missing => either geometry or xinerama at position 13, # everything else starts from position 14. if { [[ -n "${test_GSTR}" ]] && [[ -z "${test_xinerama}" ]]; } || { [[ -z "${test_GSTR}" ]] && [[ -n "${test_xinerama}" ]]; }; then RSTR="$(awk -F ',' '{print $14}' <<< "${OPTIONS}")" FSTR="$(awk -F ',' '{print $15}' <<< "${OPTIONS}")" LISTSTR="$(awk -F ',' '{print $17}' <<< "${OPTIONS}")" CLIPBOARD="$(awk -F ',' '{print $18}' <<< "${OPTIONS}")" # Neither geometry nor xinerama given, everything else starts at position 13. elif [[ -n "${test_GSTR}" ]]; then RSTR="$(awk -F ',' '{print $13}' <<< "${OPTIONS}")" FSTR="$(awk -F ',' '{print $14}' <<< "${OPTIONS}")" LISTSTR="$(awk -F ',' '{print $16}' <<< "${OPTIONS}")" CLIPBOARD="$(awk -F ',' '{print $17}' <<< "${OPTIONS}")" # Both geometry and xinerama given, everything else starts at position 15. else RSTR="$(awk -F ',' '{print $15}' <<< "${OPTIONS}")" FSTR="$(awk -F ',' '{print $16}' <<< "${OPTIONS}")" LISTSTR="$(awk -F ',' '{print $18}' <<< "${OPTIONS}")" CLIPBOARD="$(awk -F ',' '{print $19}' <<< "${OPTIONS}")" fi KTSTR="$(sed -e 's#/#\\/#' <<< "${KTSTR}")" X2GO_KBD_TYPE="$(sed -e 's#/#\\/#' <<< "${X2GO_KBD_TYPE}")" if [[ "${X2GO_SET_KBD}" = '0' ]] || [[ "${X2GO_KBD_TYPE}" = 'auto' ]]; then keyboard_type='null\/null' else keyboard_type="${X2GO_KBD_TYPE}" fi typeset tmp_regex='^(0|none|client|server|both|1)$' if [[ -n "${X2GO_CLIPBOARD}" ]] && [[ "${X2GO_CLIPBOARD}" =~ ${tmp_regex} ]]; then clipboard="clipboard=${X2GO_CLIPBOARD}" else clipboard='clipboard=both' fi typeset xinerama_option="$("${X2GO_LIB_PATH}/x2goistrue" "${X2GO_XINERAMA}")" NEWOPTIONS="$(sed -e "s/${LSTR}/link=${X2GO_LINK}/" \ -e "s/${PSTR}/pack=${X2GO_PACK}/" \ -e "s/${KTSTR}/kbtype=${keyboard_type}/" \ -e "s/${GSTR}/geometry=${X2GO_GEOMETRY}/" \ -e "s/${xinerama_orig}/xinerama=${xinerama_option}/" \ -e "s/${RSTR}/resize=${X2GO_RESIZE}/" \ -e "s/${LISTSTR}/listen=${GR_PORT}/" \ -e "s/${FSTR}/fullscreen=${X2GO_FULLSCREEN}/" \ -e "s/${CLIPBOARD}/${clipboard}/" <<< "${OPTIONS}")" if [[ -z "${X2GO_GEOMETRY}" ]] || [[ "${X2GO_GEOMETRY}" = 'fullscreen' ]]; then NEWOPTIONS="$(sed -e "s/geometry=${X2GO_GEOMETRY},//" <<< "${NEWOPTIONS}")" fi X2GO_CLIENT="$(awk '{print $1}' <<< "${SSH_CLIENT}")" if [[ -z "${X2GO_CLIENT}" ]]; then X2GO_CLIENT="${current_host_name}" fi echo "${NEWOPTIONS}" >"${SESSION_DIR}/options" # run x2goserver-extensions for pre-resume x2gofeature 'X2GO_RUN_EXTENSIONS' &>'/dev/null' && x2goserver-run-extensions "${SESSION_NAME}" 'pre-resume' || true # clear old keyboard file rm -Rf "${SESSION_DIR}/keyboard" if kill -HUP "${X2GO_AGENT_PID}" &>'/dev/null'; then "${X2GO_LIB_PATH}/x2goresume" "${X2GO_CLIENT}" "${SESSION_NAME}" "${GR_PORT}" "${SOUND_PORT}" "${FS_PORT}" >'/dev/null' "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'notice' "client ${X2GO_CLIENT} has successfully resumed session with ID ${SESSION_NAME}" # set client-side keyboard model, type, variant, etc. if [[ "${X2GO_SET_KBD}" != '0' ]] && [[ "${X2GO_KBD_TYPE}" = 'auto' ]]; then X2GO_DISPLAY="$(cut -d '-' -f '2' <<< "${SESSION_NAME}")" export DISPLAY=":${X2GO_DISPLAY}.0" x2gosetkeyboard "${SESSION_NAME}" &>'/dev/null' & fi # resume x2godesktopsharing, if it has been in use before the session got suspended x2gofeature 'X2GO_DESKTOPSHARING' &>'/dev/null' && x2goresume-desktopsharing "${SESSION_NAME}" || true # run x2goserver-extensions for post-resume x2gofeature 'X2GO_RUN_EXTENSIONS' &>'/dev/null' && x2goserver-run-extensions "${SESSION_NAME}" 'post-resume' || true grep 'PPid' "/proc/${PPID}/status" >"${X2GO_ROOT}/C-${SESSION_NAME}/sshd.pid" else err_msg="ERROR: failed to resume session with ID ${SESSION_NAME}" echo "${err_msg}" 1>&2 "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${err_msg}" # If we reach here it means that the x2goagent process of the session has vanished # If this happens than we mark the session as finished... "${X2GO_LIB_PATH}/x2gochangestatus" 'F' "${SESSION_NAME}" >'/dev/null' # run x2goserver-extensions for fail-resume x2gofeature 'X2GO_RUN_EXTENSIONS' &>'/dev/null' && x2goserver-run-extensions "${SESSION_NAME}" 'fail-resume' || true fi echo "gr_port=${GR_PORT}" echo "sound_port=${SOUND_PORT}" echo "fs_port=${FS_PORT}" if [[ "${X2GO_TELEKINESIS_ENABLED}" = '1' ]]; then echo "tekictrl_port=${TEKICTRL_PORT}" echo "tekidata_port=${TEKIDATA_PORT}" fi x2goserver-4.1.0.3/x2goserver/bin/x2goruncommand0000755000000000000000000003753613377671145016454 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. DISPLAY=":$1" X2GO_AGENT_PID="$2" X2GO_SESSION="$3" cmd="$5" sndsys="$6" X2GO_SESS_TYPE="$7" X2GO_LIB_PATH="$(x2gopath libexec)"; "$X2GO_LIB_PATH/x2gosyslog" "$0" "info" "$(basename $0) called with options: $@" # newer SSH daemons don't set $SSH_CLIENT anymore... if [ -z "$SSH_CLIENT" ] && [ -n "$SSH_CONNECTION" ]; then set -- $SSH_CONNECTION SSH_CLIENT="$1 $2 $4" export SSH_CLIENT fi export DISPLAY export XAUTHORITY=${XAUTHORITY:-"$HOME/.Xauthority"} export X2GO_AGENT_PID export X2GO_SESSION cmd=`echo $cmd |sed 's/X2GO_SPACE_CHAR/ /g'` args='' X2GO_ROOT="${HOME}/.x2go" MESSAGE_FILE="$X2GO_ROOT/C-$X2GO_SESSION/cmdoutput" echo "exec $cmd" >> "$MESSAGE_FILE" # make Kerberos's ticket cache known inside the X2Go session test -n $KRB5CCNAME && export KRB5CCNAME # disable rastering in >= KDE4.8 and Qt4.8 export QT_GRAPHICSSYSTEM="native" IMEXIT="false" # symlink to SSH_AUTH_SOCKET (ssh agent forwarding) so that we # can survive session suspension / resumption... X2GOSSH_AUTH_SOCK="$X2GO_ROOT/C-$X2GO_SESSION/ssh-agent.PID" if [ -S "$SSH_AUTH_SOCK" ]; then ln -sf "$SSH_AUTH_SOCK" "$X2GOSSH_AUTH_SOCK" fi export SSH_AUTH_SOCK="$X2GOSSH_AUTH_SOCK" if ! x2gofeature X2GOAGENT_RANDRXINERAMA 1>/dev/null; then NX_XINERAMA_LIBS="$(x2gopath xinerama)" NX_LIBS="$(x2gopath nx-x11)" test -n "$LD_LIBRARY_PATH" && \ LD_LIBRARY_PATH="$NX_XINERAMA_LIBS:$NX_LIBS:$LD_LIBRARY_PATH" || \ LD_LIBRARY_PATH="$NX_XINERAMA_LIBS:$NX_LIBS" "$X2GO_LIB_PATH/x2gosyslog" "$0" "debug" "exporting LD_LIBRARY_PATH=$LD_LIBRARY_PATH" export LD_LIBRARY_PATH fi if [ "$sndsys" == "esd" ]; then export ESPEAKER="localhost:$4" elif [ "$sndsys" == "arts" ]; then export ARTS_SERVER="localhost:$4" fi # detect Ubuntu version via /etc/lsb-release (not supported by Debian) if [ -e "/etc/lsb-release" ]; then source /etc/lsb-release fi # let x2goruncommand choose what command to use for a given desktop shell name (GNOME, UNITY, KDE, XFCE4, LXDE, TRINITY, MATE, OPENBOX, ICEWM) # NOTES on GNOME startup behaviour in different distributions # =========================================================== # Debian and every other non-Ubuntu distro launchs GNOME3 (in accelerated mode) when calling gnome-session # Ubuntu launches Unity (in accelerated mode) when calling gnome-session. # To make the GNOME variants start up properly on Ubuntu, we have to make the following differentiations # Ubuntu 10.10 and earlier (maverick): # GNOME -> gnome-session # (would start GNOME2) # Ubuntu 11.04 (natty): # GNOME -> gnome-session --session=2d-gnome # UNITY -> gnome-session --session=2d-ubuntu # (GNOME3 based desktop shells) # Ubuntu 11.10 (oneiric) & 12.04 (precise): # GNOME -> gnome-session --session=gnome-fallback # UNITY -> gnome-session --session=ubuntu-2d # (GNOME3 based desktop shells) # Ubuntu 12.10 (quantal): # GNOME -> gnome-session --session=gnome-fallback # UNITY -> gnome-session --session=ubuntu # (GNOME3 based desktop shells) # Ubuntu 13.10 (raring): # GNOME -> gnome-session --session=gnome-flashback # UNITY -> gnome-session --session=ubuntu # (GNOME3 based desktop shells) # Additionally, $GTK_MODULES must include "unity-gtk-module". # $GTK_MODULES does not need that value for any other distro # or any earlier release of Ubuntu. # Note that we are assuming that users are using a patched # version of GNOME Flashback which disables the acceleration check # altogether. # Ubuntu 14.04 (trusty) & 14.10 (utopic) # GNOME -> gnome-session --session=gnome-flashback --disable-acceleration-check # UNITY -> gnome-session --session=ubuntu # (GNOME3 based desktop shells) # Additionally, $GTK_MODULES must include "unity-gtk-module". # Note that we are assuming that the user has gnome-session # 3.9.90-0ubuntu12.1 or later on 14.04, or 3.9.90-0ubuntu16.1 on # 14.10, which added --disable-acceleration-check . # Ubuntu 15.04 (vivid) & later: # GNOME -> gnome-session --session=gnome-flashback-metacity --disable-acceleration-check # UNITY -> gnome-session --session=ubuntu # (GNOME3 based desktop shells) # Additionally, $GTK_MODULES must include "unity-gtk-module". # # The logic for launching GNOME should be generic enough # to work with every other distro. # # Also, it appears that some Linux GNOME2 distros need DESKTOP_SESSION="gnome" # while others do not. # # Also note that the XDG_CURRENT_DESKTOP value comes from # "DesktopNames" in the /usr/share/xsessions/ .desktop file if [ "$cmd" == "GNOME" ] || [ "$cmd" == "gnome-session" ]; then cmd="/usr/bin/gnome-session" if [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$(echo "$DISTRIB_RELEASE >= 15.04" | bc)" == "1" ]; then export DESKTOP_SESSION="gnome-flashback-metacity" if [ -z "$GTK_MODULES" ] ; then export GTK_MODULES="unity-gtk-module" else export GTK_MODULES="$GTK_MODULES:unity-gtk-module" fi # workaround to find /sbin/upstart-udev-bridge" # FIXME: Ubuntu's default PATH is not set correctly on 16.04, # and probably other releases. export PATH="${PATH}:/sbin" export XDG_SESSION_DESKTOP="$DESKTOP_SESSION" # Yes, "Unity" is in the actual string. Observed on Ubuntu 16.04 export XDG_CURRENT_DESKTOP="GNOME-Flashback:Unity" args=" --session=$DESKTOP_SESSION --disable-acceleration-check" elif [ "$DISTRIB_ID" == "Ubuntu" ] && { [ "$(echo "$DISTRIB_RELEASE == 14.04" | bc)" == "1" ] || [ "$(echo "$DISTRIB_RELEASE == 14.10" | bc)" == "1" ]; }; then export DESKTOP_SESSION="gnome-flashback" if [ -z "$GTK_MODULES" ] ; then export GTK_MODULES="unity-gtk-module" else export GTK_MODULES="$GTK_MODULES:unity-gtk-module" fi args=" --session=$DESKTOP_SESSION --disable-acceleration-check" elif [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$(echo "$DISTRIB_RELEASE == 13.10" | bc)" == "1" ]; then export DESKTOP_SESSION="gnome-flashback" if [ -z "$GTK_MODULES" ] ; then export GTK_MODULES="unity-gtk-module" else export GTK_MODULES="$GTK_MODULES:unity-gtk-module" fi args=" --session=$DESKTOP_SESSION" # GNOME Flashback 3.10 & later elif [ -e /usr/share/gnome-session/sessions/gnome-flashback-metacity.session ]; then export DESKTOP_SESSION="gnome-flashback-metacity" export XDG_SESSION_DESKTOP="$DESKTOP_SESSION" export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME" args=" --session=$DESKTOP_SESSION --disable-acceleration-check" # GNOME Flashback 3.8 (Metacity) elif [ -e /usr/share/gnome-session/sessions/gnome-flashback.session ]; then export DESKTOP_SESSION="gnome-flashback" args=" --session=$DESKTOP_SESSION --disable-acceleration-check" elif [ -e /usr/share/gnome-session/sessions/gnome-fallback.session ]; then export DESKTOP_SESSION="gnome-fallback" args=" --session=$DESKTOP_SESSION" elif [ -e /usr/share/gnome-session/sessions/2d-gnome.session ]; then export DESKTOP_SESSION="2d-gnome" args=" --session=$DESKTOP_SESSION" elif [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$(echo "$DISTRIB_RELEASE <= 10.10" | bc)" == "1" ]; then export DESKTOP_SESSION="gnome" elif grep -E '^(squeeze|6\.).*' '/etc/debian_version' >'/dev/null'; then export DESKTOP_SESSION="gnome" fi elif [ "$cmd" == "UNITY" ] || [ "$cmd" == "unity" ]; then cmd="/usr/bin/gnome-session" if [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$(echo "$DISTRIB_RELEASE >= 12.10" | bc)" == "1" ]; then export DESKTOP_SESSION="ubuntu" args=" --session=$DESKTOP_SESSION" elif [ "$DISTRIB_ID" == "Ubuntu" ] && { [ "$(echo "$DISTRIB_RELEASE == 11.10" | bc)" == "1" ] || [ "$(echo "$DISTRIB_RELEASE == 12.04" | bc)" == "1" ]; }; then export DESKTOP_SESSION="ubuntu-2d" args=" --session=$DESKTOP_SESSION" elif [ "$DISTRIB_ID" == "Ubuntu" ] && [ "$(echo "$DISTRIB_RELEASE == 11.04" | bc)" == "1" ]; then export DESKTOP_SESSION="2d-ubuntu" args=" --session=$DESKTOP_SESSION" fi # on earlier Ubuntu versions or with non-Ubuntu Distros the ,,UNITY'' command in X2Go will launch the GNOME2 desktop shell elif [ "$cmd" == "CINNAMON" ] || [ "$cmd" == "cinnamon" ]; then # Cinnamon 2.0 and newer # The cmd is a script that calls the "cinnamon-session" binary. if [ -e /usr/bin/cinnamon-session-cinnamon2d ]; then cmd="/usr/bin/cinnamon-session-cinnamon2d" # Cinnamon 1.6 & 1.8 # The cmd is a script that calls the "gnome-session" binary. elif [ -e /usr/bin/gnome-session-cinnamon2d ]; then cmd="/usr/bin/gnome-session-cinnamon2d" # Cinnamon 1.4 # The cmd is a script that calls the "gnome-session" binary. elif [ -e /usr/bin/gnome-session-cinnamon ]; then cmd="/usr/bin/gnome-session-cinnamon" # Fallback to the old behavior. else cmd="/usr/bin/gnome-session" export DESKTOP_SESSION="cinnamon2d" args=" --session=$DESKTOP_SESSION" fi elif [ "$cmd" == "MATE" ]; then cmd="/usr/bin/mate-session" elif [ "$cmd" == "KDE" ]; then cmd="/usr/bin/startkde" elif [ "$cmd" == "XFCE4" ] || [ "$cmd" == "XFCE" ]; then cmd="/usr/bin/xfce4-session" elif [ "$cmd" == "LXDE" ]; then cmd="/usr/bin/startlxde" elif [ "$cmd" == "LXQt" ]; then cmd="/usr/bin/startlxqt" elif [ "$dmd" == "IceWM" ]; then cmd="/usr/bin/icewm" elif [ "$cmd" == "TRINITY" ]; then # If we are on Q4OS, we needs to set env and run some tasks before # launching trinity. if [ -e /usr/bin/start-q4os-x2go ]; then cmd="/usr/bin/start-q4os-x2go" else # Multiple trinity launchers exist in practice, this list # is sorted from newest to oldest. # Note: the /opt/trinity prefix might look weird, but this is # actually the location Debian installs trinity to. The reason # seems to be that otherwise trinity clashes with KDE3. # It's entirely possible that this situation changes again # once KDE3 has been completely removed. if [ -x "/opt/trinity/bin/starttde" ]; then cmd="/opt/trinity/bin/starttde" elif [ -x "/opt/trinity/bin/starttrinity" ]; then cmd="/opt/trinity/bin/starttrinity" else cmd="/usr/bin/starttrinity" fi fi elif [ "$cmd" == "OPENBOX" ]; then cmd="/usr/bin/openbox-session" elif [ "$cmd" == "ICEWM" ]; then cmd="/usr/bin/icewm-session" fi if [ "$cmd" == "WWWBROWSER" ]; then if [ -e "/usr/bin/firefox.real" ]; then cmd="/usr/bin/firefox.real" elif [ -e "/usr/bin/iceweasel" ]; then cmd="/usr/bin/iceweasel" elif [ -e "/usr/bin/firefox" ]; then cmd="/usr/bin/firefox" elif [ -e "/usr/bin/abrowser" ]; then cmd="/usr/bin/abrowser" elif [ -e "/usr/bin/konqueror" ]; then cmd="/usr/bin/konqueror" elif [ -e "/usr/bin/galeon" ]; then cmd="/usr/bin/galeon" elif [ -e "/usr/bin/chromium-browser" ]; then cmd="/usr/bin/chromium-browser" fi fi if [ "$cmd" == "MAILCLIENT" ]; then if [ -e "/usr/bin/thunderbird" ]; then cmd="/usr/bin/thunderbird" elif [ -e "/usr/bin/icedove" ]; then cmd="/usr/bin/icedove" elif [ -e "/usr/bin/kmail" ]; then cmd="/usr/bin/kmail" elif [ -e "/usr/bin/evolution" ]; then cmd="/usr/bin/evolution" fi fi if [ "$cmd" == "OFFICE" ]; then if [ -e "/usr/bin/loffice" ]; then cmd="/usr/bin/loffice" elif [ -e "/usr/bin/ooffice" ]; then cmd="/usr/bin/ooffice" fi fi if [ "$cmd" == "TERMINAL" ]; then if [ -e "/usr/bin/konsole" ]; then cmd="/usr/bin/konsole" elif [ -e "/usr/bin/mate-terminal" ]; then cmd="/usr/bin/mate-terminal" elif [ -e "/usr/bin/gnome-terminal" ]; then cmd="/usr/bin/gnome-terminal" elif [ -e "/usr/bin/lxterminal" ]; then cmd="/usr/bin/lxterminal" elif [ -e "/usr/bin/qterminal" ]; then cmd="/usr/bin/qterminal" elif [ -e "/usr/bin/rxvt" ]; then cmd="/usr/bin/rxvt" elif [ -e "/usr/bin/xterm" ]; then cmd="/usr/bin/xterm" fi fi WCMD=`echo $cmd | cut -d " " -f 1` EXEC=`type -P $WCMD` EXEC_WRAPPER="" BNAME=`basename "$EXEC"` if [ "$BNAME" == "rdesktop" ] then if type padsp >/dev/null; then EXEC_WRAPPER="padsp" args=" -r sound:local" fi if [ -d "$HOME/media" ]; then args+=" -r disk:X2GoMedia=$HOME/media" fi fi if [ "$X2GO_SESS_TYPE" == "P" ] then IMEXIT="true" EXEC="/bin/true" X2GO_SESS_TYPE="R" fi # run x2goserver-extensions for pre-runcommand x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$X2GO_SESSION" pre-runcommand || true sucessful_run=false if [ "$EXEC" != "" ] && [ -x "$EXEC" ]; then "$X2GO_LIB_PATH/x2gosyslog" "$0" "debug" "running command $EXEC" x2gosetkeyboard >/dev/null 2>/dev/null & if x2gofeature X2GO_XSESSION &>/dev/null && [ "x$X2GO_SESS_TYPE" = "xD" ]; then STARTUP="$cmd$args" # Search for dbus-run-session and handle the non-existence (to some extent) gracefully. typeset dbus_wrapper="$(type -P "dbus-run-session")" "$X2GO_LIB_PATH/x2gosyslog" "$0" "notice" "launching session with Xsession-x2go mechanism, using STARTUP=\"$STARTUP\"" typeset dbus_wrapper_msg="available as ${dbus_wrapper}" [[ -z "${dbus_wrapper}" ]] && dbus_wrapper_msg="not available" "${X2GO_LIB_PATH}/x2gosyslog" "${0}" "notice" "dbus wrapper ${dbus_wrapper_msg}" XSESSION_EXEC="$cmd" STARTUP="/usr/bin/env LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ${STARTUP}" ${dbus_wrapper} /etc/x2go/Xsession >> "$MESSAGE_FILE" 2>&1 else "$X2GO_LIB_PATH/x2gosyslog" "$0" "debug" "executing command \"$cmd$args\"..." # This is gonna be a nasty trick now... # Most applications run in foreground (fine!), but some fork to background (urgghh... e.g. konsole, iceweasel, etc.). # By capturing their STDOUT, we force the process to remain in (sort of) foreground until the process has finished. # This works fabulously with all applications that don't cleanly close their file descriptors (which is probably # 99% of all applications out there...). STDOUT=`$EXEC_WRAPPER $cmd$args` fi if [ "$X2GO_SESS_TYPE" == "R" ] && [ "$IMEXIT" == "true" ]; then # applications that managed to quit immediately, we catch here by waiting as long as x2goagent exists "$X2GO_LIB_PATH/x2gosyslog" "$0" "debug" "waiting for x2goagent (PID: $X2GO_AGENT_PID) to finish" while [ -d "/proc/$X2GO_AGENT_PID" ]; do sleep 1 done "$X2GO_LIB_PATH/x2gosyslog" "$0" "debug" "x2goagent (PID: $X2GO_AGENT_PID) has finished" else "$X2GO_LIB_PATH/x2gosyslog" "$0" "debug" "command $EXEC has finished" fi # if we reach here the possibility of a successful command execution is rather high successful_run=true # run x2goserver-extensions for post-runcommand x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$X2GO_SESSION" post-runcommand || true else "$X2GO_LIB_PATH/x2gosyslog" "$0" "err" "ERROR: command $EXEC failed to execute" echo "X2GORUNCOMMAND ERR NOEXEC:$cmd" > "$MESSAGE_FILE" # run x2goserver-extensions for fail-runcommand x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$X2GO_SESSION" fail-runcommand || true fi # stop x2godesktopsharing process gracefully... x2gofeature X2GO_DESKTOPSHARING >/dev/null && x2goterminate-desktopsharing "$X2GO_SESSION" || true kill -TERM "$X2GO_AGENT_PID" "$X2GO_LIB_PATH/x2gochangestatus" 'F' "$X2GO_SESSION" > /dev/null x2goumount-session "$X2GO_SESSION" # run logout scripts test -r /etc/x2go/x2go_logout && . /etc/x2go/x2go_logout # clean up session dir if not in debug mode and if session has been successful if [ "$($X2GO_LIB_PATH/x2gologlevel)" != "7" ] && [ "x$successful_run" = "xtrue" ]; then (sleep 10; rm -f "${HOME}/.x2go/C-${X2GO_SESSION}"; rm -Rf "/tmp/.x2go-${USER}/C-${X2GO_SESSION}"; rmdir --ignore-fail-on-non-empty "/tmp/.x2go-${USER}"; )& fi x2goserver-4.1.0.3/x2goserver/bin/x2gosessionlimit0000755000000000000000000000442213377671145017017 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Config qw( get_config); use X2Go::Log qw( loglevel ); use X2Go::Utils qw( system_capture_merged_output ); use English; openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); syslog('info', "x2gosessionlimit has been called"); my $maxlimit=-1; my $Config = get_config(); sub getGroupLimit { my $group=shift; my $strlimit=$Config->param("limit groups.$group"); if ($strlimit ne "") { if ($strlimit == 0) { print "0\n"; exit 0; } if ($strlimit > $maxlimit) { $maxlimit=$strlimit; } } } my $uname; $uname=getpwuid($<); my $runningsessions=system_capture_merged_output("x2golistsessions", "--all-servers"); my @sessions=split("\n",$runningsessions); my $scount=@sessions; my $strlimit=$Config->param("limit users.$uname"); if($strlimit ne "") { if ($strlimit == 0) { print "0\n"; closelog; exit 0; } if ($scount < $strlimit) { print "$strlimit\n"; closelog; exit 0; } print "LIMIT\n"; exit 0; } my @assigned_groups = split (" ", $REAL_GROUP_ID); foreach my $current_group (@assigned_groups) { my $name = getgrgid ($current_group); if (defined ($name)) { getGroupLimit $name; } } if ($scount < $maxlimit) { print "$maxlimit\n"; closelog; exit 0; } if ($maxlimit != -1) { print "LIMIT\n"; closelog; exit 0; } # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/bin/x2gosetkeyboard0000755000000000000000000000740313377671145016613 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2011-2015 Mike Gabriel # Copyright (C) 2011-2018 Oleksandr Shneyder # Copyright (C) 2011-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" SESSION_NAME=${1:-$X2GO_SESSION} # set up paths X2GO_SESSION_ROOT=${HOME}/.x2go X2GO_SESSION_DIR=${X2GO_SESSION_ROOT}/C-${SESSION_NAME} # client keyboard configuration X2GO_CLIENT_KBD_FILE=${X2GO_SESSION_DIR}/keyboard # if there is a directory at the location of the keyboard file, we consider this as blocking this script if [ -d ${X2GO_CLIENT_KBD_FILE} ]; then $X2GO_LIB_PATH/x2gosyslog "$0" "info" "${X2GO_CLIENT_KBD_FILE} is blocked, not setting keyboard parameters from client-side settings" rm -Rf ${X2GO_CLIENT_KBD_FILE} exit 0 fi # wait for the keyboard file to appear i=0 while ! [ -f ${X2GO_CLIENT_KBD_FILE} ] && [ $i -lt 30 ]; do $X2GO_LIB_PATH/x2gosyslog "$0" "info" "Waiting for ${X2GO_CLIENT_KBD_FILE} to appear" sleep 1 i=$((i+1)) done if ! [ -f ${X2GO_CLIENT_KBD_FILE} ]; then $X2GO_LIB_PATH/x2gosyslog "$0" "warning" "${X2GO_CLIENT_KBD_FILE} did not appear within 30s after agent startup" exit 0 fi # Used to hold options to setxkbmap. typeset -a setxkbmap_opts # retrieve keyboard settings from keyboard file in X2Go session dir read_keyboard_file() { # Cache file contents. typeset -a file_content typeset line='' while IFS='' read -r line; do file_content+=("${line}") done < "${X2GO_CLIENT_KBD_FILE}" # Append last line if not terminated by a newline. [[ "${line}" ]] && file_content+=("${line}") for line in "${file_content[@]}"; do # Extract the keys, their values and add to setxkbmap_opts. typeset key='' for key in "rules" "model" "layout" "variant" "options"; do # This does not support quotes characters within values. Shouldn't be necessary, anyway. # Matching escaped quote characters is possible, but complicated and not worth the effort. # Probably. typeset regexp='^[[:space:]]*'"${key}"'[[:space:]]*=[[:space:]]*"?([^"]*)"?[[:space:]]*' if [[ "${line}" =~ ${regexp} ]]; then typeset value="${BASH_REMATCH[1]}" if [ -n "${value}" ]; then # Handle a special substitution case for evdev-based rules. # FIXME: find out why that substitution is needed in the first place! [ "${key}" = 'rules' ] && value="${value//evdev/base}" # Even though the keyboard file contains "options" as the key, # setxkbmap expects a parameter called "-option". typeset option="${key}" [ "${option}" = 'options' ] && option='option' setxkbmap_opts+=("-${option}" "${value}") fi fi done done } reset_keymap() { setxkbmap -layout us -option "" -model pc104 } update_keymap() { # update keyboard map setxkbmap "${setxkbmap_opts[@]}" } ### main ### $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "Setting X keyboard according to ${X2GO_CLIENT_KBD_FILE}" read_keyboard_file reset_keymap update_keymap x2goserver-4.1.0.3/x2goserver/bin/x2gostartagent0000755000000000000000000005051413377671145016454 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. X2GO_LIB_PATH="$(x2gopath 'libexec')" "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "$(basename "${0}") called with options: ${*}" if ! SSH_PORT="$("${X2GO_LIB_PATH}/x2gogetrandomport")"; then typeset msg='Unable to get (pseudo-)randomized starting port value.' "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" # Make x2goclient fail. echo "${msg}" >&2 exit '1' fi X2GO_PORT='50' # some sanity checks before session startup... if grep -E -- '^backend[ ]*=[ ]*postgres' '/etc/x2go/x2gosql/sql' &>'/dev/null' && [[ "${USER}" = 'root' ]]; then msg='The super-user "root" is not allowed to launch X2Go sessions.' echo "${msg}" >&2 "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" exit '2' elif [[ -z "${USER}" ]]; then msg='The $USER environment variable is not set. Aborting session startup.' echo "${msg}" >&2 "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" exit '3' elif [[ -z "${HOME}" ]]; then msg='The $HOME environment variable is not set. Aborting session startup.' echo "${msg}" >&2 "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" exit '4' elif ! iconv -f 'ASCII' -t 'ASCII' &>'/dev/null' <<< "${HOME}"; then msg='Your home directory path contains non-ASCII characters. Aborting session startup.' echo "${msg}" >&2 "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" exit '5' fi # ${HOSTNAME} should be automatically set by bash via gethostname(2), IFF this # variable is not already set in the environment. # # This leads to two problems: # - export HOSTNAME="malbox"; x2gostartagent will override the actual system # host name and lead to authorization failures when connecting to # x2goagent/nxagent later on. # - even if the above is not the case, we want to be sure to get the actual # system host name. # # Workaround: use hostname. typeset current_host_name='' if ! current_host_name="$(hostname)"; then typeset msg='Unable to retrieve machine'"'"'s hostname. This is required. Aborting session startup.' "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" # Make x2goclient fail. echo "${msg}" >&2 exit '6' fi X2GO_TELEKINESIS_ENABLED="$("${X2GO_LIB_PATH}/x2goistrue" "$("${X2GO_LIB_PATH}/x2goqueryconfig" "telekinesis" "enable")")" X2GO_ROOT="${HOME}/.x2go" export NX_ROOT="${X2GO_ROOT}" X2GO_NXAGENT_DEFAULT_OPTIONS='-extension GLX -nolisten tcp' if [[ -r '/etc/x2go/x2goagent.options' ]]; then source '/etc/x2go/x2goagent.options' fi if [[ -z "${X2GO_NXAGENT_OPTIONS}" ]]; then X2GO_NXAGENT_OPTIONS="${X2GO_NXAGENT_DEFAULT_OPTIONS}" fi REMOTE='localhost' # shadow sessions (via x2godesktopsharing) set the X2GO_CLIENT var in the process environment # so either it is already set or we obtain it from SSH_CLIENT/SSH_CONNECTION if [[ -z "${X2GO_CLIENT}" ]] && [[ -n "${SSH_CLIENT}" ]]; then X2GO_CLIENT="$(awk '{print $1}' <<< "${SSH_CLIENT}")" elif [[ -z "${X2GO_CLIENT}" ]] && [[ -n "${SSH_CONNECTION}" ]]; then X2GO_CLIENT="$(awk '{print $1}' <<< "${SSH_CONNECTION}")" fi if [[ -z "${X2GO_CLIENT}" ]]; then msg='The $X2GO_CLIENT environment variable is not set. Possible reasons: $SSH_CLIENT not set or $SSH_CONNECTION not set. Or $X2GO_CLIENT not set by the "X2Go Desktop Sharing" applet. Aborting session startup.' echo "${msg}" >&2 "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" exit '7' fi "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "client announced itself as "'"'"${X2GO_CLIENT}"'"' typeset -i x2go_randr_xinerama='0' # Extending optional parameters isn't trivially possible. # Since we want this script to work with newer X2Go Client # versions that supply a Xinerama configuration value and # also with older ones that do not, we pass it in as an # environment variable. [[ -n "${X2GO_XINERAMA}" ]] && x2go_xinerama="$("${X2GO_LIB_PATH}/x2goistrue" "${X2GO_XINERAMA}")" X2GO_GEOMETRY="${1}"; shift X2GO_LINK="${1}"; shift X2GO_PACK="${1}"; shift X2GO_TYPE="${1}"; shift X2GO_KBD_LAYOUT="${1}"; shift X2GO_KBD_TYPE="${1}"; shift X2GO_SET_KBD="${1}"; shift X2GO_STYPE="${1}"; shift X2GO_CMD="${1}"; shift X2GO_RESIZE='1' X2GO_FULLSCREEN='0' X2GO_CLIPBOARD='' : "${XAUTHORITY:="${HOME}/.Xauthority"}" if [[ "${X2GO_STYPE}" = 'S' ]]; then SHADOW_MODE="$(awk '{split($0,a,"XSHAD"); print a[1]}' <<< "${X2GO_CMD}")" SHADOW_USER="$(awk '{split($0,a,"XSHAD"); print a[2]}' <<< "${X2GO_CMD}")" SHADOW_DESKTOP="$(awk '{split($0,a,"XSHAD"); print a[3]}' <<< "${X2GO_CMD}")" # FIXME: no client application actually passes in an additional user name. # This is most likely redundant and confuses things (esp. since it's an # optional parameter) needlessly. if [[ -z "${1}" ]]; then # can this line be removed? #echo "suser ${SHADOW_USER} user ${USER} " >>"/tmp/uagent" "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "shadow session requested: mode ${SHADOW_MODE}, user: ${SHADOW_USER}, desktop: ${SHADOW_DESKTOP}" else SHADREQ_USER="${1}"; shift "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "preparing shadow session request for user ${SHADREQ_USER}, agent starts for user ${USER}" fi if [[ "${SHADOW_USER}" != "${USER}" ]]; then "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'notice' "user "'"'"${USER}"'"'" requests desktop sharing from user "'"'"${SHADOW_USER}"'"'" for desktop "'"'"${SHADOW_DESKTOP}"'"' "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "executing command: x2godesktopsharing client ${X2GO_CLIENT} ${X2GO_GEOMETRY} ${X2GO_LINK} ${X2GO_PACK} ${X2GO_TYPE} ${X2GO_KBD_LAYOUT} ${X2GO_KBD_TYPE} ${X2GO_SET_KBD} ${X2GO_STYPE} ${X2GO_CMD} ${USER}" OUTPUT="$(x2godesktopsharing 'client' "${X2GO_CLIENT}" "${X2GO_GEOMETRY}" "${X2GO_LINK}" "${X2GO_PACK}" "${X2GO_TYPE}" "${X2GO_KBD_LAYOUT}" "${X2GO_KBD_TYPE}" "${X2GO_SET_KBD}" "${X2GO_STYPE}" "${X2GO_CMD}" "${USER}")" OUTPUT="$(sed -e 's/#012/ /g' <<< "${OUTPUT}")" "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "command result is: ${OUTPUT}" if [[ "${OUTPUT:0:4}" = 'DENY' ]]; then echo 'ACCESS DENIED' >&2 DENIAL_REASON="${OUTPUT:5}" if [[ -z "${DENIAL_REASON}" ]]; then DENIAL_REASON="the user "'"'"${SHADOW_USER}"'"'" does not seem to have desktop sharing activated" fi "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "ERROR: user ${SHADOW_USER} denied desktop sharing session" "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "ERROR: reason: for desktop sharing denial ${DENIAL_REASON}" exit '8' fi X2GO_COOKIE="$(awk '{print $2}' <<< "${OUTPUT}")" X2GO_PORT="$(awk '{print $1}' <<< "${OUTPUT}")" "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "received shadow session information: cookie: ${X2GO_COOKIE}, port: ${X2GO_PORT}" xauth -f "${XAUTHORITY}" 'add' "${current_host_name}/unix:${X2GO_PORT}" "MIT-MAGIC-COOKIE-1" "${X2GO_COOKIE}" xauth -f "${XAUTHORITY}" 'add' "${current_host_name}:${X2GO_PORT}" "MIT-MAGIC-COOKIE-1" "${X2GO_COOKIE}" echo "${X2GO_PORT}" echo "${X2GO_COOKIE}" awk '{print $3}' <<< "${OUTPUT}" awk '{print $4}' <<< "${OUTPUT}" awk '{print $5}' <<< "${OUTPUT}" awk '{print $6}' <<< "${OUTPUT}" awk '{print $7}' <<< "${OUTPUT}" exit '0' fi else X2GO_CLIPBOARD="${1}"; shift fi LIMIT="$(x2gosessionlimit)" LWORD="$(awk '{print $1}' <<< "${LIMIT}")" if [[ "${LWORD}" = 'LIMIT' ]]; then echo "${LIMIT}" >&2 "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "session limit has been reached for user "'"'"${USER}"'"'", cannot start new session" exit '9' fi export NX_CLIENT="${X2GO_LIB_PATH}/x2gosuspend-agent" COLORDEPTH="$(awk '{split($0,a,"-depth_"); print a[2]}' <<< "${X2GO_TYPE}")" SESSION_TYPE='D' NOEXITPARAM='' if [[ "${X2GO_STYPE}" = 'R' ]]; then SESSION_TYPE='R' elif [[ "${X2GO_STYPE}" = 'P' ]]; then SESSION_TYPE='R' NOEXITPARAM='-norootlessexit' elif [[ "${X2GO_STYPE}" = 'S' ]]; then SESSION_TYPE='S' fi if [[ -z "${X2GO_CLIENT}" ]]; then X2GO_CLIENT="${current_host_name}" fi # define the full path to the ss utility ss="$(PATH="${PATH}:/usr/sbin:/sbin" type -P "ss")" typeset -i retry='0' typeset -i max_retry='10' typeset output='' for ((retry = 0; retry < max_retry; ++retry)); do typeset -i free_port="${X2GO_PORT}" if free_port="$("${X2GO_LIB_PATH}/x2gogetfreeport" "${current_host_name}" "${ss}" 'display' "${X2GO_PORT}")"; then X2GO_PORT="${free_port}" if [[ -n "${SHADREQ_USER}" ]]; then SESSION_NAME="${SHADREQ_USER}-${X2GO_PORT}-$(date '+%s')" else SESSION_NAME="${USER}-${X2GO_PORT}-$(date '+%s')" fi if [[ -n "${COLORDEPTH}" ]]; then SESSION_NAME="${SESSION_NAME}_st${SESSION_TYPE}${X2GO_CMD}_dp${COLORDEPTH}" SESSION_NAME="${SESSION_NAME//:/PP}" fi # sanitize session name SESSION_NAME="$(perl -pe 's/[^a-zA-Z0-9\.\_\-\@]//g' <<< "${SESSION_NAME}")" if [[ -n "${SHADREQ_USER}" ]]; then "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "initializing new shadow session with ID ${SESSION_NAME}" output="$("${X2GO_LIB_PATH}/x2goinsertshadowsession" "${X2GO_PORT}" "${current_host_name}" "${SESSION_NAME}" "${SHADREQ_USER}")" else "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "initializing new session with ID ${SESSION_NAME}" output="$("${X2GO_LIB_PATH}/x2goinsertsession" "${X2GO_PORT}" "${current_host_name}" "${SESSION_NAME}")" fi if [[ "${output}" = 'inserted' ]]; then break else "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'warning' "unable to insert display port into database. Retrying (run $((retry + 1)))." fi else "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'warning' "no free display number available, cannot start new session. Retrying (run $((retry + 1)))." fi done if [[ "${output}" != 'inserted' ]]; then typeset msg="Unable to find free display port or insert new session into database; parameters: port (${X2GO_PORT}), hostname (${current_host_name}) and session name (${SESSION_NAME})." "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" # Make x2goclient fail. echo "${msg}" >&2 exit '10' fi if [[ "${X2GO_TELEKINESIS_ENABLED}" = '0' ]] || [[ "${X2GO_STYPE}" = 'S' ]] || ! type -p 'telekinesis-server' 1>'/dev/null'; then TEKICTRL_PORT='-1' TEKIDATA_PORT='-1' X2GO_TELEKINESIS_ENABLED='0' fi while [[ -z "${GR_PORT}" ]] || [[ -z "${SOUND_PORT}" ]] || [[ -z "${FS_PORT}" ]] || [[ -z "${TEKICTRL_PORT}" ]] || [[ -z "${TEKIDATA_PORT}" ]]; do output='' for ((retry = 0; retry < max_retry; ++retry)); do free_port='0' if free_port="$("${X2GO_LIB_PATH}/x2gogetfreeport" "${current_host_name}" "${ss}" 'lowlevel' "${SSH_PORT}")"; then SSH_PORT="${free_port}" output="$("${X2GO_LIB_PATH}/x2goinsertport" "${current_host_name}" "${SESSION_NAME}" "${SSH_PORT}")" if [[ "${output}" = 'inserted' ]]; then break else "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'warning' "unable to insert port into database. Retrying (run $((retry + 1)))." fi else "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'warning' "no free port available, cannot start new session. Retrying (run $((retry + 1)))." fi done if [[ "${output}" != 'inserted' ]]; then typeset msg="Unable to find free port or insert new session into database; parameters: hostname (${current_host_name}), session name (${SESSION_NAME}) and port (${SSH_PORT})." "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" # Make x2goclient fail. echo "${msg}" >&2 exit '11' fi if [[ -z "${GR_PORT}" ]]; then GR_PORT="${SSH_PORT}" elif [[ -z "${SOUND_PORT}" ]]; then SOUND_PORT="${SSH_PORT}" elif [[ -z "${FS_PORT}" ]]; then FS_PORT="${SSH_PORT}" elif [[ -z "${TEKICTRL_PORT}" ]]; then TEKICTRL_PORT="${SSH_PORT}" elif [[ -z "${TEKIDATA_PORT}" ]]; then TEKIDATA_PORT="${SSH_PORT}" fi done # rootless sessions of geometry fullscreen are invalid if [[ "${X2GO_GEOMETRY}" = 'fullscreen' ]] && [[ "${SESSION_TYPE}" = 'R' ]]; then X2GO_GEOMETRY='' fi # no geometry for desktop sessions shall result in fullscreen desktop sessions if [[ "${X2GO_GEOMETRY}" = '' ]] && [[ "${SESSION_TYPE}" = 'D' ]]; then X2GO_GEOMETRY='fullscreen' fi if [[ "${X2GO_GEOMETRY}" = 'fullscreen' ]]; then X2GO_FULLSCREEN='1' fi # shadow sessions are never fullscreen session and adopt the original session's geometry if [[ "${X2GO_STYPE}" = 'S' ]]; then X2GO_GEOMETRY="$(DISPLAY="${SHADOW_DESKTOP}" xwininfo -root | grep 'geometry')" X2GO_GEOMETRY="$(sed -e 's/ //g' <<< "${X2GO_GEOMETRY}")" X2GO_GEOMETRY="$(sed -e 's/-geometry//' <<< "${X2GO_GEOMETRY}")" fi if [[ ! -d "${X2GO_ROOT}" ]]; then mkdir -- "${X2GO_ROOT}" fi X2GO_TMP_ROOT="/tmp/.x2go-${USER}" if [[ ! -d "${X2GO_TMP_ROOT}" ]]; then mkdir -- "${X2GO_TMP_ROOT}" fi SESSION_DIR="${X2GO_TMP_ROOT}/C-${SESSION_NAME}" if [[ "${X2GO_TELEKINESIS_ENABLED}" != '0' ]] && [[ "${X2GO_STYPE}" != 'S' ]]; then mkdir -p -- "${SESSION_DIR}/telekinesis/remote/" fi STATE_FILE="${SESSION_DIR}/state" # do not use $TMP or $TEMP here, the session.log file location has to be accessible by root SESSION_LOG="${SESSION_DIR}/session.log" mkdir -p -- "${SESSION_DIR}" if [[ "${X2GO_STYPE}" = 'S' ]]; then chmod -f '0710' -- "${SESSION_DIR}" if groups "${USER}" | grep 'x2godesktopsharing' &>'/dev/null'; then "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "user "'"'"${USER}"'"'" grants access to ${SESSION_DIR} for group "'"'"x2godesktopsharing"'"' chown -- ':x2godesktopsharing' "${SESSION_DIR}" fi else chmod -f '0700' -- "${SESSION_DIR}" fi touch "${SESSION_LOG}" chmod -f '0600' -- "${SESSION_LOG}" if [[ ! -d "${X2GO_ROOT}/ssh" ]]; then mkdir -- "${X2GO_ROOT}/ssh" fi grep 'PPid' "/proc/${PPID}/status" >"${SESSION_DIR}/sshd.pid" X2GO_COOKIE="$(mcookie)" xauth -f "${XAUTHORITY}" 'add' "${current_host_name}/unix:${X2GO_PORT}" 'MIT-MAGIC-COOKIE-1' "${X2GO_COOKIE}" xauth -f "${XAUTHORITY}" 'add' "${current_host_name}:${X2GO_PORT}" 'MIT-MAGIC-COOKIE-1' "${X2GO_COOKIE}" typeset option_geometry='' if [[ -n "${X2GO_GEOMETRY}" ]] && [[ "${X2GO_GEOMETRY}" != 'fullscreen' ]]; then option_geometry="geometry=${X2GO_GEOMETRY}," fi typeset tmp_regex='^(0|none|client|server|both|1)$' if [[ -n "${X2GO_CLIPBOARD}" ]] && [[ "${X2GO_CLIPBOARD}" =~ ${tmp_regex} ]]; then clipboard=",clipboard=${X2GO_CLIPBOARD}" else clipboard=",clipboard=both" fi typeset xinerama_option='1' [[ "${x2go_xinerama}" = '0' ]] && xinerama_option='0' typeset kbtype_option="${X2GO_KBD_TYPE}" if [[ "${X2GO_SET_KBD}" = '0' ]] || [[ "${X2GO_KBD_TYPE}" = 'auto' ]]; then kbtype_option='null/null' fi # Ensure X2GO_NXOPTIONS ends with a , if needed if [[ -n "${X2GO_NXOPTIONS}" ]]; then X2GO_NXOPTIONS="${X2GO_NXOPTIONS%,}," fi echo "nx/nx,link=${X2GO_LINK},pack=${X2GO_PACK},limit=0,root=${SESSION_DIR},cache=8M,images=32M,type=${X2GO_TYPE},id=${SESSION_NAME},cookie=${X2GO_COOKIE},errors=${SESSION_LOG},kbtype=${kbtype_option},${option_geometry}xinerama=${xinerama_option},resize=${X2GO_RESIZE},fullscreen=${X2GO_FULLSCREEN},accept=${REMOTE},listen=${GR_PORT}${clipboard},client=linux,menu=0,${X2GO_NXOPTIONS}state=${STATE_FILE}:${X2GO_PORT}" >"${SESSION_DIR}/options" NX_AGENT=":${X2GO_PORT}" SAVED_DISPLAY="${DISPLAY}" # Make shellcheck happy. : "${SAVED_DISPLAY}" DISPLAY="nx/nx,options=${SESSION_DIR}/options:${X2GO_PORT}" export DISPLAY if [[ -z "${X2GODPI}" ]]; then X2GODPIOPTION_='' else X2GODPIOPTION_="-dpi ${X2GODPI}" fi NOLISTOPT='' if [[ -z "${X2GOXDMCP}" ]] ;then XDMCPOPT='' if [[ "${X2GO_NXAGENT_OPTIONS}" != "${X2GO_NXAGENT_OPTIONS/ -nolisten tcp/}" ]]; then NOLISTOPT='-nolisten tcp' fi else XDMCPOPT="-query ${X2GOXDMCP}" fi # run x2goserver-extensions for pre-start x2gofeature 'X2GO_RUN_EXTENSIONS' &>'/dev/null' && x2goserver-run-extensions "${SESSION_NAME}" 'pre-start' || true SESSION_WINDOW_TITLE="X2GO-${SESSION_NAME}" agent_geometry='' if [[ -n "${X2GO_GEOMETRY}" ]] && [[ "${X2GO_GEOMETRY}" != 'fullscreen' ]]; then agent_geometry="-geometry ${X2GO_GEOMETRY}" fi # systemd is prone to kill remaining sessions on user logouts. # That sort of makes sense to clean up stray processes, # but gets in the way of our persistent session scheme. loginctl 'enable-linger' &>'/dev/null' || : X2GO_AGENT_PID='0' if [[ "${X2GO_STYPE}" = 'S' ]]; then # unset LD_LIBRARY_PATH for the case when x2gostartagent started from x2godesktopsharing unset LD_LIBRARY_PATH # set NX_TEMP to /tmp, make sure x2goagent starts when pam_tmpdir.so is in use "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "started nxagent: NX_TEMP=/tmp x2goagent X2GO_NXAGENT_OPTIONS ('${X2GO_NXAGENT_OPTIONS}') NOLISTOPT ('${NOLISTOPT}') X2GODPIOPTION_ ('${X2GODPIOPTION_}') -SESSION_TYPE ('-${SESSION_TYPE}') -auth \"XAUTHORITY\" ('\"${XAUTHORITY}\"') -shadow SHADOW_DESKTOP ('${SHADOW_DESKTOP}') -shadowmode SHADOW_MODE ('${SHADOW_MODE}') agent_geometry ('${agent_geometry}') -name \"SESSION_WINDOW_TITLE\" ('\"${SESSION_WINDOW_TITLE}\"') \"NX_AGENT\" ('\"${NX_AGENT}\"') 2>\"SESSION_LOG\" ('\"${SESSION_LOG}\"') &" NX_TEMP='/tmp' x2goagent ${X2GO_NXAGENT_OPTIONS} ${NOLISTOPT} ${X2GODPIOPTION_} -${SESSION_TYPE} -auth "${XAUTHORITY}" -shadow ${SHADOW_DESKTOP} -shadowmode ${SHADOW_MODE} ${agent_geometry} -name "${SESSION_WINDOW_TITLE}" "${NX_AGENT}" 2>"${SESSION_LOG}" & else # set NX_TEMP to /tmp, make sure x2goagent starts when pam_tmpdir.so is in use "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "started nxagent: NX_TEMP=/tmp x2goagent X2GO_NXAGENT_OPTIONS ('${X2GO_NXAGENT_OPTIONS}') NOLISTOPT ('${NOLISTOPT}') X2GODPIOPTION_ ('${X2GODPIOPTION_}') XDMCPPOPT ('${XDMCPOPT}') -SESSION_TYPE ('-${SESSION_TYPE}') NOEXITPARAM ('${NOEXITPARAM}') -auth \"XAUTHORITY\" ('\"${XAUTHORITY}\"') agent_geometry ('${agent_geometry}') -name \"SESSION_WINDOW_TITLE\" ('\"${SESSION_WINDOW_TITLE}\"') \"NX_AGENT\" ('\"${NX_AGENT}\"') 2>\"SESSION_LOG\" ('\"${SESSION_LOG}\"') &" NX_TEMP='/tmp' x2goagent ${X2GO_NXAGENT_OPTIONS} ${NOLISTOPT} ${X2GODPIOPTION_} ${XDMCPOPT} -${SESSION_TYPE} ${NOEXITPARAM} -auth "${XAUTHORITY}" ${agent_geometry} -name "${SESSION_WINDOW_TITLE}" "${NX_AGENT}" 2>"${SESSION_LOG}" & fi ln -s -- "${SESSION_DIR}" "${X2GO_ROOT}/C-${SESSION_NAME}" X2GO_AGENT_PID="${!}" if [[ -n "${SHADREQ_USER}" ]]; then "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "creating new shadow session: ${SESSION_NAME} ${X2GO_COOKIE} ${X2GO_AGENT_PID} ${X2GO_CLIENT} ${GR_PORT} ${SOUND_PORT} ${FS_PORT} ${SHADREQ_USER}" "${X2GO_LIB_PATH}/x2gocreateshadowsession" "${SESSION_NAME}" "${X2GO_COOKIE}" "${X2GO_AGENT_PID}" "${X2GO_CLIENT}" "${GR_PORT}" "${SOUND_PORT}" "${FS_PORT}" "${SHADREQ_USER}" >'/dev/null' else "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "creating new session: ${SESSION_NAME} ${X2GO_COOKIE} ${X2GO_AGENT_PID} ${X2GO_CLIENT} ${GR_PORT} ${SOUND_PORT} ${FS_PORT} ${TEKICTRL_PORT} ${TEKIDATA_PORT}" "${X2GO_LIB_PATH}/x2gocreatesession" "${SESSION_NAME}" "${X2GO_COOKIE}" "${X2GO_AGENT_PID}" "${X2GO_CLIENT}" "${GR_PORT}" "${SOUND_PORT}" "${FS_PORT}" "${TEKICTRL_PORT}" "${TEKIDATA_PORT}" >'/dev/null' fi if [[ "${X2GO_SET_KBD}" = '0' ]] || [[ "${X2GO_KBD_TYPE}" != 'auto' ]]; then "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "blocking creation of agent's keyboard file ${SESSION_DIR}/keyboard as requested by session startup command" mkdir -p -- "${SESSION_DIR}/keyboard" fi if ps -p "${X2GO_AGENT_PID}" &>'/dev/null'; then "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'notice' "successfully started X2Go Agent session with ID ${SESSION_NAME}" # run x2goserver-extensions for post-start x2gofeature 'X2GO_RUN_EXTENSIONS' &>'/dev/null' && x2goserver-run-extensions "${SESSION_NAME}" 'post-start' || true else typeset msg="Failed to start X2Go Agent session with ID ${SESSION_NAME}. X2Go Agent terminated unexpectedly. Aborting session startup." "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'err' "${msg}" # Make x2goclient fail. echo "${msg}" >&2 # run x2goserver-extensions for fail-start x2gofeature 'X2GO_RUN_EXTENSIONS' &>'/dev/null' && x2goserver-run-extensions "${SESSION_NAME}" 'fail-start' || true exit '12' fi echo "${X2GO_PORT}" echo "${X2GO_COOKIE}" echo "${X2GO_AGENT_PID}" echo "${SESSION_NAME}" echo "${GR_PORT}" echo "${SOUND_PORT}" echo "${FS_PORT}" if [[ "${X2GO_TELEKINESIS_ENABLED}" = '1' ]]; then echo "${TEKICTRL_PORT}" echo "${TEKIDATA_PORT}" fi x2goserver-4.1.0.3/x2goserver/bin/x2gosuspend-session0000755000000000000000000000635213377671145017443 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. usage() { echo "$(basename $0): needs as first argument. Alternatively, you can set \$X2GO_SESSION with the correct session name" 1>&2 exit -1 } if [ $# -eq 1 ]; then SESSION_NAME="$1" else SESSION_NAME="$X2GO_SESSION" fi if [ -z $SESSION_NAME ]; then usage fi X2GO_ROOT="${HOME}/.x2go" X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" X2GO_AGENT_PID=`$X2GO_LIB_PATH/x2gogetagent "$SESSION_NAME"` X2GO_AGENT_PID=`echo "$X2GO_AGENT_PID"| awk {'print $1'}` # workaround for knotify, keep silent in case no knotify is running killall -HUP knotify &>/dev/null # terminate x2godesktopsharing instance and remember that it was running... x2gofeature X2GO_DESKTOPSHARING &>/dev/null && x2gosuspend-desktopsharing "$SESSION_NAME" || true # run x2goserver-extensions for pre-suspend x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$SESSION_NAME" pre-suspend || true x2goumount-session "$SESSION_NAME" STATE=`$X2GO_LIB_PATH/x2gogetagentstate "$SESSION_NAME"` if [ "$STATE" == "RESUMING" ] || [ "$STATE" == "STARTING" ] || [ "$STATE" == "RUNNING" ] then if kill -HUP $X2GO_AGENT_PID &>/dev/null; then $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "session with ID $SESSION_NAME has been suspended successfully" # run x2goserver-extensions for post-suspend x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$SESSION_NAME" post-suspend || true $X2GO_LIB_PATH/x2gochangestatus 'S' "$SESSION_NAME" > /dev/null else err_msg="ERROR: failed to suspend session with ID $SESSION_NAME" echo "$err_msg" 1>&2 $X2GO_LIB_PATH/x2gosyslog "$0" "err" "$err_msg" # run x2goserver-extensions for fail-suspend x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$SESSION_NAME" fail-suspend || true # If we reach here it means that the x2goagent process of the session has vanisshed # If this happens then we mark the session as finished... $X2GO_LIB_PATH/x2gochangestatus 'F' "$SESSION_NAME" > /dev/null fi else $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "session with ID $SESSION_NAME is not in running state" fi # disable ssh-agent-forwarding socket file symlink X2GOSSH_AUTH_SOCK="$X2GO_ROOT/C-$SESSION_NAME/ssh-agent.PID" if [ -L "$X2GOSSH_AUTH_SOCK" ]; then rm -f "$X2GOSSH_AUTH_SOCK" fi x2goserver-4.1.0.3/x2goserver/bin/x2goterminate-session0000755000000000000000000000540413377671145017747 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. usage() { echo "$(basename $0): needs as first argument. Alternatively, you can set \$X2GO_SESSION with the correct session name" 1>&2 exit -1 } if [ $# -eq 1 ]; then SESSION_NAME="$1" else SESSION_NAME="$X2GO_SESSION" fi if [ -z $SESSION_NAME ]; then usage fi X2GO_ROOT="${HOME}/.x2go" X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" X2GO_AGENT_PID=`$X2GO_LIB_PATH/x2gogetagent "$SESSION_NAME"` X2GO_AGENT_PID=`echo "$X2GO_AGENT_PID"| awk {'print $1'}` # stop x2godesktopsharing process gracefully... x2gofeature X2GO_DESKTOPSHARING &>/dev/null && x2goterminate-desktopsharing "$SESSION_NAME" || true # run x2goserver-extensions for pre-terminate x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$SESSION_NAME" pre-terminate || true if kill -TERM $X2GO_AGENT_PID &>/dev/null; then $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "session with ID "$SESSION_NAME" has been terminated successfully" # run x2goserver-extensions for post-terminate x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$SESSION_NAME" post-terminate || true else err_msg="ERROR: failed to terminate session with ID $SESSION_NAME" # some x2goclient versions behave weirdly if we give an error message here, so we only write syslog for now... #echo "$err_msg" 1>&2 $X2GO_LIB_PATH/x2gosyslog "$0" "err" "$err_msg" # run x2goserver-extensions for fail-terminate x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$SESSION_NAME" fail-terminate || true fi # disable ssh-agent-forwarding socket file symlink X2GOSSH_AUTH_SOCK="$X2GO_ROOT/C-$SESSION_NAME/ssh-agent.PID" if [ -L "$X2GOSSH_AUTH_SOCK" ]; then rm -f "$X2GOSSH_AUTH_SOCK" fi $X2GO_LIB_PATH/x2gochangestatus 'F' "$SESSION_NAME" > /dev/null x2goserver-4.1.0.3/x2goserver/bin/x2goumount-session0000755000000000000000000001536613377671145017316 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Hostname; use Sys::Syslog qw( :standard :macros ); use File::BaseDir qw( xdg_config_home ); use File::Basename; use X2Go::Utils qw(source_environment); use X2Go::Server::DB qw(db_getdisplay db_getmounts db_deletemount); use X2Go::Log qw(loglevel); use X2Go::Utils qw(system_capture_merged_output); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); syslog('info', "x2goumount-session has been called with options: @ARGV"); my $tmp_dir = '/tmp'; my $session=shift || $ENV{'X2GO_SESSION'} or die "no valid session name that we can use"; my $only_path=shift; my $uname="$ENV{'USER'}"; my $serv=hostname; my $mdir="$tmp_dir/.x2go-$ENV{'USER'}/media"; my $spooldir="$tmp_dir/.x2go-$ENV{'USER'}/spool"; my $mimeboxdir="$tmp_dir/.x2go-$ENV{'USER'}/mimebox"; source_environment(xdg_config_home() . "/user-dirs.dirs"); if (($only_path) && (! ($only_path=~m/\/tmp\/.x2go-$uname\/media\/.*/ ))) { $only_path=~s/\/ramdrive\/mnt\///; # rewrite local unix path $only_path=~ s/\//_/g; # rewrite local Windows path $only_path=~ s/^([a-zA-Z]:)/_cygdrive_\1/; $only_path=~ s/://; $only_path=~ s/\\/_/g; $only_path=~ s/ /_/g; $only_path=~ s/\\040/_/g; ### FIXME: handle CDROM and Removable Media mounts here, as well!!! $only_path="$tmp_dir/.x2go-$ENV{'USER'}/media/disk/$only_path"; # ^^^^ syslog('debug',"x2goumount-session unmounting $only_path only"); } my $display=db_getdisplay($session); my @outp=db_getmounts($session); my $i; open (F,"; close(F); my $use_zenity=0; if (($ENV{'GNOME_DESKTOP_SESSION_ID'} ne "") || ($ENV{'MATE_DESKTOP_SESSION_ID'} ne "")) { $use_zenity=1; } for ($i=0;$i<@outp;$i++) { @outp[$i]=~s/ //g; chomp(@outp[$i]); chomp(@outp[$i]); chomp(@outp[$i]); my @line=split('\|',"@outp[$i]"); my $path="@line[0]:@line[1]"; if ($only_path) { if (@line[1] ne $only_path) { # this is for Python X2Go, the base of Windows mounted shares starts with _windrive or _uncpath, not _cygdrive my $only_path_windrive=$only_path; my $only_path_uncpath=$only_path; $only_path_windrive=~ s/_cygdrive_/_windrive_/; $only_path_uncpath=~ s/_cygdrive_/_uncpath_/; if ((@line[1] ne $only_path_windrive) && (@line[1] ne $only_path_uncpath)) { syslog('debug', "skipping non-requested path @line[1]"); goto cont; } if (@line[1] eq $only_path_windrive) { $only_path = $only_path_windrive; } if (@line[1] eq $only_path_uncpath) { $only_path = $only_path_uncpath; } } } my $j; my $found=0; my $remote; for ($j;$j<@mounts;$j++) { if (@mounts[$j]=~m/sshfs/ && @mounts[$j]=~m/@line[0]/ && @mounts[$j]=~m/@line[1]/ ) { $found=1; syslog('debug', "found mounted share @mounts[$j]"); $remote=(split(" ",@mounts[$j]))[0]; goto break; } } break: if ($found) { chdir($tmp_dir); if (system("fusermount", "-u", "@line[1]") == 0) { syslog('notice', "successfully unmounted \"@line[1]\""); } else { $ENV{'DISPLAY'}=":$display"; syslog('err', "ERROR: failed to unmount \"@line[1]\""); if ($use_zenity == 0) { system("type -p kdialog 1>/dev/null && kdialog --error \"ERROR (X2Go): Failed to unmount @line[1]\"&"); } else { system("type -p zenity 1>/dev/null && zenity --error --text \"ERROR (X2Go): Failed to unmount @line[1]\"&"); } } } if (!$found) { syslog('info', "SSHFS share already unmounted, taking care of further clean-up (".basename(@line[1]).")"); $remote = basename(@line[1]); } else { $remote=~s/\/cygdrive\///; $remote=~s/\/windrive\///; $remote=~s/\/uncpath\///; $remote=~s/\//_/g; $remote=~s/ /_/g; $remote=~s/\\040/_/g; $remote=(split(":","$remote"))[1]; } my $desktop_dir; if ( $ENV{'XDG_DESKTOP_DIR'} ) { $desktop_dir="$ENV{'XDG_DESKTOP_DIR'}"; } else { $desktop_dir="$ENV{'HOME'}/Desktop"; } my $current_desktop = 'NONE'; if (($session =~ m/_stDGNOME_dp/) && system_capture_merged_output("x2gofeature", "X2GO_GNOMEBINDINGS") == 0) { $current_desktop="-gnome"; } elsif (($session =~ m/_stDMATE_dp/) && system_capture_merged_output("x2gofeature", "X2GO_MATEBINDINGS") == 0) { $current_desktop="-mate"; } elsif (($session =~ m/_stDLXDE_dp/) && system_capture_merged_output("x2gofeature", "X2GO_LXDEBINDINGS") == 0) { $current_desktop="-lxde"; } elsif (($session =~ m/_st.*_dp/) && system_capture_merged_output("x2gofeature", "X2GO_FMBINDINGS") == 0) { $current_desktop=""; } if ("$current_desktop" ne "NONE") { my $desktop_file; if ( -f "$desktop_dir/$remote\ (sshfs-disk$current_desktop)") { $desktop_file = "$remote\ (sshfs-disk$current_desktop)"; } $remote=~s/%2framdrive%2fmnt%2f//; if ( -f "$desktop_dir/$remote\ (sshfs-removable$current_desktop)") { $desktop_file = "$remote\ (sshfs-removable$current_desktop)"; } if ( -f "$desktop_dir/$remote\ (sshfs-cdrom/$current_desktop)") { $desktop_file = "$remote\ (sshfs-cdrom$current_desktop)"; } if ( -f "$desktop_dir/$desktop_file" ) { syslog('info', "Attempting removal of desktop file ,,$desktop_dir/$desktop_file''"); open (DF,"<$desktop_dir/$desktop_file") or die "Can't open $desktop_file for reading"; my @desktop_file_content=; close(DF); if ( @desktop_file_content[1] =~ m/$session/ ) { syslog('info', "removing desktop icon ,,$desktop_dir/$desktop_file''"); unlink("$desktop_dir/$desktop_file"); } } } db_deletemount ($session, @line[1]); rmdir (@line[1]); cont: } # try to eliminate parent directory of mountpoints rmdir ("$mdir/disk"); rmdir ("$mdir/cd"); rmdir ("$mdir/rm"); rmdir ("$mdir"); if (( ! -d "$mdir" ) && ( -l "$ENV{'HOME'}/media" )) { system_capture_merged_output("rm", "-f", "$ENV{'HOME'}/media"); } rmdir ("$spooldir/C-$session"); rmdir ("$spooldir"); rmdir ("$mimeboxdir/C-$session"); rmdir ("$mimeboxdir"); # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/bin/x2goversion0000755000000000000000000000346613377671145015771 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2011-2018 Oleksandr Shneyder # Copyright (C) 2011-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. X2GO_LIB_PATH="$(x2gopath 'libexec')" "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "$(basename "${0}") called with options: ${@}" X2GO_VERSIONS_BASEPATH="$(dirname "${0}")/../share/x2go/versions" get_version() { grep -Ev "^#.*" "${1}" | head -n '1' | cut -d ' ' -f '1' } if [ -n "${1}" ]; then X2GO_COMPONENT="${1}" X2GO_COMPONENT_VERFILE="${X2GO_VERSIONS_BASEPATH}/VERSION.${X2GO_COMPONENT}" if [ -f "${X2GO_COMPONENT_VERFILE}" ]; then echo "$(get_version "${X2GO_COMPONENT_VERFILE}")" else echo "Version information for X2Go component '${X2GO_COMPONENT}' is not available." >&1 exit '1' fi else cd "${X2GO_VERSIONS_BASEPATH}" for compfile in "${X2GO_VERSIONS_BASEPATH}"/*; do X2GO_COMPONENT="$(echo "${compfile}" | cut -d '.' -f '2')" X2GO_COMPONENT_VERSION="$(get_version "${compfile}")" echo "${X2GO_COMPONENT}: ${X2GO_COMPONENT_VERSION}" done cd '-' >'/dev/null' fi exit '0' x2goserver-4.1.0.3/x2goserver-common/etc/x2goserver.conf0000644000000000000000000000356013377671145020017 0ustar [limit users] #user-foo=1 [limit groups] #bar-group=1 [security] # SSHFS umask for client-side folder sharing. Leave uncommented to keep the server's default umask #umask="0117" [superenicer] # enable the SupeReNicer code in x2gocleansessions, this will renice suspended sessions to nice level 19 # and renice them to level 0 if the session becomes marked as running again... enable=no # list of users that shall never be reniced #ignored_users= # force renicing of the complete user, don't set it to 'yes' unless you know what you are doing #force-user-renice=no # the normal nice level (for running sessions) #normal-nice-level=0 # the idle nice level (for suspended sessions) #idle-nice-level=19 [telekinesis] # telekinesis provides a bidirectional communication framework between X2Go Client # and X2Go Server enable=no [x2goagent] # Value can be either "host-based" or "pure-random". # This is currently a workaround for a bug in X2Go Client, that uses a 1:1 # mapping of source to destination ports for SSH tunnels. # This leads to problems if opening two (or more) instances of X2Go Client # and connecting to two machines that use the same tunneling ports. # Such a scenario is easy to trigger: make sure that both machines have run # no active sessions, than spawn one session on each machine. # Connecting to both at the same time will not be possible without a means # of randomization. # The randomization can either be "host-based", in which case the port will # be set to 30000 + (128 * last octet of IPv4 address) and does the job if # the last octet of the machine's IPv4 address is known to be unique, or # "pure-random" which uses the (not so truly random) bash ${RANDOM} # variable to fully randomize the port, i.e., 30000 + random(0..32767). port_randomization="pure-random" [log] # possible levels are: emerg, alert, crit, err, warning, notice, info, debug loglevel=notice x2goserver-4.1.0.3/x2goserver-common/etc/x2gosql/sql0000644000000000000000000000127713377671145017166 0ustar # postgres or sqlite or mysql backend=sqlite [postgres] host=localhost port=5432 # database admin (must have permissions to create databases and users) dbadmin=postgres # disable: SSL connections are never used # allow: try non-SSL, then SSL # prefer: try SSL, then non-SSL # require: connect only with SSL # default - prefer ssl=prefer [mysql] host=localhost port=3306 # database admin (must have permissions to create databases and users) dbadmin=root # hostmask for which connections will be allowed # % is a wild card, as usually in MySQL # wildcards and literal strings can be mixed, e.g., # %.example.com allows connections from all # remote hosts that match *.example.com. unet=my.organization x2goserver-4.1.0.3/x2goserver-common/lib/tmpfiles.d/x2goserver.conf0000644000000000000000000000001713377671145022051 0ustar x /tmp/.x2go-* x2goserver-4.1.0.3/x2goserver-common/Makefile0000755000000000000000000000571413377671145015735 0ustar #!/usr/bin/make -f SRC_DIR=$(CURDIR) SHELL=/bin/bash INSTALL_DIR=install -d -o root -g root -m 755 INSTALL_FILE=install -o root -g root -m 644 INSTALL_PROGRAM=install -o root -g root -m 755 RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty DESTDIR ?= PREFIX ?= /usr/local ETCDIR=/etc/x2go BINDIR=$(PREFIX)/bin SBINDIR=$(PREFIX)/sbin LIBDIR=$(PREFIX)/lib/x2go MANDIR=$(PREFIX)/share/man SHAREDIR=$(PREFIX)/share/x2go BIN_SCRIPTS=$(shell cd bin && echo *) SBIN_SCRIPTS=$(shell cd sbin && echo *) LIB_FILES=$(shell cd lib && echo *) FEATURE_SCRIPTS=$(shell cd share/x2gofeature.d && echo *.features) man_pages = `cd man && find * -type f` MAN2HTML_BIN = $(shell which man2html) MAN2HTML_SRC = man MAN2HTML_DEST = .build_man2html/html all: clean build build: build-arch build-indep build-arch: build-indep: build_man2html build_man2html: if [ -n "$(MAN2HTML_BIN)" ]; then \ mkdir -p $(MAN2HTML_DEST); \ for man_page in $(man_pages); do mkdir -p `dirname $(MAN2HTML_DEST)/$$man_page`; done; \ for man_page in $(man_pages); do $(MAN2HTML_BIN) $(MAN2HTML_SRC)/$$man_page > $(MAN2HTML_DEST)/$$man_page.html; done; \ fi clean: clean-arch clean-indep clean-arch: clean-indep: clean_man2html clean_man2html: rm -Rf `dirname $(MAN2HTML_DEST)` install: install_scripts install_config install_man install_version install_scripts: install_config: $(INSTALL_DIR) $(DESTDIR)$(ETCDIR) $(INSTALL_FILE) etc/x2goserver.conf $(DESTDIR)$(ETCDIR)/ $(INSTALL_DIR) $(DESTDIR)$(ETCDIR)/x2gosql $(INSTALL_DIR) $(DESTDIR)$(ETCDIR)/x2gosql/passwords $(INSTALL_FILE) etc/x2gosql/sql $(DESTDIR)$(ETCDIR)/x2gosql $(INSTALL_DIR) $(DESTDIR)/${PREFIX}/lib/tmpfiles.d || true $(INSTALL_FILE) lib/tmpfiles.d/x2goserver.conf $(DESTDIR)/${PREFIX}/lib/tmpfiles.d/ install_man: $(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man5 $(INSTALL_FILE) man/man5/*.5 $(DESTDIR)$(MANDIR)/man5 gzip -f $(DESTDIR)$(MANDIR)/man5/x2go*.5 install_version: $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/versions $(INSTALL_FILE) VERSION.x2goserver-common $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-common uninstall: uninstall_scripts uninstall_config uninstall_man uninstall_version uninstall_scripts: uninstall_config: $(RM_FILE) $(DESTDIR)$(ETCDIR)/x2goserver.conf $(RM_FILE) $(DESTDIR)$(ETCDIR)/x2gosql/sql $(RM_DIR) $(DESTDIR)$(ETCDIR)/x2gosql/passwords || true $(RM_DIR) $(DESTDIR)$(ETCDIR)/x2gosql || true $(RM_DIR) $(DESTDIR)$(ETCDIR) || true $(RM_FILE) $(DESTDIR)/${PREFIX}/lib/tmpfiles.d/x2goserver.conf $(RM_DIR) $(DESTDIR)/${PREFIX}/lib/tmpfiles.d || true uninstall_man: for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man5/$$file.5.gz; done for file in $(SBIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man5/$$file.5.gz; done $(RM_DIR) $(DESTDIR)$(MANDIR) || true uninstall_version: $(RM_FILE) $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-common $(RM_DIR) $(DESTDIR)$(SHAREDIR)/versions || true x2goserver-4.1.0.3/x2goserver-common/man/man5/x2goserver.conf.50000644000000000000000000000454213377671145021023 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2goserver.conf 5 "Nov 2018" "Version 4.1.0.3" "X2Go Server Configuration" .SH NAME x2goserver.conf \- X2Go Server Main Configuration File .SH SYNOPSIS 'nh .fi .ad 1 x2goserver.conf .SH DESCRIPTION \fBx2goserver.conf\fR is the main configuration file for X2Go Server and the \fBX2Go::Server\fR Perl API. .SH SECTIONS The \fBx2goserver.conf\fR's configuration file format is an INI-based configuration format. It falls apart into sections and options with their values. [section1] sec1option1 = valueA sec1option2 = valueB ... [section2] sec2option1 = valueC sec2option2 = valueD ... .SH SECTION [limit users] In this section you can list up Posix users known to the system and specify the max. number of allowed simultaneous X2Go sessions in an X2Go Server farm. .PP .SH SECTION [limit groups] In this section you can list up Posix group names known to the system and specify the max. number of allowed simultaneous X2Go sessions in an X2Go Server farm. The session limitation applies to all users in the specified groups. .PP If individual users are listed in section \fI[limit users]\fR and some of their groups are listed in section \fI[limit groups]\fR, then the maximum value of allowed sessions will be chosen. .PP If a user is a member of several of the specified groups under section \fI[limit groups]\fR, then the number of allowed simultaneous X2Go sessions for a certain user will be derived from the group with the most allowed sessions found under this section. .PP .SH SECTION [log] The \fI[log]\fR's section only option is the \fIloglevel\fR option. Allowed values are: .TP 5 emerg, alert, crit, err, warning, notice, info, debug. .PP The \fIloglevel\fR option controls the verbosity of the X2Go::Server Perl functions. The log output appears via LOCAL7 (normally: /var/log/syslog). .PP .SH EXAMPLE The below configuration file is the default after installation of X2Go Server: [limit users] #user-foo=1 [limit groups] #bar-group=1 [log] # possible levels are: # emerg, alert, crit, err, warning, notice, info, debug loglevel=notice .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver-common/VERSION.x2goserver-common0000644000000000000000000000001013377671145020715 0ustar 4.1.0.3 x2goserver-4.1.0.3/X2Go/Server/DB.pm0000644000000000000000000004622213377671145013545 0ustar # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # Copyright (C) 2017-2018 Walid Moghrabi # Copyright (C) 2018 Mihai Moldovan # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. package X2Go::Server::DB; =head1 NAME X2Go::Server::DB - X2Go Session Database package for Perl =head1 DESCRIPTION X2Go::Server::DB Perl package for X2Go::Server. =cut use strict; use DBI; use POSIX; use Sys::Syslog qw( :standard :macros ); use X2Go::Config qw( get_sqlconfig ); use X2Go::Log qw( loglevel ); use X2Go::Server::DB::PostgreSQL; #use X2Go::Server::DB::MySQL; use X2Go::Utils qw( system_capture_merged_output system_capture_stdout_output ); setlogmask( LOG_UPTO(loglevel()) ); my ($uname, $pass, $uid, $pgid, $quota, $comment, $gcos, $homedir, $shell, $expire) = getpwuid(getuid()); my $Config = get_sqlconfig(); my $x2go_lib_path=system_capture_stdout_output("x2gopath", "libexec"); my $backend=$Config->param("backend"); my $host; my $port; my $db="x2go_sessions"; my $dbpass; my $dbuser; my $sslmode; if ($backend ne 'postgres' && $backend ne 'mysql' && $backend ne 'sqlite') { die "unknown backend $backend"; } if ($backend eq 'mysql') { die "Backend currently not implemented!"; } use base 'Exporter'; our @EXPORT=('db_listsessions','db_listsessions_all', 'db_getservers', 'db_getagent', 'db_resume', 'db_changestatus', 'db_getstatus', 'db_getdisplays', 'db_insertsession', 'db_insertshadowsession', 'db_getports', 'db_insertport', 'db_rmport', 'db_createsession', 'db_createshadowsession', 'db_insertmount', 'db_getmounts', 'db_deletemount', 'db_getdisplay', 'dbsys_getmounts', 'dbsys_listsessionsroot', 'dbsys_listsessionsroot_all', 'dbsys_rmsessionsroot', 'dbsys_deletemounts', 'db_listshadowsessions','db_listshadowsessions_all'); sub dbsys_rmsessionsroot { my $sid=shift or die "argument \"session_id\" missed"; dbsys_deletemounts($sid); if($backend eq 'postgres') { X2Go::Server::DB::PostgreSQL::dbsys_rmsessionsroot($sid); } if ($backend eq 'mysql') { #X2Go::Server::DB::MySQL::dbsys_rmsessionsroot($sid); } if($backend eq 'sqlite') { system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "rmsessionsroot", "$sid"); } } sub dbsys_deletemounts { my $sid=shift or die "argument \"session_id\" missed"; if ($backend eq 'postgres') { X2Go::Server::DB::PostgreSQL::dbsys_deletemounts($sid); } if ($backend eq 'mysql') { #X2Go::Server::DB::MySQL::dbsys_deletemounts($sid); } if ($backend eq 'sqlite') { system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "deletemounts", "$sid"); } syslog('debug', "dbsys_deletemounts called, session ID: $sid"); } sub dbsys_listsessionsroot { my $server=shift or die "argument \"server\" missed"; if ($backend eq 'postgres') { return X2Go::Server::DB::PostgreSQL::dbsys_listsessionsroot($server); } if ($backend eq 'mysql') { #return X2Go::Server::DB::MySQL::dbsys_listsessionsroot($server); } if($backend eq 'sqlite') { return split("\n",system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "listsessionsroot", "$server")); } } sub dbsys_listsessionsroot_all { if ($backend eq 'postgres') { return X2Go::Server::DB::PostgreSQL::dbsys_listsessionsroot_all(); } if ($backend eq 'mysql') { #return X2Go::Server::DB::MySQL::dbsys_listsessionsroot_all(); } if ($backend eq 'sqlite') { return split("\n",system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "listsessionsroot_all")); } } sub dbsys_getmounts { my @mounts; my $sid=shift or die "argument \"session_id\" missed"; if ($backend eq 'postgres') { @mounts = X2Go::Server::DB::PostgreSQL::dbsys_getmounts($sid); } if ($backend eq 'mysql') { #@mounts = X2Go::Server::DB::MySQL::dbsys_getmounts($sid); } if ($backend eq 'sqlite') { @mounts = split("\n",system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "getmounts", "$sid")); } my $log_retval = join(" ", @mounts); syslog('debug', "dbsys_getmounts called, session ID: $sid; return value: $log_retval"); return @mounts; } sub db_getmounts { my @mounts; my $sid=shift or die "argument \"session_id\" missed"; if($backend eq 'postgres') { @mounts = X2Go::Server::DB::PostgreSQL::db_getmounts($sid); } if ($backend eq 'mysql') { #@mounts = X2Go::Server::DB::MySQL::db_getmounts($sid); } if ($backend eq 'sqlite') { @mounts = split("\n",system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "getmounts", "$sid")); } my $log_retval = join(" ", @mounts); syslog('debug', "db_getmounts called, session ID: $sid; return value: $log_retval"); return @mounts; } sub db_deletemount { my $sid=shift or die "argument \"session_id\" missed"; my $path=shift or die "argument \"path\" missed"; if ($backend eq 'postgres') { X2Go::Server::DB::PostgreSQL::db_deletemount($sid, $path); } if ($backend eq 'mysql') { #X2Go::Server::DB::MySQL::db_deletemount($sid, $path); } if ($backend eq 'sqlite') { system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "deletemount", "$sid", "$path"); } syslog('debug', "db_deletemount called, session ID: $sid, path: $path"); } sub db_insertmount { my $sid=shift or die "argument \"session_id\" missed"; my $path=shift or die "argument \"path\" missed"; my $client=shift or die "argument \"client\" missed"; my $res_ok=0; if ($backend eq 'postgres') { $res_ok = X2Go::Server::DB::PostgreSQL::db_insertmount($sid, $path, $client); } if ($backend eq 'mysql') { #$res_ok = X2Go::Server::DB::MySQL::db_insertmount($sid, $path, $client); } if ($backend eq 'sqlite') { if( system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "insertmount", "$sid", "$path", "$client") eq "ok") { $res_ok=1; } } syslog('debug', "db_insertmount called, session ID: $sid, path: $path, client: $client; return value: $res_ok"); return $res_ok; } sub db_insertsession { my $display=shift or die "argument \"display\" missed"; my $server=shift or die "argument \"server\" missed"; my $sid=shift or die "argument \"session_id\" missed"; if ($backend eq 'postgres') { X2Go::Server::DB::PostgreSQL::db_insertsession($display, $server, $sid); } if ($backend eq 'mysql') { #X2Go::Server::DB::MySQL::db_insertsession($display, $server, $sid); } if ($backend eq 'sqlite') { my $err=system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "insertsession", "$display", "$server", "$sid"); if ($err ne "ok") { die "$err: $x2go_lib_path/libx2go-server-db-sqlite3-wrapper insertsession $display $server $sid"; } } syslog('debug', "db_insertsession called, session ID: $sid, server: $server, session ID: $sid"); } sub db_insertshadowsession { my $display=shift or die "argument \"display\" missed"; my $server=shift or die "argument \"server\" missed"; my $sid=shift or die "argument \"session_id\" missed"; my $shadreq_user=shift or die "argument \"shadreq_user\" missed"; if ($backend eq 'postgres') { X2Go::Server::DB::PostgreSQL::db_insertshadowsession($display, $server, $sid, $shadreq_user); } if ($backend eq 'mysql') { #X2Go::Server::DB::MySQL::db_insertshadowsession($display, $server, $sid, $shadreq_user); } if ($backend eq 'sqlite') { my $err=system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "insertshadowsession", "$display", "$server", "$sid", "$shadreq_user"); if ($err ne "ok") { die "$err: $x2go_lib_path/libx2go-server-db-sqlite3-wrapper insertshadowsession $display $server $sid $shadreq_user"; } } syslog('debug', "db_insertshadowsession called, session ID: $sid, server: $server, session ID: $sid, shadowing requesting user: $shadreq_user"); } sub db_createsession { my $sid=shift or die "argument \"session_id\" missed"; my $cookie=shift or die"argument \"cookie\" missed"; my $pid=shift or die"argument \"pid\" missed"; my $client=shift or die"argument \"client\" missed"; my $gr_port=shift or die"argument \"gr_port\" missed"; my $snd_port=shift or die"argument \"snd_port\" missed"; my $fs_port=shift or die"argument \"fs_port\" missed"; my $tekictrl_port=shift or die"argument \"tekictrl_port\" missed"; my $tekidata_port=shift or die"argument \"tekidata_port\" missed"; if ($backend eq 'postgres') { X2Go::Server::DB::PostgreSQL::db_createsession($sid, $cookie, $pid, $client, $gr_port, $snd_port, $fs_port, $tekictrl_port, $tekidata_port); } if ($backend eq 'mysql') { #X2Go::Server::DB::MySQL::db_createsession($sid, $cookie, $pid, $client, $gr_port, $snd_port, $fs_port, $tekictrl_port, $tekidata_port); } if ($backend eq 'sqlite') { my $err= system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "createsession", "$sid", "$cookie", "$pid", "$client", "$gr_port", "$snd_port", "$fs_port", "$tekictrl_port", "$tekidata_port"); if ($err ne "ok") { die $err; } } syslog('debug', "db_createsession called, session ID: $sid, cookie: $cookie, client: $client, pid: $pid, graphics port: $gr_port, sound port: $snd_port, file sharing port: $fs_port. telekinesis ctrl port: $tekictrl_port, telekinesis data port: $tekidata_port"); } sub db_createshadowsession { my $sid=shift or die "argument \"session_id\" missed"; my $cookie=shift or die"argument \"cookie\" missed"; my $pid=shift or die"argument \"pid\" missed"; my $client=shift or die"argument \"client\" missed"; my $gr_port=shift or die"argument \"gr_port\" missed"; my $snd_port=shift or die"argument \"snd_port\" missed"; my $fs_port=shift or die"argument \"fs_port\" missed"; my $shadreq_user=shift or die "argument \"shadreq_user\" missed"; if ($backend eq 'postgres') { # for PostgreSQL we can use the normal db_createsession code... X2Go::Server::DB::PostgreSQL::db_createsession($sid, $cookie, $pid, $client, $gr_port, $snd_port, $fs_port, -1, -1); } if ($backend eq 'mysql') { # for MySQL we can use the normal db_createsession code... #X2Go::Server::DB::MySQL::db_createsession($sid, $cookie, $pid, $client, $gr_port, $snd_port, $fs_port, -1, -1); } if ($backend eq 'sqlite') { my $err=system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "createshadowsession", "$sid", "$cookie", "$pid", "$client", "$gr_port", "$snd_port", "$fs_port", "$shadreq_user"); if ($err ne "ok") { die $err; } } syslog('debug', "db_createshadowsession called, session ID: $sid, cookie: $cookie, client: $client, pid: $pid, graphics port: $gr_port, sound port: $snd_port, file sharing port: $fs_port, shadowing requesting user: $shadreq_user"); } sub db_insertport { my $server=shift or die "argument \"server\" missed"; my $sid=shift or die "argument \"session_id\" missed"; my $sshport=shift or die "argument \"port\" missed"; if ($backend eq 'postgres') { X2Go::Server::DB::PostgreSQL::db_insertport($server, $sid, $sshport); } if ($backend eq 'mysql') { #X2Go::Server::DB::MySQL::db_insertport($server, $sid, $sshport); } if ($backend eq 'sqlite') { my $err=system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "insertport", "$server", "$sid", "$sshport"); if ($err ne "ok") { die $err; } } syslog('debug', "db_insertport called, session ID: $sid, server: $server, SSH port: $sshport"); } sub db_rmport { my $server=shift or die "argument \"server\" missed"; my $sid=shift or die "argument \"session_id\" missed"; my $sshport=shift or die "argument \"port\" missed"; if ($backend eq 'postgres') { X2Go::Server::DB::PostgreSQL::db_rmport($server, $sid, $sshport); } if ($backend eq 'mysql') { #X2Go::Server::DB::MySQL::db_rmport($server, $sid, $sshport); } if ($backend eq 'sqlite') { system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "rmport", "$server", "$sid", "$sshport"); } syslog('debug', "db_rmport called, session ID: $sid, server: $server, SSH port: $sshport"); } sub db_resume { my $client=shift or die "argument \"client\" missed"; my $sid=shift or die "argument \"session_id\" missed"; my $gr_port=shift or die "argument \"gr_port\" missed"; my $snd_port=shift or die "argument \"snd_port\" missed"; my $fs_port=shift or die "argument \"fs_port\" missed"; my $tekictrl_port=shift or die"argument \"tekictrl_port\" missed"; my $tekidata_port=shift or die"argument \"tekidata_port\" missed"; if ($backend eq 'postgres') { X2Go::Server::DB::PostgreSQL::db_resume($client, $sid, $gr_port, $snd_port, $fs_port, $tekictrl_port, $tekidata_port); } if ($backend eq 'mysql') { #X2Go::Server::DB::MySQL::db_resume($client, $sid, $gr_port, $snd_port, $fs_port, $tekictrl_port, $tekidata_port); } if ($backend eq 'sqlite') { system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "resume", "$client", "$sid", "$gr_port", "$snd_port", "$fs_port", "$tekictrl_port", "$tekidata_port"); } syslog('debug', "db_resume called, session ID: $sid, client: $client, gr_port: $gr_port, sound_port: $snd_port, fs_port: $fs_port, telekinesis ctrl port: $tekictrl_port, telekinesis data port: $tekidata_port"); } sub db_changestatus { my $status=shift or die "argument \"status\" missed"; my $sid=shift or die "argument \"session_id\" missed"; if ($backend eq 'postgres') { X2Go::Server::DB::PostgreSQL::db_changestatus($status, $sid); } if ($backend eq 'mysql') { #X2Go::Server::DB::MySQL::db_changestatus($status, $sid); } if ($backend eq 'sqlite') { system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "changestatus", "$status", "$sid"); } syslog('debug', "db_changestatus called, session ID: $sid, new status: $status"); } sub db_getstatus { my $sid=shift or die "argument \"session_id\" missed"; my $status=''; if ($backend eq 'postgres') { $status = X2Go::Server::DB::PostgreSQL::db_getstatus($sid); } if ($backend eq 'mysql') { #$status = X2Go::Server::DB::MySQL::db_getstatus($sid); } if ($backend eq 'sqlite') { $status=system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "getstatus", "$sid"); } syslog('debug', "db_getstatus called, session ID: $sid, return value: $status"); return $status; } sub db_getdisplays { my @displays; #ignore $server my $server=shift or die "argument \"server\" missed"; if ($backend eq 'postgres') { @displays = X2Go::Server::DB::PostgreSQL::db_getdisplays($server); } if ($backend eq 'mysql') { #@displays = X2Go::Server::DB::MySQL::db_getdisplays($server); } if ($backend eq 'sqlite') { @displays = split("\n",system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "getdisplays", "$server")); } my $log_retval = join(" ", @displays); syslog('debug', "db_getdisplays called, server: $server; return value: $log_retval"); return @displays; } sub db_getports { my @ports; #ignore $server my $server=shift or die "argument \"server\" missed"; if ($backend eq 'postgres') { @ports = X2Go::Server::DB::PostgreSQL::db_getports($server); } if ($backend eq 'mysql') { #@ports = X2Go::Server::DB::MySQL::db_getports($server); } if ($backend eq 'sqlite') { @ports = split("\n",system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "getports", "$server")); } my $log_retval = join(" ", @ports); syslog('debug', "db_getports called, server: $server; return value: $log_retval"); return @ports; } sub db_getservers { my @servers; if ($backend eq 'postgres') { @servers = X2Go::Server::DB::PostgreSQL::db_getservers(); } if ($backend eq 'mysql') { #@servers = X2Go::Server::DB::MySQL::db_getservers(); } if ($backend eq 'sqlite') { @servers = split("\n",system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "getservers")); } my $log_retval = join(" ", @servers); syslog('debug', "db_getservers called, return value: $log_retval"); return @servers; } sub db_getagent { my $agent; my $sid=shift or die "argument \"session_id\" missed"; if ($backend eq 'postgres') { $agent = X2Go::Server::DB::PostgreSQL::db_getagent($sid); } if ($backend eq 'mysql') { #$agent = X2Go::Server::DB::MySQL::db_getagent($sid); } if($backend eq 'sqlite') { $agent=system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "getagent", "$sid"); } syslog('debug', "db_getagent called, session ID: $sid; return value: $agent"); return $agent; } sub db_getdisplay { my $display; my $sid=shift or die "argument \"session_id\" missed"; if ($backend eq 'postgres') { $display = X2Go::Server::DB::PostgreSQL::db_getdisplay($sid); } if ($backend eq 'mysql') { #$display = X2Go::Server::DB::MySQL::db_getdisplay($sid); } if ($backend eq 'sqlite') { $display=system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "getdisplay", "$sid"); } syslog('debug', "db_getdisplay called, session ID: $sid; return value: $display"); return $display; } sub db_listsessions { my $server=shift or die "argument \"server\" missed"; if ($backend eq 'postgres') { return X2Go::Server::DB::PostgreSQL::db_listsessions($server); } if ($backend eq 'mysql') { #return X2Go::Server::DB::MySQL::db_listsessions($server); } if ($backend eq 'sqlite') { return split("\n",system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "listsessions", "$server")); } } sub db_listsessions_all { if($backend eq 'postgres') { return X2Go::Server::DB::PostgreSQL::db_listsessions_all(); } if ($backend eq 'mysql') { #return X2Go::Server::DB::MySQL::db_listsessions_all(); } if ($backend eq 'sqlite') { return split("\n",system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "listsessions_all")); } } sub db_listshadowsessions { my $server=shift or die "argument \"server\" missed"; if ($backend eq 'postgres') { return X2Go::Server::DB::PostgreSQL::db_listshadowsessions($server); } if ($backend eq 'mysql') { #return X2Go::Server::DB::MySQL::db_listshadowsessions($server); } if ($backend eq 'sqlite') { return split("\n",system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "listshadowsessions", "$server")); } } sub db_listshadowsessions_all { if($backend eq 'postgres') { return X2Go::Server::DB::PostgreSQL::db_listshadowsessions_all(); } if ($backend eq 'mysql') { #return X2Go::Server::DB::MySQL::db_listshadowsessions_all(); } if ($backend eq 'sqlite') { return split("\n",system_capture_merged_output("$x2go_lib_path/libx2go-server-db-sqlite3-wrapper", "listshadowsessions_all")); } } x2goserver-4.1.0.3/X2Go/Server/DB/PostgreSQL.pm0000644000000000000000000005744413377671145015560 0ustar # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. package X2Go::Server::DB::PostgreSQL; =head1 NAME X2Go::Server::DB::PostgreSQL - X2Go Session Database package for Perl (PostgreSQL backend) =head1 DESCRIPTION X2Go::Server::DB::PostgreSQL Perl package for X2Go::Server. =cut use strict; use DBI; use POSIX; use Sys::Syslog qw( :standard :macros ); use File::Copy; use X2Go::Log qw( loglevel ); use X2Go::Config qw( get_config get_sqlconfig ); use X2Go::Utils qw( sanitizer system_capture_stdout_output is_true ); setlogmask( LOG_UPTO(loglevel()) ); use base 'Exporter'; our @EXPORT=('db_listsessions','db_listsessions_all', 'db_getservers', 'db_getagent', 'db_resume', 'db_changestatus', 'db_getstatus', 'db_getdisplays', 'db_insertsession', 'db_insertshadowsession', 'db_getports', 'db_insertport', 'db_rmport', 'db_createsession', 'db_insertmount', 'db_getmounts', 'db_deletemount', 'db_getdisplay', 'dbsys_getmounts', 'dbsys_listsessionsroot', 'dbsys_listsessionsroot_all', 'dbsys_rmsessionsroot', 'dbsys_deletemounts', 'db_listshadowsessions','db_listshadowsessions_all'); my ($uname, $pass, $uid, $pgid, $quota, $comment, $gcos, $homedir, $shell, $expire) = getpwuid(getuid()); my $host; my $port; my $db="x2go_sessions"; my $dbpass; my $dbuser; my $sslmode; my $with_TeKi; sub init_db { # the $Config is required later (see below...) my $Config = get_config; $with_TeKi = is_true($Config->param("telekinesis.enable")); if ( ! ( $dbuser and $dbpass ) ) { my $SqlConfig = get_sqlconfig; my $x2go_lib_path=system_capture_stdout_output("x2gopath", "libexec"); my $backend=$SqlConfig->param("backend"); if ( $backend ne "postgres" ) { die "X2Go server is not configured to use the PostgreSQL session db backend"; } $host=$SqlConfig->param("postgres.host"); $port=$SqlConfig->param("postgres.port"); if (!$host) { $host='localhost'; } if (!$port) { $port='5432'; } my $passfile; my $old_location; if ($uname eq 'root') { $dbuser='x2godbuser'; $old_location = "/etc/x2go/x2gosql/passwords/x2goadmin"; $passfile="/etc/x2go/x2gosql/passwords/x2gopgadmin"; } else { $dbuser="x2gouser_$uname"; $old_location = "$homedir/.x2go/sqlpass"; $passfile="$homedir/.x2go/pgsqlpass"; } my $move_file = 0; if ((-e $old_location) && (-e $passfile)) { if (-z $passfile) { $move_file = 1; } else { die "Detected existing files in both the legacy location '$old_location' and new location '$passfile'. New location file is non-empty, aborting.
"; } } if ((-e $old_location) && (! -e $passfile)) { $move_file = 1; } if ($move_file) { # Password file needs move. move($old_location, $passfile) or die "Unable to move PostgreSQL user password file from '$old_location' to '$passfile'
"; } $sslmode=$SqlConfig->param("postgres.ssl"); if (!$sslmode) { $sslmode="prefer"; } open (FL,"< $passfile") or die "Can't read password file $passfile
Use x2godbadmin on server to configure database access for user $uname
"; $dbpass=; close(FL); chomp($dbpass); } } sub dbsys_rmsessionsroot { init_db(); my $sid=shift or die "argument \"session_id\" missed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("delete from sessions where session_id='$sid'"); $sth->execute() or die; $sth=$dbh->prepare("delete from used_ports where session_id='$sid'"); $sth->execute() or die; $sth->finish(); undef $dbh; return 1; } sub dbsys_deletemounts { init_db(); my $sid=shift or die "argument \"session_id\" missed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("delete from mounts where session_id='$sid'"); $sth->execute(); $sth->finish(); undef $dbh; return 1; } sub dbsys_listsessionsroot { init_db(); my $server=shift or die "argument \"server\" missed"; my @strings; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth; if ($with_TeKi) { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, to_char(init_time,'YYYY-MM-DD\"T\"HH24:MI:SS'),cookie,client,gr_port, sound_port,to_char(last_time,'YYYY-MM-DD\"T\"HH24:MI:SS'),uname, to_char(now()-init_time,'SSSS'),fs_port,tekictrl_port,tekidata_port from sessions where server='$server' order by status desc"); } else { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, to_char(init_time,'YYYY-MM-DD\"T\"HH24:MI:SS'),cookie,client,gr_port, sound_port,to_char(last_time,'YYYY-MM-DD\"T\"HH24:MI:SS'),uname, to_char(now()-init_time,'SSSS'),fs_port from sessions where server='$server' order by status desc"); } $sth->execute()or die; my @data; my $i=0; while (@data = $sth->fetchrow_array) { @strings[$i++]=join('|',@data); } $sth->finish(); undef $dbh; return @strings; } sub dbsys_listsessionsroot_all { init_db(); my @strings; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth; if ($with_TeKi) { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, to_char(init_time,'YYYY-MM-DD\"T\"HH24:MI:SS'),cookie,client,gr_port, sound_port,to_char(last_time,'YYYY-MM-DD\"T\"HH24:MI:SS'),uname, to_char(now()-init_time,'SSSS'),fs_port,tekictrl_port,tekidata_port from sessions order by status desc"); } else { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, to_char(init_time,'YYYY-MM-DD\"T\"HH24:MI:SS'),cookie,client,gr_port, sound_port,to_char(last_time,'YYYY-MM-DD\"T\"HH24:MI:SS'),uname, to_char(now()-init_time,'SSSS'),fs_port from sessions order by status desc"); } $sth->execute()or die; my @data; my $i=0; while (@data = $sth->fetchrow_array) { @strings[$i++]=join('|',@data); } $sth->finish(); undef $dbh; return @strings; } sub dbsys_getmounts { init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my @mounts; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("select client, path from mounts where session_id='$sid'"); $sth->execute()or die; my @data; my $i=0; while (@data = $sth->fetchrow_array) { @mounts[$i++]=join("|",@data); } $sth->finish(); undef $dbh; return @mounts; } sub db_getmounts { init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my @mounts; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("select client, path from mounts_view where session_id='$sid'"); $sth->execute()or die; my @data; my $i=0; while (@data = $sth->fetchrow_array) { @mounts[$i++]=join("|",@data); } $sth->finish(); undef $dbh; return @mounts; } sub db_deletemount { init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $path=shift or die "argument \"path\" missed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("delete from mounts_view where session_id='$sid' and path='$path'"); $sth->execute(); $sth->finish(); undef $dbh; return 1; } sub db_insertmount { init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $path=shift or die "argument \"path\" missed"; my $client=shift or die "argument \"client\" missed"; my $res_ok=0; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("insert into mounts (session_id,path,client) values ('$sid','$path','$client')"); $sth->execute(); if (!$sth->err()) { $res_ok = 1; } $sth->finish(); undef $dbh; return $res_ok; } sub db_insertsession { init_db(); my $display=shift or die "argument \"display\" missed"; $display = sanitizer('num', $display) or die "argument \"display\" malformed"; my $server=shift or die "argument \"server\" missed"; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("insert into sessions (display,server,uname,session_id) values ('$display','$server','$uname','$sid')"); $sth->execute()or die $_; $sth->finish(); undef $dbh; return 1; } sub db_insertshadowsession { init_db(); my $display=shift or die "argument \"display\" missed"; $display = sanitizer('num', $display) or die "argument \"display\" malformed"; my $server=shift or die "argument \"server\" missed"; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $shadreq_user=shift or die "argument \"shadreq_user\" missed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("insert into sessions (display,server,uname,session_id) values ('$display','$server','$shadreq_user','$sid')"); $sth->execute()or die $_; $sth->finish(); undef $dbh; return 1; } sub db_createsession { init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $cookie=shift or die"argument \"cookie\" missed"; my $pid=shift or die"argument \"pid\" missed"; $pid = sanitizer('num', $pid) or die "argument \"pid\" malformed"; my $client=shift or die"argument \"client\" missed"; my $gr_port=shift or die"argument \"gr_port\" missed"; $gr_port = sanitizer('num', $gr_port) or die "argument \"gr_port\" malformed"; my $snd_port=shift or die"argument \"snd_port\" missed"; $snd_port = sanitizer('num', $snd_port) or die "argument \"snd_port\" malformed"; my $fs_port=shift or die"argument \"fs_port\" missed"; $fs_port = sanitizer('num', $fs_port) or die "argument \"fs_port\" malformed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth; if ($with_TeKi) { my $tekictrl_port=shift or die"argument \"tekictrl_port\" missed"; $tekictrl_port = sanitizer('pnnum', $tekictrl_port) or die "argument \"tekictrl_port\" malformed"; my $tekidata_port=shift or die"argument \"tekidata_port\" missed"; $tekidata_port = sanitizer('pnnum', $tekidata_port) or die "argument \"tekidata_port\" malformed"; $sth=$dbh->prepare("update sessions_view set status='R',last_time=now(), cookie='$cookie',agent_pid='$pid',client='$client',gr_port='$gr_port', sound_port='$snd_port',fs_port='$fs_port',tekictrl_port='$tekictrl_port', tekidata_port='$tekidata_port' where session_id='$sid'"); } else { $sth=$dbh->prepare("update sessions_view set status='R',last_time=now(), cookie='$cookie',agent_pid='$pid',client='$client',gr_port='$gr_port', sound_port='$snd_port',fs_port='$fs_port' where session_id='$sid'"); } $sth->execute() or die; $sth->finish(); undef $dbh; return 1; } sub db_insertport { init_db(); my $server=shift or die "argument \"server\" missed"; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $sshport=shift or die "argument \"port\" missed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("insert into used_ports (server,session_id,port) values ('$server','$sid','$sshport')"); $sth->execute()or die; $sth->finish(); undef $dbh; return 1; } sub db_rmport { init_db(); my $server=shift or die "argument \"server\" missed"; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $sshport=shift or die "argument \"port\" missed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("delete from used_ports where server='$server' and session_id='$sid' and port='$sshport'"); $sth->execute()or die; $sth->finish(); undef $dbh; return 1; } sub db_resume { init_db(); my $client=shift or die "argument \"client\" missed"; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $gr_port=shift or die "argument \"gr_port\" missed"; $gr_port = sanitizer('num', $gr_port) or die "argument \"gr_port\" malformed"; my $snd_port=shift or die "argument \"sound_port\" missed"; $snd_port = sanitizer('num', $snd_port) or die "argument \"snd_port\" malformed"; my $fs_port=shift or die "argument \"fs_port\" missed"; $fs_port = sanitizer('num', $fs_port) or die "argument \"fs_port\" malformed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth; if ($with_TeKi) { my $tekictrl_port=shift or die"argument \"tekictrl_port\" missed"; $tekictrl_port = sanitizer('pnnum', $tekictrl_port) or die "argument \"tekictrl_port\" malformed"; my $tekidata_port=shift or die"argument \"tekidata_port\" missed"; $tekidata_port = sanitizer('pnnum', $tekidata_port) or die "argument \"tekidata_port\" malformed"; $sth=$dbh->prepare("update sessions_view set last_time=now(),status='R',client='$client',gr_port='$gr_port', sound_port='$snd_port',fs_port='$fs_port',tekictrl_port='$tekictrl_port', tekidata_port='$tekidata_port' where session_id = '$sid'"); } else { $sth=$dbh->prepare("update sessions_view set last_time=now(),status='R',client='$client',gr_port='$gr_port', sound_port='$snd_port',fs_port='$fs_port' where session_id = '$sid'"); } $sth->execute()or die; $sth->finish(); undef $dbh; return 1; } sub db_changestatus { init_db(); my $status=shift or die "argument \"status\" missed"; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("update sessions_view set last_time=now(),status='$status' where session_id = '$sid'"); $sth->execute()or die; $sth->finish(); undef $dbh; return 1; } sub db_getstatus { init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $status=''; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("select status from sessions_view where session_id = '$sid'"); $sth->execute($sid) or die; my @data; if (@data = $sth->fetchrow_array) { $status=@data[0]; } $sth->finish(); undef $dbh; return $status; } sub db_getdisplays { init_db(); #ignore $server my $server=shift or die "argument \"server\" missed"; my @displays; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("select display from servers_view"); $sth->execute()or die; my @data; my $i=0; while (@data = $sth->fetchrow_array) { @displays[$i++]='|'.@data[0].'|'; } $sth->finish(); undef $dbh; return @displays; } sub db_getports { init_db(); my @ports; #ignore $server my $server=shift or die "argument \"server\" missed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("select port from ports_view"); $sth->execute()or die; my @data; my $i=0; while (@data = $sth->fetchrow_array) { @ports[$i++]='|'.@data[0].'|'; } $sth->finish(); undef $dbh; return @ports; } sub db_getservers { init_db(); my @servers; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("select server,count(*) from servers_view where status != 'F' group by server"); $sth->execute()or die; my @data; my $i=0; while (@data = $sth->fetchrow_array) { @servers[$i++]=@data[0]." ".@data[1]; } $sth->finish(); undef $dbh; return @servers; } sub db_getagent { init_db(); my $agent; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("select agent_pid from sessions_view where session_id ='$sid'"); $sth->execute()or die; my @data; my $i=0; if (@data = $sth->fetchrow_array) { $agent=@data[0]; } $sth->finish(); undef $dbh; return $agent; } sub db_getdisplay { init_db(); my $display; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("select display from sessions_view where session_id ='$sid'"); $sth->execute() or die; my @data; my $i=0; if (@data = $sth->fetchrow_array) { $display=@data[0]; } $sth->finish(); undef $dbh; return $display; } sub db_listsessions { init_db(); my $server=shift or die "argument \"server\" missed"; my @sessions; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth; if ($with_TeKi) { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, to_char(init_time,'YYYY-MM-DD\"T\"HH24:MI:SS'), cookie, client, gr_port, sound_port, to_char( last_time, 'YYYY-MM-DD\"T\"HH24:MI:SS'), uname, to_char(now()- init_time,'SSSS'), fs_port, tekictrl_port, tekidata_port from sessions_view where status !='F' and server='$server' and (session_id not like '%XSHAD%') order by status desc"); } else { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, to_char(init_time,'YYYY-MM-DD\"T\"HH24:MI:SS'), cookie, client, gr_port, sound_port, to_char( last_time, 'YYYY-MM-DD\"T\"HH24:MI:SS'), uname, to_char(now()- init_time,'SSSS'), fs_port from sessions_view where status !='F' and server='$server' and (session_id not like '%XSHAD%') order by status desc"); } $sth->execute() or die; my @data; my $i=0; while (@data = $sth->fetchrow_array) { @sessions[$i++]=join('|',@data); } $sth->finish(); undef $dbh; return @sessions; } sub db_listsessions_all { init_db(); my @sessions; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth; if ($with_TeKi) { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, to_char(init_time,'YYYY-MM-DD\"T\"HH24:MI:SS'), cookie, client, gr_port, sound_port, to_char( last_time, 'YYYY-MM-DD\"T\"HH24:MI:SS'), uname, to_char(now()- init_time,'SSSS'), fs_port, tekictrl_port, tekidata_port from sessions_view where status !='F' and (session_id not like '%XSHAD%') order by status desc"); } else { $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, to_char(init_time,'YYYY-MM-DD\"T\"HH24:MI:SS'), cookie, client, gr_port, sound_port, to_char( last_time, 'YYYY-MM-DD\"T\"HH24:MI:SS'), uname, to_char(now()- init_time,'SSSS'), fs_port from sessions_view where status !='F' and (session_id not like '%XSHAD%') order by status desc"); } $sth->execute()or die; my @data; my $i=0; while (@data = $sth->fetchrow_array) { @sessions[$i++]=join('|',@data); } $sth->finish(); undef $dbh; return @sessions; } sub db_listshadowsessions { init_db(); my $server=shift or die "argument \"server\" missed"; my @sessions; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, to_char(init_time,'YYYY-MM-DD\"T\"HH24:MI:SS'), cookie, client, gr_port, sound_port, to_char( last_time, 'YYYY-MM-DD\"T\"HH24:MI:SS'), uname, to_char(now()- init_time,'SSSS'), fs_port from sessions_view where status !='F' and server='$server' and (session_id like '%XSHAD%') order by status desc"); $sth->execute() or die; my @data; my $i=0; while (@data = $sth->fetchrow_array) { @sessions[$i++]=join('|',@data); } $sth->finish(); undef $dbh; return @sessions; } sub db_listshadowsessions_all { init_db(); my @sessions; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, to_char(init_time,'YYYY-MM-DD\"T\"HH24:MI:SS'), cookie, client, gr_port, sound_port, to_char( last_time, 'YYYY-MM-DD\"T\"HH24:MI:SS'), uname, to_char(now()- init_time,'SSSS'), fs_port from sessions_view where status !='F' and (session_id is like '%XSHAD%') order by status desc"); $sth->execute()or die; my @data; my $i=0; while (@data = $sth->fetchrow_array) { @sessions[$i++]=join('|',@data); } $sth->finish(); undef $dbh; return @sessions; } 1; x2goserver-4.1.0.3/X2Go/Server/DB/SQLite3.pm0000644000000000000000000005531713377671145014776 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. package X2Go::Server::DB::SQLite3; =head1 NAME X2Go::Server::DB::SQLite3 - X2Go Session Database package for Perl (SQLite3 backend) =head1 DESCRIPTION X2Go::Server::DB::SQLite3 Perl package for X2Go::Server. =cut use strict; use DBI; use POSIX; #### NOTE: the default X2Go server setups runs the code in this package #### via a setgid wrapper (where is group ,,x2gouser''). #### It is intended that the code in this package cannot do system() calls. use Sys::Syslog qw( :standard :macros ); use X2Go::Config qw( get_config ); use X2Go::Log qw( loglevel ); use X2Go::Utils qw( sanitizer is_true ); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my ($uname, $pass, $uid, $pgid, $quota, $comment, $gcos, $homedir, $shell, $expire) = getpwuid($<); my $realuser=$uname; use base 'Exporter'; our @EXPORT=('db_listsessions','db_listsessions_all', 'db_getservers', 'db_getagent', 'db_resume', 'db_changestatus', 'db_getstatus', 'db_getdisplays', 'db_insertsession', 'db_insertshadowsession', 'db_getports', 'db_insertport', 'db_rmport', 'db_createsession', 'db_createshadowsession', 'db_insertmount', 'db_getmounts', 'db_deletemount', 'db_getdisplay', 'dbsys_getmounts', 'dbsys_listsessionsroot', 'dbsys_listsessionsroot_all', 'dbsys_rmsessionsroot', 'dbsys_deletemounts', 'db_listshadowsessions','db_listshadowsessions_all', ); sub init_db { # retrieve home dir of x2gouser my $x2gouser='x2gouser'; my ($uname, $pass, $uid, $pgid, $quota, $comment, $gcos, $homedir, $shell, $expire) = getpwnam($x2gouser); my $dbfile="$homedir/x2go_sessions"; my $dbh=DBI->connect("dbi:SQLite:dbname=$dbfile","","",{sqlite_use_immediate_transaction => 1, AutoCommit => 1, }) or die $_; # on SLE 11.x the sqlite_busy_timeout function does not exist, trying to work around that... if ( $dbh->can('sqlite_busy_timeout') ) { $dbh->sqlite_busy_timeout( 2000 ); } return $dbh; } sub dbsys_rmsessionsroot { my $dbh = init_db(); check_root(); my $sid=shift or die "argument \"session_id\" missed"; my $sth=$dbh->prepare("delete from sessions where session_id=?"); $sth->execute($sid); if ($sth->err()) { syslog('error', "rmsessionsroot (SQLite3 session db backend) failed with exitcode: $sth->err()"); die; } $sth->finish(); undef $dbh; return 1; } sub dbsys_listsessionsroot { my $dbh = init_db(); check_root(); my $server=shift or die "argument \"server\" missed"; my @strings; my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, strftime('%Y-%m-%dT%H:%M:%S',init_time), cookie,client,gr_port,sound_port, strftime('%Y-%m-%dT%H:%M:%S',last_time), uname, strftime('%s','now','localtime') - strftime('%s',init_time),fs_port, tekictrl_port, tekidata_port from sessions where server=? order by status desc"); $sth->execute($server); if ($sth->err()) { syslog('error', "listsessionsroot (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } my @sessions = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @sessions; } sub dbsys_listsessionsroot_all { my $dbh = init_db(); check_root(); my @strings; my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, strftime('%Y-%m-%dT%H:%M:%S',init_time), cookie,client,gr_port,sound_port, strftime('%Y-%m-%dT%H:%M:%S',last_time), uname, strftime('%s','now','localtime') - strftime('%s',init_time),fs_port, tekictrl_port, tekidata_port from sessions order by status desc"); $sth->execute(); if ($sth->err()) { syslog('error', "listsessionsroot_all (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } my @sessions = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @sessions; } sub dbsys_deletemounts { my $dbh = init_db(); my $sid=shift or die "argument \"session_id\" missed"; check_user($sid); my $sth=$dbh->prepare("delete from mounts where session_id=?"); $sth->execute($sid); if ($sth->err()) { syslog('error', "deletemounts (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } $sth->finish(); undef $dbh; return 1; } sub db_getmounts { my $dbh = init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; check_user($sid); my @strings; my $sth=$dbh->prepare("select client, path from mounts where session_id=?"); $sth->execute($sid); if ($sth->err()) { syslog('error', "getmounts (SQLite3 session db backend) failed with exitcode: $sth->err()"); die; } my @mounts = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @mounts; } sub db_deletemount { my $dbh = init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $path=shift or die "argument \"path\" missed"; check_user($sid); my $sth=$dbh->prepare("delete from mounts where session_id=? and path=?"); $sth->execute($sid, $path); if ($sth->err()) { syslog('error', "deletemount (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } $sth->finish(); undef $dbh; return 1; } sub db_insertmount { my $dbh = init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $path=shift or die "argument \"path\" missed"; my $client=shift or die "argument \"client\" missed"; check_user($sid); my $sth=$dbh->prepare("insert into mounts (session_id,path,client) values (?, ?, ?)"); $sth->execute($sid, $path, $client); my $success = 0; if(! $sth->err()) { $success = 1; } else { syslog('debug', "insertmount (SQLite3 session db backend) failed with exitcode: $sth->err(), this issue will be interpreted as: SSHFS share already mounted"); } $sth->finish(); undef $dbh; return $success; } sub db_insertsession { my $dbh = init_db(); my $display=shift or die "argument \"display\" missed"; $display = sanitizer('num', $display) or die "argument \"display\" malformed"; my $server=shift or die "argument \"server\" missed"; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; check_user($sid); my $sth=$dbh->prepare("insert into sessions (display,server,uname,session_id, init_time, last_time) values (?, ?, ?, ?, datetime('now','localtime'), datetime('now','localtime'))"); $sth->execute($display, $server, $realuser, $sid) or die $_; $sth->finish(); undef $dbh; return 1; } sub db_insertshadowsession { my $dbh = init_db(); my $display=shift or die "argument \"display\" missed"; $display = sanitizer('num', $display) or die "argument \"display\" malformed"; my $server=shift or die "argument \"server\" missed"; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $shadreq_user = shift or die "argument \"shadreq_user\" missed"; my $fake_sid = $sid; $fake_sid =~ s/$shadreq_user-/$realuser-/; check_user($fake_sid); my $sth=$dbh->prepare("insert into sessions (display,server,uname,session_id, init_time, last_time) values (?, ?, ?, ?, datetime('now','localtime'), datetime('now','localtime'))"); $sth->execute($display, $server, $shadreq_user, $sid) or die $_; $sth->finish(); undef $dbh; return 1; } sub db_createsession { my $dbh = init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $cookie=shift or die"argument \"cookie\" missed"; my $pid=shift or die"argument \"pid\" missed"; $pid = sanitizer('num', $pid) or die "argument \"pid\" malformed"; my $client=shift or die"argument \"client\" missed"; my $gr_port=shift or die"argument \"gr_port\" missed"; $gr_port = sanitizer('num', $gr_port) or die "argument \"gr_port\" malformed"; my $snd_port=shift or die"argument \"snd_port\" missed"; $snd_port = sanitizer('num', $snd_port) or die "argument \"snd_port\" malformed"; my $fs_port=shift or die"argument \"fs_port\" missed"; $fs_port = sanitizer('num', $fs_port) or die "argument \"fs_port\" malformed"; my $tekictrl_port=shift or die "argument \"tekictrl_port\" missed"; $tekictrl_port = sanitizer('pnnum', $tekictrl_port) or die "argument \"tekictrl_port\" malformed"; my $tekidata_port=shift or die "argument \"tekidata_port\" missed"; $tekidata_port = sanitizer('pnnum', $tekidata_port) or die "argument \"tekidata_port\" malformed"; check_user($sid); my $sth=$dbh->prepare("update sessions set status='R',last_time=datetime('now','localtime'),cookie=?,agent_pid=?, client=?,gr_port=?,sound_port=?,fs_port=?,tekictrl_port=?,tekidata_port=? where session_id=? and uname=?"); $sth->execute($cookie, $pid, $client, $gr_port, $snd_port, $fs_port, $tekictrl_port, $tekidata_port, $sid, $realuser); if ($sth->err()) { syslog('error', "createsession (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } $sth->finish(); undef $dbh; return 1; } sub db_createshadowsession { my $dbh = init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $cookie=shift or die"argument \"cookie\" missed"; my $pid=shift or die"argument \"pid\" missed"; $pid = sanitizer('num', $pid) or die "argument \"pid\" malformed"; my $client=shift or die"argument \"client\" missed"; my $gr_port=shift or die"argument \"gr_port\" missed"; $gr_port = sanitizer('num', $gr_port) or die "argument \"gr_port\" malformed"; my $snd_port=shift or die"argument \"snd_port\" missed"; $snd_port = sanitizer('num', $snd_port) or die "argument \"snd_port\" malformed"; my $fs_port=shift or die"argument \"fs_port\" missed"; $fs_port = sanitizer('num', $fs_port) or die "argument \"fs_port\" malformed"; my $shadreq_user = shift or die "argument \"shadreq_user\" missed"; check_user($sid); my $sth=$dbh->prepare("update sessions set status='R',last_time=datetime('now','localtime'),cookie=?,agent_pid=?, client=?,gr_port=?,sound_port=?,fs_port=?,tekictrl_port=-1,tekidata_port=-1 where session_id=? and uname=?"); $sth->execute($cookie, $pid, $client, $gr_port, $snd_port, $fs_port, $sid, $shadreq_user); if ($sth->err()) { syslog('error', "createshadowsession (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } $sth->finish(); undef $dbh; return 1; } sub db_insertport { my $dbh = init_db(); my $server=shift or die "argument \"server\" missed"; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $sshport=shift or die "argument \"port\" missed"; my $sth=$dbh->prepare("insert into used_ports (server,session_id,port) values (?, ?, ?)"); check_user($sid); $sth->execute($server, $sid, $sshport); if ($sth->err()) { syslog('error', "insertport (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } $sth->finish(); undef $dbh; return 1; } sub db_rmport { my $dbh = init_db(); my $server=shift or die "argument \"server\" missed"; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $sshport=shift or die "argument \"port\" missed"; my $sth=$dbh->prepare("delete from used_ports where server=? and session_id=? and port=?"); check_user($sid); $sth->execute($server, $sid, $sshport); if ($sth->err()) { syslog('error', "rmport (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } $sth->finish(); undef $dbh; return 1; } sub db_resume { my $dbh = init_db(); my $client=shift or die "argument \"client\" missed"; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $gr_port=shift or die "argument \"gr_port\" missed"; $gr_port = sanitizer('num', $gr_port) or die "argument \"gr_port\" malformed"; my $snd_port=shift or die "argument \"snd_port\" missed"; $snd_port = sanitizer('num', $snd_port) or die "argument \"snd_port\" malformed"; my $fs_port=shift or die "argument \"fs_port\" missed"; $fs_port = sanitizer('num', $fs_port) or die "argument \"fs_port\" malformed"; my $tekictrl_port=shift or die"argument \"tekictrl_port\" missed"; $tekictrl_port = sanitizer('pnnum', $tekictrl_port) or die "argument \"tekictrl_port\" malformed"; my $tekidata_port=shift or die"argument \"tekidata_port\" missed"; $tekidata_port = sanitizer('pnnum', $tekidata_port) or die "argument \"tekidata_port\" malformed"; check_user($sid); my $sth=$dbh->prepare("update sessions set last_time=datetime('now','localtime'),status='R', client=?,gr_port=?,sound_port=?,fs_port=?,tekictrl_port=?,tekidata_port=? where session_id = ? and uname=?"); $sth->execute($client, $gr_port, $snd_port, $fs_port, $tekictrl_port, $tekidata_port, $sid, $realuser); if ($sth->err()) { syslog('error', "resume (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } $sth->finish(); undef $dbh; return 1; } sub db_changestatus { my $dbh = init_db(); my $status=shift or die "argument \"status\" missed"; my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; check_user($sid); # we need to be able to change the state of normal sessions ($realuser == $effective_user) # _and_ desktop sharing session ($realuser != $effective_user). Thus, extracting the effective # username from the session ID... my $effective_user = $sid; $effective_user =~ s/\-[0-9]+\-[0-9]{10}_.*//; my $sth=$dbh->prepare("update sessions set last_time=datetime('now','localtime'), status=? where session_id = ? and uname=?"); $sth->execute($status, $sid, $effective_user); if ($sth->err()) { syslog('error', "changestatus (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } $sth->finish(); undef $dbh; return 1; } sub db_getstatus { my $dbh = init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; check_user($sid); my $sth=$dbh->prepare("select status from sessions where session_id = ?"); $sth->execute($sid); if ($sth->err()) { syslog('error', "changestatus (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } my @data; my $status; @data = $sth->fetchrow_array; { $status = $data[0]; } $sth->finish(); undef $dbh; return $status; } sub db_getdisplays { my $dbh = init_db(); #ignore $server my @strings; my $sth=$dbh->prepare("select display from sessions"); $sth->execute(); if ($sth->err()) { syslog('error', "getdisplays (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } my @data; my $i=0; while (@data = $sth->fetchrow_array) { $strings[$i++]='|'.$data[0].'|'; } $sth->finish(); undef $dbh; return join("\n",@strings); } sub db_getports { my $dbh = init_db(); #ignore $server my $server=shift or die "argument \"server\" missed"; my @strings; my $sth=$dbh->prepare("select port from used_ports"); $sth->execute(); if ($sth->err()) { syslog('error', "getports (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } my @data; my $i=0; while (@data = $sth->fetchrow_array) { $strings[$i++]='|'.$data[0].'|'; } $sth->finish(); undef $dbh; return join("\n",@strings); } sub db_getservers { my $dbh = init_db(); my @strings; my $sth=$dbh->prepare("select server,count(*) from sessions where status != 'F' group by server"); $sth->execute(); if ($sth->err()) { syslog('error', "getservers (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } my @data; my $i=0; while (@data = $sth->fetchrow_array) { $strings[$i++]=$data[0]; } $sth->finish(); undef $dbh; return join("\n",@strings); } sub db_getagent { my $dbh = init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $agent; check_user($sid); my $sth=$dbh->prepare("select agent_pid from sessions where session_id=?"); $sth->execute($sid); if ($sth->err()) { syslog('error', "getagent (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } my @data; my $i=0; if(@data = $sth->fetchrow_array) { $agent=$data[0]; } $sth->finish(); undef $dbh; return $agent; } sub db_getdisplay { my $dbh = init_db(); my $sid=shift or die "argument \"session_id\" missed"; $sid = sanitizer('x2gosid', $sid) or die "argument \"session_id\" malformed"; my $display; check_user($sid); my $sth=$dbh->prepare("select display from sessions where session_id =?"); $sth->execute($sid); if ($sth->err()) { syslog('error', "getdisplay (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } my @data; my $i=0; if(@data = $sth->fetchrow_array) { $display=$data[0]; } $sth->finish(); undef $dbh; return $display; } sub db_listsessions { my $dbh = init_db(); my $server=shift or die "argument \"server\" missed"; my @strings; my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, strftime('%Y-%m-%dT%H:%M:%S',init_time), cookie,client,gr_port,sound_port, strftime('%Y-%m-%dT%H:%M:%S',last_time), uname, strftime('%s','now','localtime') - strftime('%s',init_time),fs_port, tekictrl_port,tekidata_port from sessions where status !='F' and server=? and uname=? and ( session_id not like '%XSHAD%') order by status desc"); $sth->execute($server, $realuser); if ($sth->err()) { syslog('error', "listsessions (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } my @sessions = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @sessions; } sub db_listsessions_all { my $dbh = init_db(); my @strings; my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, strftime('%Y-%m-%dT%H:%M:%S',init_time), cookie,client,gr_port,sound_port, strftime('%Y-%m-%dT%H:%M:%S',last_time), uname, strftime('%s','now','localtime') - strftime('%s',init_time),fs_port, tekictrl_port,tekidata_port from sessions where status !='F' and uname=? and ( session_id not like '%XSHAD%') order by status desc"); $sth->execute($realuser); if ($sth->err()) { syslog('error', "listsessions_all (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } my @sessions = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @sessions; } sub db_listshadowsessions { my $dbh = init_db(); my $server=shift or die "argument \"server\" missed"; my @strings; my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, strftime('%Y-%m-%dT%H:%M:%S',init_time), cookie,client,gr_port,sound_port, strftime('%Y-%m-%dT%H:%M:%S',last_time), uname, strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions where status !='F' and server=? and uname=? and ( session_id like '%XSHAD%') order by status desc"); $sth->execute($server, $realuser); if ($sth->err()) { syslog('error', "listshadowsessions (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } my @sessions = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @sessions; } sub db_listshadowsessions_all { my $dbh = init_db(); my @strings; my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status, strftime('%Y-%m-%dT%H:%M:%S',init_time), cookie,client,gr_port,sound_port, strftime('%Y-%m-%dT%H:%M:%S',last_time), uname, strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions where status !='F' and uname=? and ( session_id like '%XSHAD%') order by status desc"); $sth->execute($realuser); if ($sth->err()) { syslog('error', "listshadowsessions_all (SQLite3 session db backend) failed with exitcode: $sth->err()"); die(); } my @sessions = fetchrow_array_datasets($sth); $sth->finish(); undef $dbh; return @sessions; } sub check_root { if ($realuser ne "root") { die "$realuser, you can not do this job"; } } sub check_user { my $sid=shift or die "argument \"session_id\" missed"; return if $realuser eq "root"; # session id looks like someuser-51-1304005895_stDgnome-session_dp24 # during DB insertsession it only looks like someuser-51-1304005895 # derive the session's user from the session name/id my $user = "$sid"; # handle ActiveDirectory Domain user accounts gracefully $realuser =~ s/\\//; # perform the user check $user =~ s/($realuser-[0-9]{2,}-[0-9]{10,}_st(D|R).*|.*-[0-9]{2,}-[0-9]{10,}_stS(0|1)XSHAD$realuser.*)/$realuser/; $user eq $realuser or die "$realuser is not authorized"; } sub fetchrow_array_datasets { my $sth = shift; my @lines; my @data; while (@data = $sth->fetchrow_array()) { push @lines, join('|', @data); } return @lines; } 1; x2goserver-4.1.0.3/x2goserver-desktopsharing/bin/x2goresume-desktopsharing0000755000000000000000000000264013377671145023643 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # # Copyright (C) 2011-2018 Oleksandr Shneyder # Copyright (C) 2011-2018 Heinz-Markus Graesing # Copyright (C) 2011-2015 Mike Gabriel if [ $# -eq 1 ]; then SESSION_NAME=$1 else SESSION_NAME=$X2GO_SESSION fi X2GO_LIB_PATH=`x2gopath libexec` $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" X2GO_DISPLAY=$(echo $SESSION_NAME | cut -d"-" -f2) test -e $HOME/.x2go/C-$SESSION_NAME/resume-desktopsharing && { rm -f $HOME/.x2go/C-$SESSION_NAME/resume-desktopsharing DISPLAY=:$X2GO_DISPLAY.0 x2godesktopsharing &>/dev/null & } x2goserver-4.1.0.3/x2goserver-desktopsharing/bin/x2gosuspend-desktopsharing0000755000000000000000000000243513377671145024026 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # # Copyright (C) 2011-2018 Oleksandr Shneyder # Copyright (C) 2011-2018 Heinz-Markus Graesing # Copyright (C) 2011-2015 Mike Gabriel if [ $# -eq 1 ]; then SESSION_NAME=$1 else SESSION_NAME=$X2GO_SESSION fi X2GO_LIB_PATH=`x2gopath libexec` $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" x2goterminate-desktopsharing $SESSION_NAME && touch $HOME/.x2go/C-$SESSION_NAME/resume-desktopsharing x2goserver-4.1.0.3/x2goserver-desktopsharing/bin/x2goterminate-desktopsharing0000755000000000000000000000375713377671145024345 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # # Copyright (C) 2011-2018 Oleksandr Shneyder # Copyright (C) 2011-2018 Heinz-Markus Graesing # Copyright (C) 2011-2015 Mike Gabriel if [ "${#}" -eq '1' ]; then SESSION_NAME="${1}" else SESSION_NAME="${X2GO_SESSION}" fi X2GO_LIB_PATH="$(x2gopath 'libexec')" if type -p 'pidof' 1>'/dev/null' 2>'/dev/null'; then PIDOF='pidof' elif [ -x '/usr/local/sbin/pidof' ]; then PIDOF='/usr/local/sbin/pidof' elif [ -x '/usr/sbin/pidof' ]; then PIDOF='/usr/sbin/pidof' elif [ -x '/sbin/pidof' ]; then PIDOF='/sbin/pidof' else # no pidof utility found, get out the big hammer!!! killall 'x2godesktopsharing' exit '0' fi "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "$(basename "${0}") called with options: ${@}" X2GO_DISPLAY="$(echo "${SESSION_NAME}" | cut -d '-' -f '2')" for process_id in $("${PIDOF}" 'x2godesktopsharing'); do env_of_process="$(cat -A "/proc/${process_id}/environ")" env_of_process="${env_of_process//^@/\\n}" display="$(echo -e "${env_of_process}" | grep -E '^DISPLAY=.*$' | cut -d '=' -f '2')" if echo "${display}" | grep ":${X2GO_DISPLAY}" &>'/dev/null'; then kill -SIGTERM "${process_id}" exit '0' fi done exit '1' x2goserver-4.1.0.3/x2goserver-desktopsharing/etc/desktopsharing/settings0000644000000000000000000000004313377671145023400 0ustar [General] group=x2godesktopsharing x2goserver-4.1.0.3/x2goserver-desktopsharing/Makefile0000755000000000000000000000533413377671145017470 0ustar #!/usr/bin/make -f SRC_DIR=$(CURDIR) SHELL=/bin/bash INSTALL_DIR=install -d -o root -g root -m 755 INSTALL_FILE=install -o root -g root -m 644 INSTALL_PROGRAM=install -o root -g root -m 755 RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty DESTDIR ?= PREFIX ?= /usr/local ETCDIR=/etc/x2go BINDIR=$(PREFIX)/bin LIBDIR=$(PREFIX)/lib/x2go MANDIR=$(PREFIX)/share/man SHAREDIR=$(PREFIX)/share/x2go BIN_SCRIPTS=$(shell cd bin && echo *) FEATURE_SCRIPTS=$(shell cd share/x2go/x2gofeature.d && echo *.features) man_pages = `cd man && find * -type f` MAN2HTML_BIN = $(shell which man2html) MAN2HTML_SRC = man MAN2HTML_DEST = .build_man2html/html all: clean build build: build-arch build-indep build-arch: build-indep: build_man2html build_man2html: if [ -n "$(MAN2HTML_BIN)" ]; then \ mkdir -p $(MAN2HTML_DEST); \ for man_page in $(man_pages); do mkdir -p `dirname $(MAN2HTML_DEST)/$$man_page`; done; \ for man_page in $(man_pages); do $(MAN2HTML_BIN) $(MAN2HTML_SRC)/$$man_page > $(MAN2HTML_DEST)/$$man_page.html; done; \ fi clean: clean_man2html clean_man2html: rm -rf `dirname $(MAN2HTML_DEST)` install: install_scripts install_config install_man install_version install_scripts: $(INSTALL_DIR) $(DESTDIR)$(BINDIR) $(INSTALL_PROGRAM) bin/x2go* $(DESTDIR)$(BINDIR)/ $(INSTALL_DIR) $(DESTDIR)$(ETCDIR)/desktopsharing $(INSTALL_FILE) etc/desktopsharing/settings $(DESTDIR)$(ETCDIR)/desktopsharing/ $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/x2gofeature.d $(INSTALL_PROGRAM) share/x2gofeature.d/*.features $(DESTDIR)$(SHAREDIR)/x2gofeature.d/ install_config: install_man: $(INSTALL_DIR) $(DESTDIR)$(MANDIR) $(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man8 $(INSTALL_FILE) man/man8/*.8 $(DESTDIR)$(MANDIR)/man8 gzip -f $(DESTDIR)$(MANDIR)/man8/x2go*.8 install_version: $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/versions $(INSTALL_FILE) VERSION.x2goserver-desktopsharing $(DESTDIR)$(SHAREDIR)/versions/ uninstall: uninstall_scripts uninstall_config uninstall_man uninstall_version uninstall_scripts: for file in $(FEATURE_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(SHAREDIR)/x2gofeature.d/$$file; done uninstall_config: uninstall_config: $(RM_FILE) $(DESTDIR)$(ETCDIR)/desktopsharing/settings $(RM_DIR) $(DESTDIR)$(ETCDIR)/desktopsharing || true $(RM_DIR) $(DESTDIR)$(ETCDIR) || true uninstall_man: for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man8/$$file.8.gz; done for file in $(SBIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man8/$$file.8.gz; done $(RM_DIR) $(DESTDIR)$(MANDIR) || true uninstall_version: $(RM_FILE) $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-desktopsharing $(RM_DIR) $(DESTDIR)$(SHAREDIR)/versions || true x2goserver-4.1.0.3/x2goserver-desktopsharing/man/man8/x2goresume-desktopsharing.80000644000000000000000000000201713377671145024652 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2goresume\-desktopsharing 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Script" .SH NAME x2goresume\-desktopsharing \- Resume Desktop Sharing Applet for a given X2Go Session .SH SYNOPSIS 'nh .fi .ad l \fBx2goresume\-desktopsharing\fR \fI\fR .SH DESCRIPTION \fBx2goresume\-desktopsharing\fR launches the \fBx2godesktopsharing\fR applet for X2Go session \fI\fR. .PP \fBx2goresume\-desktopsharing\fR is run with normal user privileges and it is used from within X2Go Server. There normally is no need to execute this command manually. .SH RETURN VALUES As exitcode \fBx2goresume\-desktopsharing\fR always returns 0. .SH SEE ALSO x2godesktopsharing(1), x2goresume\-session(8), x2gosuspend\-desktopsharing(8), x2goterminate\-desktopsharing(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver-desktopsharing/man/man8/x2gosuspend-desktopsharing.80000644000000000000000000000223313377671145025033 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gosuspend-desktopsharing 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Script" .SH NAME x2gosuspend-desktopsharing \- Suspend Desktop Sharing for a given X2Go Session .SH SYNOPSIS 'nh .fi .ad l \fBx2gosuspend\-desktopsharing\fR \fI\fR .SH DESCRIPTION \fBx2gosuspend\-desktopsharing\fR executes \fBx2goterminate\-desktopsharing\fR and places a reminder file .PP ,,resume\-desktopsharing'' .PP into .PP $HOME/.x2go/C\-/ .PP so that \fBx2godesktopsharing\fR can be resumed on session resume. .PP \fBx2gosuspend\-desktopsharing\fR is run with normal user privileges and it is used from within X2Go Server. There normally is no need to execute this command manually. .SH RETURN VALUES As exitcode \fBx2gosuspend\-desktopsharing\fR always returns 0. .SH SEE ALSO x2godesktopsharing(1), x2gosuspend\-session(8), x2goterminate\-desktopsharing(8), x2goresume\-desktopsharing(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver-desktopsharing/man/man8/x2goterminate-desktopsharing.80000644000000000000000000000224413377671145025344 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2goterminate\-desktopsharing 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2goterminate\-desktopsharing \- Cleanly Terminate Desktop Sharing for a given X2Go Session .SH SYNOPSIS 'nh .fi .ad l \fBx2goterminate\-desktopsharing\fR \fI\fR .SH DESCRIPTION \fBx2goterminate\-desktopsharing\fR allows one to detect a running and associated \fBx2godesktopsharing\fR applet and to cleanly terminate this applet. .PP \fBx2goterminate\-desktopsharing\fR is run with normal user privileges and it is used from within X2Go Server. There normally is no need to execute this command manually. .SH RETURN VALUES As exitcode \fBx2goterminate\-desktopsharing\fR returns 0 if a \fBx2godesktopsharing\fR process could be identified and terminated. If not, the exit code is \-1. .SH SEE ALSO x2godesktopsharing(1), x2goteminate\-session(8), x2gosuspend\-desktopsharing(8), x2goresume\-desktopsharing(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver-desktopsharing/share/x2gofeature.d/x2goserver-desktopsharing.features0000755000000000000000000000226613377671145030501 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # # Copyright (C) 2011-2018 Oleksandr Shneyder # Copyright (C) 2011-2018 Heinz-Markus Graesing X2GO_LIB_PATH=`x2gopath libexec` $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" X2GO_FEATURE=$1 # check for X2Go server core features case "$X2GO_FEATURE" in "X2GO_DESKTOPSHARING") echo "ok"; exit 0;; *) exit -1;; esac x2goserver-4.1.0.3/x2goserver-desktopsharing/VERSION.x2goserver-desktopsharing0000644000000000000000000000001013377671145024207 0ustar 3.2.0.0 x2goserver-4.1.0.3/x2goserver/doc/README.sudoers0000644000000000000000000000127013377671145016105 0ustar WORKAROUND FOR OPENSUSE 11 and SLES/SLED 11 =========================================== Problem Description ------------------- OpenSUSE 11 and SLES/SLED 11 do not support /etc/sudoers.d as a place for custom sudoers config files. If you are using any of these distributions and are having issues regarding running Qt applications with elevated privileges (e.g., via kdesu or sudo), please use this workaround. Necessary Actions ----------------- 1.) Copy the contents of the "x2goserver" file in this directory. 2.) Get elevated privileges. Either via su or sudo -i. 3.) Launch visudo. 4.) Paste the previously copied content at the end of the sudoers file. 5.) Save and exit your editor. x2goserver-4.1.0.3/x2goserver/doc/README.upgrade-pgsql-database0000644000000000000000000000212613377671145020737 0ustar ####################################### ### ### X2Go DB maintenance after upgrades ### ####################################### UPGRADING ========= Normally no DB upgrades are necessary on x2goserver package upgrades. However, there are some exceptions for some specific version of the x2goserver package. Upgrading to x2goserver 3.1.0.0 ------------------------------- From: x2goserver (<= 3.0.99.10) To: x2goserver (>= 3.1.0.0) Description: The user (access) permissions on table ,,used_ports'' have been changed. X2Go users in the PostgreSQL database need access to this new column. . Alternative 1: recreate all X2Go db users . x2godbadmin --rmuser x2godbadmin --adduser . Alternative 2: . Run this SQL command for each x2gouser_ in the X2Go PostgreSQL database . $ su - postgres $ psql psql ("; x2go_sessions=# GRANT SELECT ON used_ports TO "x2gouser_"; ... x2goserver-4.1.0.3/x2goserver/etc/logcheck/ignore.d.server/x2goserver0000644000000000000000000000071513377671145022375 0ustar ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ /usr/bin/x2gomountdirs\[[ 0-9]{1,6}\]: WARNING: mounting of /.*/spool failed$ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ /usr/bin/x2gosuspend-session: session with ID .* has been suspended successfully$ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ /usr/bin/x2gostartagent: successfully started X2Go agent session with ID .*$ ^\w{3} [ :0-9]{11} [._[:alnum:]-]+ /usr/bin/x2goresume-session: client .* has successfully resumed session with ID .*$ x2goserver-4.1.0.3/x2goserver/etc/sudoers.d/x2goserver0000644000000000000000000000005713377671145017511 0ustar Defaults env_keep +="QT_GRAPHICSSYSTEM" x2goserver-4.1.0.3/x2goserver/etc/x2go_logout0000644000000000000000000000057213377671145015747 0ustar # /etc/x2go/x2go_logout: system-wide .x2go_logout file for X2Go sessions # for Bash and Bash compatible shells (bash(1), ksh(1), ash(1), ...). if [ -d /etc/x2go/x2go_logout.d ]; then for subscript in /etc/x2go/x2go_logout.d/*; do if [ -r $subscript ]; then # subscripts may fail, we ignore that here... . $subscript || true fi done unset subscript fi x2goserver-4.1.0.3/x2goserver/etc/x2go_logout.d/010_userscripts.sh0000644000000000000000000000013013377671145021536 0ustar # call $HOME/.x2go_logout script... test -r $HOME/.x2go_logout && . $HOME/.x2go_logout x2goserver-4.1.0.3/x2goserver-extensions/bin/x2goserver-run-extensions0000755000000000000000000000366713377671145023011 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2011-2018 Oleksandr Shneyder # Copyright (C) 2011-2018 Heinz-Markus Graesing # Copyright (C) 2011-2015 Mike Gabriel # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. set -e test -z "${2}" && { echo "Usage: $(basename "${0}") " exit '1' } X2GO_LIB_PATH="$(x2gopath 'libexec')" "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "$(basename "${0}") called with options: ${@}" X2GO_SESSION="${1}" X2GO_MODALITY="${2}" # scan extensions and execute them find "${X2GO_LIB_PATH}/extensions/${X2GO_MODALITY}.d/" -maxdepth '1' -mindepth '1' | grep -E '/[0-9]{3}_[[:alnum:]]+' | sort | while read 'x2go_extension'; do "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "executing ${x2go_extension} with option ${X2GO_SESSION}" "${x2go_extension}" "${X2GO_SESSION}" &>'/dev/null' && { "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'info' "${x2go_extension} ($(basename "${0}")) for session ${X2GO_SESSION} has finished sucessfully" } || { "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'warning' "${x2go_extension} ($(basename "${0}")) for session ${X2GO_SESSION} returned a non-zero exit code, continuing..." } done exit '0' x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/fail-resume.d/.placeholder0000644000000000000000000000000013377671145025043 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/fail-runcommand.d/.placeholder0000644000000000000000000000000013377671145025706 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/fail-start.d/.placeholder0000644000000000000000000000000013377671145024700 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/fail-suspend.d/.placeholder0000644000000000000000000000000013377671145025224 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/fail-terminate.d/.placeholder0000644000000000000000000000000013377671145025533 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/post-resume.d/.placeholder0000644000000000000000000000000013377671145025115 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/post-runcommand.d/.placeholder0000644000000000000000000000000013377671145025760 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/post-start.d/.placeholder0000644000000000000000000000000013377671145024752 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/post-suspend.d/.placeholder0000644000000000000000000000000013377671145025276 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/post-terminate.d/.placeholder0000644000000000000000000000000013377671145025605 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/pre-resume.d/.placeholder0000644000000000000000000000000013377671145024716 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/pre-runcommand.d/.placeholder0000644000000000000000000000000013377671145025561 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/pre-start.d/.placeholder0000644000000000000000000000000013377671145024553 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/pre-suspend.d/.placeholder0000644000000000000000000000000013377671145025077 0ustar x2goserver-4.1.0.3/x2goserver-extensions/lib/extensions/pre-terminate.d/.placeholder0000644000000000000000000000000013377671145025406 0ustar x2goserver-4.1.0.3/x2goserver-extensions/Makefile0000755000000000000000000001603713377671145016644 0ustar #!/usr/bin/make -f SRC_DIR=$(CURDIR) SHELL=/bin/bash INSTALL_DIR=install -d -o root -g root -m 755 INSTALL_FILE=install -o root -g root -m 644 INSTALL_PROGRAM=install -o root -g root -m 755 RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty DESTDIR ?= PREFIX ?= /usr/local ETCDIR=/etc/x2go BINDIR=$(PREFIX)/bin LIBDIR=$(PREFIX)/lib/x2go MANDIR=$(PREFIX)/share/man SHAREDIR=$(PREFIX)/share/x2go BIN_SCRIPTS=$(shell cd bin && echo *) FEATURE_SCRIPTS=$(shell cd share/x2gofeature.d && echo *.features .placeholder) man_pages = `cd man && find * -type f` MAN2HTML_BIN = $(shell which man2html) MAN2HTML_SRC = man MAN2HTML_DEST = .build_man2html/html all: clean build build: build-arch build-indep build-arch: build-indep: build_man2html build_man2html: if [ -n "$(MAN2HTML_BIN)" ]; then \ mkdir -p $(MAN2HTML_DEST); \ for man_page in $(man_pages); do mkdir -p `dirname $(MAN2HTML_DEST)/$$man_page`; done; \ for man_page in $(man_pages); do $(MAN2HTML_BIN) $(MAN2HTML_SRC)/$$man_page > $(MAN2HTML_DEST)/$$man_page.html; done; \ fi clean: clean_man2html clean_man2html: rm -rf `dirname $(MAN2HTML_DEST)` install: install_scripts install_config install_man install_version install_scripts: $(INSTALL_DIR) $(DESTDIR)$(BINDIR) $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/pre-start.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/post-start.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/fail-start.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/pre-resume.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/post-resume.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/fail-resume.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/pre-suspend.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/post-suspend.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/fail-suspend.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/pre-terminate.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/post-terminate.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/fail-terminate.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/pre-runcommand.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/post-runcommand.d $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)/extensions/fail-runcommand.d $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/x2gofeature.d $(INSTALL_PROGRAM) bin/* $(DESTDIR)$(BINDIR)/ $(INSTALL_FILE) lib/extensions/pre-start.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/pre-start.d/ $(INSTALL_FILE) lib/extensions/post-start.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/post-start.d/ $(INSTALL_FILE) lib/extensions/fail-start.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/fail-start.d/ $(INSTALL_FILE) lib/extensions/pre-resume.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/pre-resume.d/ $(INSTALL_FILE) lib/extensions/post-resume.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/post-resume.d/ $(INSTALL_FILE) lib/extensions/fail-resume.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/fail-resume.d/ $(INSTALL_FILE) lib/extensions/pre-suspend.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/pre-suspend.d/ $(INSTALL_FILE) lib/extensions/post-suspend.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/post-suspend.d/ $(INSTALL_FILE) lib/extensions/fail-suspend.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/fail-suspend.d/ $(INSTALL_FILE) lib/extensions/pre-terminate.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/pre-terminate.d/ $(INSTALL_FILE) lib/extensions/post-terminate.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/post-terminate.d/ $(INSTALL_FILE) lib/extensions/fail-terminate.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/fail-terminate.d/ $(INSTALL_FILE) lib/extensions/pre-runcommand.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/pre-runcommand.d/ $(INSTALL_FILE) lib/extensions/post-runcommand.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/post-runcommand.d/ $(INSTALL_FILE) lib/extensions/fail-runcommand.d/.placeholder $(DESTDIR)$(LIBDIR)/extensions/fail-runcommand.d/ $(INSTALL_PROGRAM) share/x2gofeature.d/*.features $(DESTDIR)$(SHAREDIR)/x2gofeature.d/ install_config: install_man: $(INSTALL_DIR) $(DESTDIR)$(MANDIR) $(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man8 $(INSTALL_FILE) man/man8/*.8 $(DESTDIR)$(MANDIR)/man8 gzip -f $(DESTDIR)$(MANDIR)/man8/x2go*.8 install_version: $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/versions $(INSTALL_FILE) VERSION.x2goserver-extensions $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-extensions uninstall: uninstall_scripts uninstall_config uninstall_man uninstall_version uninstall_scripts: for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(BINDIR)/$$file; done $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/ || true $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/pre-start.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/post-start.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/fail-start.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/pre-resume.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/post-resume.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/fail-resume.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/pre-suspend.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/post-suspend.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/fail-suspend.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/pre-terminate.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/post-terminate.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/fail-terminate.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/pre-runcommand.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/post-runcommand.d/.placeholder $(RM_FILE) $(DESTDIR)$(LIBDIR)/extensions/fail-runcommand.d/.placeholder $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/pre-start.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/post-start.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/fail-start.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/pre-resume.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/post-resume.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/fail-resume.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/pre-suspend.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/post-suspend.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/fail-suspend.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/pre-terminate.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/post-terminate.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/fail-terminate.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/pre-runcommand.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/post-runcommand.d/ $(RM_DIR) $(DESTDIR)$(LIBDIR)/extensions/fail-runcommand.d/ for file in $(FEATURE_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(SHAREDIR)/x2gofeature.d/$$file; done uninstall_config: uninstall_man: for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man8/$$file.8.gz; done for file in $(SBIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man8/$$file.8.gz; done $(RM_DIR) $(DESTDIR)$(MANDIR) || true uninstall_version: $(RM_FILE) $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-extensions $(RM_DIR) $(DESTDIR)$(SHAREDIR)/versions || true x2goserver-4.1.0.3/x2goserver-extensions/man/man8/x2goserver-run-extensions.80000644000000000000000000001104713377671145024011 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2goserver-run-extensions 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2goserver-run-extensions \- Run X2Go Server Extensions .SH SYNOPSIS 'nh .fi .ad l x2goserver-run-extensions .SH DESCRIPTION \fBx2goserver-run-extensions\fR is called from within a number of X2Go Server core scripts. .PP \fIWARNING:\fR Do not call it directly unless you really know what you are doing. .PP \fBx2goserver-run-extensions\fR executes scripts that have been provided by third-party X2Go extension packages. .PP What this man page is about is not the script usage itself but the way of how to provide X2Go server extensions and features without the need to change the core X2Go server scripts. .SH MODALITIES \fBx2goserver-run-extensions\fR is called with user privileges. As first command line argument the session ID and as the second command line argument a so-called modality is provided. .PP This modality tells \fBx2goserver-run-extensions\fR at what stage of an X2Go session startup, resumption, suspension or termination the calling script currently is at. .PP These X2Go Server core scripts currently call \fBx2goserver-run-extensions\fR: \fBx2gostartagent(8)\fR, \fBx2goruncommand(8)\fR, \fBx2goresume-session(8)\fR, \fBx2gosuspend-session(8)\fR and \fBx2goterminate-session(8)\fR. .PP The modality names all refer to a sub-directory of the path: \fI/x2go/extensions\fR .\" FIXME: use @@LIBEXECDIR@@ here and generate the manpage at build time, replacing @@LIBEXECDIR@@ with whatever is appropriate. where is /usr/libexec/x2go or /usr/lib/x2go on commonly-used GNU/Linux systems. .PP In any of these sub-directories third-party X2Go extension packages can place scripts or binaries that will then get executed by the core X2Go server commands, either before or after the essential functionality (e.g. x2goagent startup, x2goagent suspension, x2goagent resumption, etc.) or on failure of that essential functionality. .PP The following table shows the available modalities, the calling scripts and the location where to place third-party extension scripts: CALLING SCRIPT MODALITY NAMES EXTENSION SCRIPTS LOCATION -------------- --------------- -------------------------- x2gostartagent pre-start extensions/pre-start.d/ post-start extensions/post-start.d/ fail-start extensions/fail-start.d/ x2goruncommand pre-runcommand extensions/pre-runcommand.d/ post-runcommand extensions/post-runcommand.d/ fail-runcommand extensions/fail-runcommand.d/ x2goresume-session pre-resume extensions/pre-resume.d/ post-resume extensions/post-resume.d/ fail-resume extensions/fail-resume.d/ x2gosuspend-session pre-suspend extensions/pre-suspend.d/ post-suspend extensions/post-suspend.d/ fail-suspend extensions/fail-suspend.d/ x2goterminate-session pre-terminate extensions/pre-terminate.d/ post-terminate extensions/post-terminate.d/ fail-terminate extensions/fail-terminate.d/ .TP \fIIMPORTANT:\fR When providing X2Go Server extensions by this mechanism, please pretty well make sure that extension scripts you place in either of the above folders do under no circumstance fail during execution. Return codes are ignored and failures are therefore not (yet) propagated. .SH EXECUTION OF EXTENSIONS Scripts (or binaries) that have been placed into one of the pre/post/fail modality folders (see above) are executed in alpha-numerical sorting order. .PP Extensions will only get executed if their file names start with three digits followed by an underscore character. This restriction is in place to make sure that X2Go Server extensions get executed in the correct/wanted order: .PP For example: 010_x2goserver-statistics 020_x2goserver-mail-notify 021_x2goserver-monitoring etc. pp. .SH RETURN VALUES \fBx2goserver-run-extensions\fR always returns 0 as exit code and pretends to be permanently happy :-). .SH SEE ALSO \fBx2gostartagent(8)\fR, \fBx2goruncommand(8)\fR, \fBx2goresume-session(8)\fR, \fBx2gosuspend-session(8)\fR and \fBx2goterminate-session(8)\fR. .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver-extensions/README.md0000644000000000000000000000106313377671145016451 0ustar # x2goserver-extensions This folder contains the entry-points for server extensions. This is the namespace in which you'll write your server side contributions. * bin contains the extensions running script. This is the script that starts the extension if provided. * lib contains the different entry-points for extensions in order to start have entry points to different scripts running on one of these points in time. these folders will contain your extensions scripts. * man man page documentation * share feature starting daemon script x2goserver-4.1.0.3/x2goserver-extensions/share/x2gofeature.d/x2goserver-extensions.features0000755000000000000000000000227013377671145027020 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2011-2018 Oleksandr Shneyder # Copyright (C) 2011-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" X2GO_FEATURE=$1 # check for X2Go server core features case "$X2GO_FEATURE" in "X2GO_RUN_EXTENSIONS") echo "ok"; exit 0;; *) exit -1;; esac x2goserver-4.1.0.3/x2goserver-extensions/VERSION.x2goserver-extensions0000644000000000000000000000001013377671145022533 0ustar 4.1.0.3 x2goserver-4.1.0.3/x2goserver-fmbindings/bin/x2gofm0000755000000000000000000000203313377671145017011 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2012-2015 Milan Knížek # Copyright (C) 2012-2018 Oleksandr Shneyder # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; my $fname=shift; open(F,"<$fname") or die "can't open $fname"; my $dir=; close(F); system( "xdg-open $dir" ); x2goserver-4.1.0.3/x2goserver-fmbindings/Makefile0000755000000000000000000000536313377671145016565 0ustar #!/usr/bin/make -f SRC_DIR=$(CURDIR) SHELL=/bin/bash INSTALL_DIR=install -d -o root -g root -m 755 INSTALL_FILE=install -o root -g root -m 644 INSTALL_PROGRAM=install -o root -g root -m 755 RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty DESTDIR ?= PREFIX ?= /usr/local ETCDIR=/etc/x2go BINDIR=$(PREFIX)/bin LIBDIR=$(PREFIX)/lib/x2go MANDIR=$(PREFIX)/share/man SHAREDIR=$(PREFIX)/share/x2go BIN_SCRIPTS=$(shell cd bin && echo *) FEATURE_SCRIPTS=$(shell cd share/x2go/x2gofeature.d && echo *.features) man_pages = `cd man && find * -type f` MAN2HTML_BIN = $(shell which man2html) MAN2HTML_SRC = man MAN2HTML_DEST = .build_man2html/html all: clean build build: build-arch build-indep build-arch: build-indep: build_man2html build_man2html: if [ -n "$(MAN2HTML_BIN)" ]; then \ mkdir -p $(MAN2HTML_DEST); \ for man_page in $(man_pages); do mkdir -p `dirname $(MAN2HTML_DEST)/$$man_page`; done; \ for man_page in $(man_pages); do $(MAN2HTML_BIN) $(MAN2HTML_SRC)/$$man_page > $(MAN2HTML_DEST)/$$man_page.html; done; \ fi clean: clean_man2html clean_man2html: rm -rf `dirname $(MAN2HTML_DEST)` install: install_scripts install_config install_man install_version install_scripts: $(INSTALL_DIR) $(DESTDIR)$(BINDIR) $(INSTALL_PROGRAM) bin/x2gofm $(DESTDIR)$(BINDIR)/ $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/x2gofeature.d $(INSTALL_PROGRAM) share/x2go/x2gofeature.d/*.features $(DESTDIR)$(SHAREDIR)/x2gofeature.d/ $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/applications $(INSTALL_PROGRAM) share/applications/x2gofm.desktop $(DESTDIR)$(PREFIX)/share/applications/ $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/mime/packages $(INSTALL_FILE) share/mime/packages/sshfs-x2go.xml $(DESTDIR)$(PREFIX)/share/mime/packages/ install_config: install_man: $(INSTALL_DIR) $(DESTDIR)$(MANDIR) $(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man8 $(INSTALL_FILE) man/man8/*.8 $(DESTDIR)$(MANDIR)/man8 gzip -f $(DESTDIR)$(MANDIR)/man8/x2go*.8 install_version: $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/versions $(INSTALL_FILE) VERSION.x2goserver-fmbindings $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-fmbindings uninstall: uninstall_scripts uninstall_config uninstall_man uninstall_version uninstall_scripts: for file in $(FEATURE_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(SHAREDIR)/x2gofeature.d/$$file; done uninstall_config: uninstall_man: for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man8/$$file.8.gz; done for file in $(SBIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man8/$$file.8.gz; done $(RM_DIR) $(DESTDIR)$(MANDIR) || true uninstall_version: $(RM_FILE) $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-fmbindings $(RM_DIR) $(DESTDIR)$(SHAREDIR)/versions || true x2goserver-4.1.0.3/x2goserver-fmbindings/man/man8/x2gofm.80000644000000000000000000000142713377671145020030 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gofm 8 "Nox 2018" "Version 4.1.0.3" "X2Go Server" .SH NAME x2gofm \- X2Go wrapper for Browsing X2Go Shared Folders .SH SYNOPSIS 'nh .fi .ad l x2gofm .SH DESCRIPTION \fBx2gofm\fR is a component of the generic file manager bindings for X2Go's shared folders. \fBx2gofm\fR uses XDG (namely x2go-open ) to launch the default file browser on all client-side folders shared via X2Go. .PP The default file browser is defined by the freedesktop.org specification of the running desktop environment. .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver-fmbindings/README.md0000644000000000000000000000052313377671145016372 0ustar # x2goserver-fmbindings This folder contains all scripts and helpers for the ssh mounted Shared Folders in x2go * bin contains the script to open a shared folder with x2go * man man page documentation * share contains the mime type definition as well as a german translation of the binding and the feature script itself. x2goserver-4.1.0.3/x2goserver-fmbindings/share/applications/x2gofm.desktop0000644000000000000000000000031513377671145023477 0ustar [Desktop Entry] Name=x2gofm MimeType=application/sshfsdisk-x2go;application/sshfscdrom-x2go;application/sshfsremovable-x2go; Exec=x2gofm %f Type=Application Terminal=false NoDisplay=true Icon=file-manager x2goserver-4.1.0.3/x2goserver-fmbindings/share/mime/packages/sshfs-x2go.xml0000644000000000000000000000145613377671145023455 0ustar SSHFS CDROM SSHFS CDROM SSHFS Disk SSHFS Freigabe SSHFS Removable SSHFS Gerät x2goserver-4.1.0.3/x2goserver-fmbindings/share/x2go/x2gofeature.d/x2goserver-fmbindings.features0000755000000000000000000000226413377671145027544 0ustar #!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2011-2018 Oleksandr Shneyder # Copyright (C) 2011-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" X2GO_FEATURE=$1 # check for X2Go server core features case "$X2GO_FEATURE" in "X2GO_FMBINDINGS") echo "ok"; exit 0;; *) exit -1;; esac x2goserver-4.1.0.3/x2goserver-fmbindings/VERSION.x2goserver-fmbindings0000644000000000000000000000001013377671145022375 0ustar 4.1.0.3 x2goserver-4.1.0.3/x2goserver/lib/x2gochangestatus0000755000000000000000000000233513377671145016765 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_changestatus); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $status=shift or die; my $sid=shift or die; db_changestatus($status, $sid); # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2gocheckport0000644000000000000000000002112313377671145016247 0ustar #!/bin/bash # Copyright (C) 2017-2018 X2Go Project - https://wiki.x2go.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. [[ -z "${X2GO_INTERNAL_SOURCE}" ]] && exit '2' # Variables used for caching. # We do not want to fetch the whole list for every # single port check. typeset -a used_x2go_ports typeset -a used_system_ports typeset -a used_display_ports used_x2go_ports=() used_system_ports=() used_display_ports=() # Initializes used_x2go_ports array. # Internal use only. # Takes the current hostname as a parameter. # Returns 0 on success or non-0 on failure. initialize_x2go_ports() { typeset current_host_name="${1}" typeset empty_regex='^[[:space:]]*$' if [[ -z "${current_host_name}" ]] || [[ "${current_host_name}" =~ ${empty_regex} ]] || [[ "${current_host_name}" = '(none)' ]] || [[ "${current_host_name}" = 'localhost' ]]; then return '1' fi # Get all used ports from the X2Go database # What this does is very unobvious, so here's how that works: # The -d parameter with an empty string as its argument makes # the read utility process a "line" until the first such delimiter # is found. Since an empty string in C is terminated by a NULL # character, the delimiter will be set to this NULL character. # Hence, assuming that the input string does not contain any # NULL characters, the whole input string will be treated as # one big line. # Then, normal word splitting kicks in and the -a flag tells # read to put all words into elements of the provided array # variable. typeset -a used_x2go_ports_work used_x2go_ports_work=() IFS="${IFS}|" read -r -d '' -a 'used_x2go_ports_work' < <("${x2go_lib_path}/x2gogetports" "${current_host_name}") # Filter out any empty or invalid values. typeset -i item_i='0' typeset item='' for item in "${used_x2go_ports_work[@]}"; do item_i="${item}" [[ -n "${item}" ]] && [[ "${item}" -eq "${item_i}" ]] && [[ "${item}" = "${item_i}" ]] && used_x2go_ports+=( "${item}" ) done return '0' } # Initializes used_system_ports array. # Internal use only. # Takes a command for ss as a parameter. # If an ss command is not given, a default of "ss" is assumed. # Returns 0 on success or non-0 on failure. initialize_system_ports() { typeset ss="${1:-"ss"}" typeset empty_regex='^[[:space:]]*$' if [[ -z "${ss}" ]] || [[ "${ss}" =~ ${empty_regex} ]]; then return '1' fi typeset -a used_system_ports_work used_system_ports_work=() IFS="${IFS}|" read -r -d '' -a 'used_system_ports_work' < <("${ss}" -nt -all | awk ' { n = split ($0, lines, "\n"); for (i = 1; i <= n; ++i) { split (lines[i], words, " "); delim = split (words[4], ports, ":"); if (delim > 1) { printf ("\n%d\n", ports[delim]) } } }') # Filter out any empty or invalid values. typeset -i item_i='0' typeset item='' for item in "${used_system_ports_work[@]}"; do item_i="${item}" [[ -n "${item}" ]] && [[ "${item}" -eq "${item_i}" ]] && [[ "${item}" = "${item_i}" ]] && used_system_ports+=( "${item}" ) done return '0' } # Initializes used_display_ports array. # Internal use only. # Takes the current hostname as a parameter. # Returns 0 on success or non-0 on failure. initialize_display_ports() { typeset current_host_name="${1}" typeset empty_regex='^[[:space:]]*$' if [[ -z "${current_host_name}" ]] || [[ "${current_host_name}" =~ ${empty_regex} ]] || [[ "${current_host_name}" = '(none)' ]] || [[ "${current_host_name}" = 'localhost' ]]; then return '1' fi typeset -a used_display_ports_work used_display_ports_work=() IFS="${IFS}|" read -r -d '' -a 'used_display_ports_work' < <("${x2go_lib_path}/x2gogetdisplays" "${current_host_name}") # Filter out any empty or invalid values. typeset -i item_i='0' typeset item='' for item in "${used_display_ports_work[@]}"; do item_i="${item}" [[ -n "${item}" ]] && [[ "${item}" -eq "${item_i}" ]] && [[ "${item}" = "${item_i}" ]] && used_display_ports+=( "${item}" ) done return '0' } # Checks if a port is registered as in use by X2Go. # Takes the current hostname and a port value as parameters. # Returns 0 if the port is free, or non-0 if it already # in use or on failure. check_x2go_port() { typeset current_host_name="${1}" typeset port="${2}" typeset empty_regex='^[[:space:]]*$' if [[ -z "${current_host_name}" ]] || [[ "${current_host_name}" =~ ${empty_regex} ]] || [[ "${current_host_name}" = '(none)' ]] || [[ "${current_host_name}" = 'localhost' ]]; then return '2' fi typeset -i port_i="${port}" if [[ -z "${port}" ]] || [[ "${port}" != "${port_i}" ]] || [[ "${port}" -ne "${port_i}" ]] || [[ "${port_i}" -lt '1' ]] || [[ "${port_i}" -gt '65535' ]]; then return '3' fi typeset -i ret='0' # If cache is empty, initialize it. if [[ "${#used_x2go_ports[@]}" -eq '0' ]]; then initialize_x2go_ports "${current_host_name}" || ret='4' fi if [[ "${ret}" -eq '0' ]]; then typeset -i i='0' for ((i = 0; i < ${#used_x2go_ports[@]}; ++i)); do if [[ "${used_x2go_ports[i]}" = "${port}" ]]; then ret='1' break fi done fi return "${ret}" } # Checks if a port is registered as in use by the system. # Takes a command for ss and a port value as parameters. # If an ss command is not given, a default of "ss" is assumed. # Returns 0 if the port is free, or non-0 if it already # in use or on failure. check_system_port() { typeset ss="${1:-"ss"}" typeset port="${2}" typeset empty_regex='^[[:space:]]*$' if [[ -z "${ss}" ]] || [[ "${ss}" =~ ${empty_regex} ]]; then return '2' fi typeset -i port_i="${port}" if [[ -z "${port}" ]] || [[ "${port}" != "${port_i}" ]] || [[ "${port}" -ne "${port_i}" ]] || [[ "${port_i}" -lt '1' ]] || [[ "${port_i}" -gt '65535' ]]; then return '3' fi typeset -i ret='0' # If the port is a well-known one, don't block it. grep -qs "[[:space:]]\+${port}/" '/etc/services' &>'/dev/null' && ret='1' if [[ "${ret}" -eq '0' ]]; then # If cache is empty, initialize it. if [[ "${#used_system_ports[@]}" -eq '0' ]]; then initialize_system_ports "${ss}" || ret='4' fi fi if [[ "${ret}" -eq '0' ]]; then typeset -i i='0' for ((i = 0; i < ${#used_system_ports[@]}; ++i)); do if [[ "${used_system_ports[i]}" = "${port}" ]]; then ret='1' break fi done fi return "${ret}" } # Checks if a port is registered as in use by the system. # Takes the current host name, a command for ss and a port value as parameters. # If an ss command is not given, a default of "ss" is assumed. # Returns 0 if the port is free, or non-0 if it already # in use or on failure. check_display_port() { typeset current_host_name="${1}" typeset ss="${2:-"ss"}" typeset port="${3}" typeset empty_regex='^[[:space:]]*$' if [[ -z "${current_host_name}" ]] || [[ "${current_host_name}" =~ ${empty_regex} ]] || [[ "${current_host_name}" = '(none)' ]] || [[ "${current_host_name}" = 'localhost' ]]; then return '2' fi if [[ -z "${ss}" ]] || [[ "${ss}" =~ ${empty_regex} ]]; then return '3' fi typeset -i port_i="${port}" if [[ -z "${port}" ]] || [[ "${port}" != "${port_i}" ]] || [[ "${port}" -ne "${port_i}" ]] || [[ "${port_i}" -lt '0' ]] || [[ "${port_i}" -gt '59535' ]]; then return '4' fi typeset -i ret='0' # If cache is empty, initialize it. if [[ "${#used_display_ports[@]}" -eq '0' ]]; then initialize_display_ports "${current_host_name}" || ret='5' fi if [[ "${ret}" -eq '0' ]]; then typeset -i i='0' for ((i = 0; i < ${#used_display_ports[@]}; ++i)); do if [[ "${used_display_ports[i]}" = "${port}" ]]; then ret='1' break fi done fi if [[ "${ret}" -eq '0' ]]; then # Looks free, check system sockets. if "${ss}" -lxs 2>'/dev/null' | grep -Eqs "(@|)/tmp/.X11-unix/X${port}(|-lock) " >'/dev/null'; then ret='1' fi fi if [[ "${ret}" -eq '0' ]]; then # Still looks free, check X2Go database. check_x2go_port "${current_host_name}" "$((port + 6000))" || ret='1' fi if [[ "${ret}" -eq '0' ]]; then # Still looks free, check system state. check_system_port "${ss}" "$((port + 6000))" || ret='1' fi return "${ret}" } x2goserver-4.1.0.3/x2goserver/lib/x2gocreatesession0000755000000000000000000000275313377671145017147 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_createsession); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $sid=shift or die; my $cookie=shift or die; my $pid=shift or die; my $client=shift or die; my $gr_port=shift or die; my $snd_port=shift or die; my $fs_port=shift or die; my $tekictrl_port=shift or die; my $tekidata_port=shift or die; db_createsession($sid, $cookie, $pid, $client, $gr_port, $snd_port, $fs_port, $tekictrl_port, $tekidata_port); # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2gocreateshadowsession0000755000000000000000000000270513377671145020352 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_createshadowsession); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $sid=shift or die; my $cookie=shift or die; my $pid=shift or die; my $client=shift or die; my $gr_port=shift or die; my $snd_port=shift or die; my $fs_port=shift or die; my $shadreq_user=shift or die; db_createshadowsession($sid, $cookie, $pid, $client, $gr_port, $snd_port, $fs_port, $shadreq_user); # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2gogetagent0000755000000000000000000000231313377671145016066 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_getagent); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $sid=shift or die; my $agent = db_getagent($sid); print $agent; # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2gogetagentstate0000755000000000000000000000213413377671145017130 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use X2Go::Server::DB; use X2Go::Server::Agent; my $sid=shift or die "argument session id missed"; my $user=getpwuid($<); print get_agent_state($sid, $user); x2goserver-4.1.0.3/x2goserver/lib/x2gogetdisplays0000755000000000000000000000234613377671145016626 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_getdisplays); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $host=shift or die; my $displays = join("\n", db_getdisplays($host)); print $displays; # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2gogetfreeport0000755000000000000000000000701313377671145016620 0ustar #!/bin/bash # Copyright (C) 2017-2018 X2Go Project - https://wiki.x2go.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Get first free port. # Takes the current host name, a command for ss, the port type, # a start and an end port as parameters. # If an ss command is not given, a default of "ss" is assumed. # If the port type is not given, a default of "lowlevel" is assumed. # If the start port is not given, a default of 1 is assumed. # If the end port is not given, a default of 65535 is assumed. # Valid values for the port type are "lowlevel" and "display". # Prints the first free port value on success, or the initial start # port number on failure. # Returns 0 on success or non-0 on failure. typeset current_host_name="${1}" typeset ss="${2:-"ss"}" typeset type="${3:-"lowlevel"}" typeset start="${4:-"1"}" typeset end="${5:-"65535"}" # Check parameter sanity. typeset empty_regex='^[[:space:]]*$' if [[ -z "${current_host_name}" ]] || [[ "${current_host_name}" =~ ${empty_regex} ]] || [[ "${current_host_name}" = '(none)' ]] || [[ "${current_host_name}" = 'localhost' ]]; then exit '2' fi if [[ -z "${ss}" ]] || [[ "${ss}" =~ ${empty_regex} ]]; then exit '3' fi typeset -i start_i="${start}" typeset -i end_i="${end}" if [[ -z "${start}" ]] || [[ "${start}" != "${start_i}" ]] || [[ "${start}" -ne "${start_i}" ]] || [[ "${start_i}" -lt '0' ]] || [[ "${start_i}" -gt '65535' ]]; then exit '4' fi if [[ -z "${end}" ]] || [[ "${end}" != "${end_i}" ]] || [[ "${end}" -ne "${end_i}" ]] || [[ "${end_i}" -lt "${start_i}" ]] || [[ "${end_i}" -gt '65535' ]]; then exit '5' fi [[ "${type}" != 'lowlevel' ]] && [[ "${type}" != 'display' ]] && exit '6' typeset x2go_lib_path="$(x2gopath 'libexec')" typeset X2GO_INTERNAL_SOURCE='1' # Make shellcheck happy. : "${X2GO_INTERNAL_SOURCE}" . "${x2go_lib_path}/x2gocheckport" unset X2GO_INTERNAL_SOURCE typeset -i ret_port="${start}" typeset -i ret='1' typeset -i work_port='0' typeset -i stop_port='65535' [[ "${type}" = 'display' ]] && stop_port="$((stop_port - 6000))" # Find the next free port number. for ((work_port = start; i <= stop_port; ++work_port)); do typeset -i i='0' typeset -i value_found='0' if [[ "${type}" = 'display' ]]; then check_display_port "${current_host_name}" "${ss}" "${work_port}" || value_found='1' else check_x2go_port "${current_host_name}" "${work_port}" || value_found='1' if [[ "${value_found}" -eq '0' ]]; then check_system_port "${ss}" "${work_port}" || value_found='1' fi fi # Port number taken? Continue with the next one. [[ "${value_found}" -ne '0' ]] && continue # Searched and got nothing? Great, grab that port number! ret_port="${work_port}" ret='0' break done # At this point, ${ret} and ${ret_port} should be set up correctly. # Either to the first free port value if one has been found (and ${ret} # to zero) or to the start port value (and ${ret} to one.) printf '%d\n' "${ret_port}" exit "${ret}" x2goserver-4.1.0.3/x2goserver/lib/x2gogetports0000755000000000000000000000233313377671145016141 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_getports); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $host=shift or die; my $ports = join("\n", db_getports($host)); print $ports; # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2gogetrandomport0000755000000000000000000001016413377671145017160 0ustar #!/bin/bash # Copyright (C) 2017-2018 X2Go Project - https://wiki.x2go.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. typeset x2go_lib_path="$(x2gopath "libexec")" "${x2go_lib_path}/x2gosyslog" "${0}" "debug" "$(basename "${0}") called with options: ${*}" # rnowotny, # Patch for SSH_PORT, to not use the same SSH port on each server, which is a # problem if you want to connect to different servers at the same time with # the windows client. # Original problem report: https://www.mail-archive.com/x2go-user@lists.berlios.de/msg00547.html # Currently implementation is based on the submitted patch, but differs heavily. # Gets the outward-facing server IPv4 address. # Does not take any parameters. # Outputs the default outgoing IPv4 address. # Returns 0 on success, otherwise non-0. get_server_ip_address() { # The provided IP address should be outside of any local network. # We are only interested in how the kernel would try to reach the # non-local IP address specified here. It is not actually contacted # in any way. typeset ip_output="$(ip route get 8.8.8.8)" # Remove newlines. ip_output="${ip_output//$'\n'}" # Fetch source address. typeset src_address="$(grep -oe 'src[[:space:]]\{1,\}\(\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\}\)' <<< "${ip_output}" | sed -e 's/src[[:space:]]\{1,\}//')" if [[ -n "${src_address}" ]]; then printf '%s\n' "${src_address}" return "0" fi return "1" } # Get some purely random port. # Does not take any parameters. # Outputs a random port value in range [30000, 62767]. # Returns 0. get_pure_random_port() { typeset -i unix_timestamp="$(date "+%s")" # Seed ${RANDOM}. This should probably be changed some time before 2106. # Or maybe not. RANDOM="${unix_timestamp}" typeset -i random_port="$((30000 + RANDOM))" printf '%d\n' "${random_port}" return "0" } # Gets a pseudo-random port based on the machine's # outgoing IP address. # Does not take any parameters. # Outputs a host-based pseudo-random port value. # Returns 0 on success, otherwise non-0. get_host_based_random_port() { "${x2go_lib_path}/x2gosyslog" "${0}" "debug" "host-based SSH port initialization requested." typeset ip_address='' typeset -i ret_port='0' typeset -i ret='1' if ip_address="$(get_server_ip_address)"; then typeset -i ip_address_last_octet="${ip_address##*.}" ret_port="$((30000 + (ip_address_last_octet * 128)))" printf '%d\n' "${ret_port}" fi return "${ret}" } # Refer to x2goserver.conf. typeset -i randomize_ssh_port="1" typeset randomize_ssh_port_config_value='' randomize_ssh_port_config_value="$("${x2go_lib_path}/x2goqueryconfig" "x2goagent" "port_randomization")" # Failures or incorrect values are implicitly caught by the default value. [[ "${randomize_ssh_port_config_value}" = "host-based" ]] && randomize_ssh_port='0' if [ "${randomize_ssh_port}" = "1" ]; then "${x2go_lib_path}/x2gosyslog" "${0}" "debug" "Full SSH port randomization requested." get_pure_random_port else "${x2go_lib_path}/x2gosyslog" "${0}" "debug" "host-based SSH port initialization requested." if ! get_host_based_random_port; then "${x2go_lib_path}/x2gosyslog" "${0}" "warning" "IP-based SSH port initialization requested, but failed to fetch primary address." "${x2go_lib_path}/x2gosyslog" "${0}" "warning" "Falling back to randomization." get_pure_random_port fi fi # No explicit return value, will use the last command's return value. # Make sure that the last command executed exits with the # return value you want to pass through! exit x2goserver-4.1.0.3/x2goserver/lib/x2gogetstatus0000755000000000000000000000233313377671145016315 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_getstatus); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $status; my $sid=shift or die; $status = db_getstatus($sid); print "$status"; # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2goinsertport0000755000000000000000000000240713377671145016505 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_insertport); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $server=shift or die; my $sid=shift or die; my $port=shift or die; db_insertport($server,$sid,$port); print "inserted"; # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2goinsertsession0000755000000000000000000000242513377671145017204 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_insertsession); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $display=shift or die; my $server=shift or die; my $sid=shift or die; db_insertsession($display, $server, $sid); print "inserted"; # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2goinsertshadowsession0000755000000000000000000000251713377671145020414 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_insertshadowsession); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $display=shift or die; my $server=shift or die; my $sid=shift or die; my $shadreq_user=shift or die; db_insertshadowsession($display, $server, $sid, $shadreq_user); print "inserted"; # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2goistrue0000755000000000000000000000174413377671145015612 0ustar #!/usr/bin/perl # Copyright (C) 2017-2018 X2Go Project - https://wiki.x2go.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use X2Go::Utils qw (is_true); my $value = shift; if (!(defined ($value))) { print STDERR "No value passed in, assuming empty string."; $value = ""; } print is_true ($value) . "\n"; exit 0; x2goserver-4.1.0.3/x2goserver/lib/x2golistsessions_sql0000755000000000000000000000344113377671145017714 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(dbsys_listsessionsroot_all dbsys_listsessionsroot dbsys_rmsessionsroot); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); sub check_pid { my $pid=shift; my $sess=shift; open (F,"; close (F); if ($text =~ m/$sess/) { return 1; } return 0; } my $serv=shift; my @array; if($serv eq "--all-servers") { @array=dbsys_listsessionsroot_all(); } else { @array=dbsys_listsessionsroot ($serv); } my $i; for ( $i=0;$i<@array;$i++) { my @ln=split('\|',@array[$i]); if ((@ln[4] eq "F") && (!check_pid(@ln[0], @ln[1]))) { my $sid = @ln[1]; dbsys_rmsessionsroot($sid); syslog('debug', "Purging finished session from X2Go db, session ID: $sid"); } print "@array[$i]\n"; } # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2gologlevel0000755000000000000000000000175313377671145016110 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use X2Go::Log qw(loglevel); print loglevel(); x2goserver-4.1.0.3/x2goserver/lib/x2goqueryconfig0000755000000000000000000000230313377671145016622 0ustar #!/usr/bin/perl # Copyright (C) 2017-2018 X2Go Project - https://wiki.x2go.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use X2Go::Config qw (get_config); my $section = shift or die "Missing section argument"; my $key = shift or die "Missing key argument"; if (!(length ($section))) { die "Invalid (empty) section argument"; } if (!(length ($key))) { die "Invalid (empty) key argument"; } my $Config = get_config (); my $val = $Config->param("$section.$key"); if (defined ($val)) { print "$val\n"; exit 0; } else { exit 1; } x2goserver-4.1.0.3/x2goserver/lib/x2goresume0000755000000000000000000000273213377671145015575 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_resume); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $client=shift or die; my $sid=shift or die; my $gr_port=shift or die; my $snd_port=shift or die; my $fs_port=shift or die; my $tekictrl_port; my $tekidata_port; $tekictrl_port=shift or $tekictrl_port=-1; $tekidata_port=shift or $tekidata_port=-1; db_resume($client, $sid, $gr_port, $snd_port, $fs_port, $tekictrl_port, $tekidata_port); # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2gormforward0000755000000000000000000000305613377671145016300 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $session=shift or die; my $pidfile="/tmp/.x2go-".getpwuid($>)."/C-$session/sshd.pid"; if( ! -e $pidfile) { #pid file not exists, forwarding already removed exit 0; } open(F,"<$pidfile"); my $output=; close(F); unlink($pidfile); my @words=split(" ",$output); my $process=@words[@words-1]; $output=`ps ax|grep $process`; if($output =~ m/sshd/) { #terminate process syslog('debug', "Terminating SSHD process: $process"); kill 'TERM', $process; } # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2gormport0000755000000000000000000000235513377671145015621 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB qw(db_rmport); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $server=shift or die; my $sid=shift or die; my $port=shift or die; db_rmport($server,$sid,$port); # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2gosuspend-agent0000755000000000000000000000232613377671145017051 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Log qw(loglevel); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); shift; shift; shift; my $capt=shift; my @words=split(" ",$capt); system("x2gosuspend-session @words[2] > /dev/null"); # closing syslog closelog; x2goserver-4.1.0.3/x2goserver/lib/x2gosyslog0000755000000000000000000000225713377671145015617 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Log qw(loglevel); setlogmask( LOG_UPTO(loglevel()) ); my $component = shift; my $loglevel = shift; my $msg = "@ARGV"; openlog($component,'cons','user'); syslog($loglevel, $msg); closelog; x2goserver-4.1.0.3/x2goserver/Makefile0000755000000000000000000001022013377671145014433 0ustar #!/usr/bin/make -f SRC_DIR=$(CURDIR) SHELL=/bin/bash INSTALL_DIR=install -d -o root -g root -m 755 INSTALL_FILE=install -o root -g root -m 644 INSTALL_PROGRAM=install -o root -g root -m 755 RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty DESTDIR ?= PREFIX ?= /usr/local ETCDIR=/etc/x2go BINDIR=$(PREFIX)/bin SBINDIR=$(PREFIX)/sbin LIBDIR=$(PREFIX)/lib/x2go MANDIR=$(PREFIX)/share/man SHAREDIR=$(PREFIX)/share/x2go BIN_SCRIPTS=$(shell cd bin && echo *) SBIN_SCRIPTS=$(shell cd sbin && echo *) LIB_FILES=$(shell cd lib && echo *) FEATURE_SCRIPTS=$(shell cd share/x2gofeature.d && echo *.features) man_pages = `cd man && find * -type f` MAN2HTML_BIN = $(shell which man2html) MAN2HTML_SRC = man MAN2HTML_DEST = .build_man2html/html all: clean build build: build-arch build-indep build-arch: build-indep: build_man2html build_man2html: if [ -n "$(MAN2HTML_BIN)" ]; then \ mkdir -p $(MAN2HTML_DEST); \ for man_page in $(man_pages); do mkdir -p `dirname $(MAN2HTML_DEST)/$$man_page`; done; \ for man_page in $(man_pages); do $(MAN2HTML_BIN) $(MAN2HTML_SRC)/$$man_page > $(MAN2HTML_DEST)/$$man_page.html; done; \ fi clean: clean-arch clean-indep clean-arch: clean-indep: clean_man2html clean_man2html: rm -Rf `dirname $(MAN2HTML_DEST)` install: install_scripts install_config install_man install_version install_scripts: $(INSTALL_DIR) $(DESTDIR)$(BINDIR) $(INSTALL_DIR) $(DESTDIR)$(SBINDIR) $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/x2gofeature.d $(INSTALL_PROGRAM) bin/* $(DESTDIR)$(BINDIR)/ $(INSTALL_PROGRAM) sbin/* $(DESTDIR)$(SBINDIR)/ $(INSTALL_PROGRAM) lib/* $(DESTDIR)$(LIBDIR)/ $(INSTALL_PROGRAM) share/x2gofeature.d/*.features $(DESTDIR)$(SHAREDIR)/x2gofeature.d/ install_config: $(INSTALL_DIR) $(DESTDIR)$(ETCDIR) $(INSTALL_DIR) $(DESTDIR)$(ETCDIR)/x2go_logout.d $(INSTALL_FILE) etc/x2go_logout $(DESTDIR)$(ETCDIR)/ $(INSTALL_FILE) etc/x2go_logout.d/* $(DESTDIR)$(ETCDIR)/x2go_logout.d/ $(INSTALL_DIR) $(DESTDIR)/etc/sudoers.d || true $(INSTALL_FILE) etc/sudoers.d/x2goserver $(DESTDIR)/etc/sudoers.d/ $(INSTALL_DIR) $(DESTDIR)/etc/logcheck/ignore.d.server || true $(INSTALL_FILE) etc/logcheck/ignore.d.server/x2goserver $(DESTDIR)/etc/logcheck/ignore.d.server/ install_man: $(INSTALL_DIR) $(DESTDIR)$(MANDIR) $(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man5 $(INSTALL_FILE) man/man5/*.5 $(DESTDIR)$(MANDIR)/man5 gzip -f $(DESTDIR)$(MANDIR)/man5/x2go*.5 $(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man8 $(INSTALL_FILE) man/man8/*.8 $(DESTDIR)$(MANDIR)/man8 gzip -f $(DESTDIR)$(MANDIR)/man8/x2go*.8 install_version: $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/versions $(INSTALL_FILE) VERSION.x2goserver $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver uninstall: uninstall_scripts uninstall_config uninstall_man uninstall_version uninstall_scripts: for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(BINDIR)/$$file; done for file in $(SBIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(SBINDIR)/$$file; done for file in $(LIB_FILES); do $(RM_FILE) $(DESTDIR)$(LIBDIR)/$$file; done for file in $(FEATURE_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(SHAREDIR)/x2gofeature.d/$$file; done $(RM_DIR) $(DESTDIR)$(LIBDIR) || true $(RM_DIR) $(DESTDIR)$(SHAREDIR)/x2gofeature.d || true $(RM_DIR) $(DESTDIR)$(SHAREDIR) || true uninstall_config: $(RM_FILE) $(DESTDIR)$(ETCDIR)/x2go_logout.d/* $(RM_FILE) $(DESTDIR)$(ETCDIR)/x2go_logout $(RM_DIR) $(DESTDIR)$(ETCDIR)/x2go_logout.d || true $(RM_DIR) $(DESTDIR)$(ETCDIR) || true $(RM_FILE) $(DESTDIR)/etc/sudoers.d/x2goserver $(RM_DIR) $(DESTDIR)/etc/sudoers.d || true $(RM_FILE) $(DESTDIR)/etc/logcheck/ignore.d.server/x2goserver $(RM_DIR) $(DESTDIR)/etc/logcheck/ignore.d.server || true $(RM_DIR) $(DESTDIR)/etc/logcheck || true uninstall_man: for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man8/$$file.8.gz; done for file in $(SBIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man8/$$file.8.gz; done $(RM_DIR) $(DESTDIR)$(MANDIR) || true uninstall_version: $(RM_FILE) $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver $(RM_DIR) $(DESTDIR)$(SHAREDIR)/versions || true x2goserver-4.1.0.3/x2goserver/man/man5/x2goserver.conf.50000644000000000000000000000454213377671145017535 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2goserver.conf 5 "Nov 2018" "Version 4.1.0.3" "X2Go Server Configuration" .SH NAME x2goserver.conf \- X2Go Server Main Configuration File .SH SYNOPSIS 'nh .fi .ad 1 x2goserver.conf .SH DESCRIPTION \fBx2goserver.conf\fR is the main configuration file for X2Go Server and the \fBX2Go::Server\fR Perl API. .SH SECTIONS The \fBx2goserver.conf\fR's configuration file format is an INI-based configuration format. It falls apart into sections and options with their values. [section1] sec1option1 = valueA sec1option2 = valueB ... [section2] sec2option1 = valueC sec2option2 = valueD ... .SH SECTION [limit users] In this section you can list up Posix users known to the system and specify the max. number of allowed simultaneous X2Go sessions in an X2Go Server farm. .PP .SH SECTION [limit groups] In this section you can list up Posix group names known to the system and specify the max. number of allowed simultaneous X2Go sessions in an X2Go Server farm. The session limitation applies to all users in the specified groups. .PP If individual users are listed in section \fI[limit users]\fR and some of their groups are listed in section \fI[limit groups]\fR, then the maximum value of allowed sessions will be chosen. .PP If a user is a member of several of the specified groups under section \fI[limit groups]\fR, then the number of allowed simultaneous X2Go sessions for a certain user will be derived from the group with the most allowed sessions found under this section. .PP .SH SECTION [log] The \fI[log]\fR's section only option is the \fIloglevel\fR option. Allowed values are: .TP 5 emerg, alert, crit, err, warning, notice, info, debug. .PP The \fIloglevel\fR option controls the verbosity of the X2Go::Server Perl functions. The log output appears via LOCAL7 (normally: /var/log/syslog). .PP .SH EXAMPLE The below configuration file is the default after installation of X2Go Server: [limit users] #user-foo=1 [limit groups] #bar-group=1 [log] # possible levels are: # emerg, alert, crit, err, warning, notice, info, debug loglevel=notice .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2gobasepath.80000644000000000000000000000115613377671145017076 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gobasepath 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2gobasepath \- Detect Base Path of X2Go Server Installation .SH SYNOPSIS 'nh .fi .ad 1 x2gobasepath .SH DESCRIPTION \fBx2gobasepath\fR writes the X2Go server installation base path (/usr, /usr/local, ...) to stdout. .PP \fBx2gobasepath\fR can be run with user privileges. .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2gocmdexitmessage.80000644000000000000000000000150013377671145020302 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gocmdexitmessage 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2gocmdexitmessage \- Exit Message of X2Go Command .SH SYNOPSIS 'nh .fi .ad l x2gocmdexitmessage \fI\fR .SH DESCRIPTION \fBx2gocmdexitmessage\fR prints out the exit message of the last command run with \fBx2goruncommand\fR for session \fI\fR. \fBx2gocmdexitmessage\fR is run with X2Go user privileges. .PP .SH RETURN VALUES \fBx2gocmdexitmessage\fR prints out the last command's exit message. .PP As exitcode \fBx2gocmdexitmessage\fR always returns 0. .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2godbadmin.80000644000000000000000000000122613377671145016703 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2godbadmin 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Admin Tool" .SH NAME x2godbadmin \- X2Go Server Database Administrator .SH SYNOPSIS 'nh .fi .ad l x2godbadmin .SH DESCRIPTION \fBx2godbadmin\fR is used to set up the initial X2Go session database and perform other maintenance tasks on the X2Go server's database. .PP \fBx2godbadmin\fR must be run with root privileges. .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2gofeature.80000644000000000000000000000161513377671145016742 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gofeature 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2gofeature \- Query X2Go Feature Availability on X2Go Server .SH SYNOPSIS 'nh .fi .ad 1 x2gofeature \fI\fR .SH DESCRIPTION \fBx2gofeature\fR allows client applications to query the server for certain features before trying to use them. .PP \fBx2gofeature\fR can be run with user privileges. .SH RETURN VALUES If feature \fI\fR is available on the X2Go server, then ,,ok'' is written to stdout. Otherwise the expression ,,not available'' is written to stdout. .SH SEE ALSO /usr/share/x2go/x2gofeature.d/*.features x2gofeaturelist(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2gofeaturelist.80000644000000000000000000000164213377671145017636 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gofeaturelist 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2gofeaturelist \- Query X2Go Feature List for X2Go Server .SH SYNOPSIS 'nh .fi .ad 1 x2gofeaturelist .SH DESCRIPTION \fBx2gofeaturelist\fR allows client applications to query a server-side list of X2Go features. Such a list is very handy when new X2Go clients connect to older X2Go server. The list of features provides an overview to the client on what functionalities the server support and what not. .PP \fBx2gofeaturelist\fR can be run with user privileges. .SH RETURN VALUES List of X2Go feature names. .SH SEE ALSO /usr/share/x2go/x2gofeature.d/*.features x2gofeature(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2gogetapps.80000644000000000000000000000351213377671145016750 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gogetapps 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2gogetapps \- Generate list of Published Applications .SH SYNOPSIS 'nh .fi .ad l x2gogetapps .SH DESCRIPTION \fBx2gogetapps\fR returns a machine-readable list of X2Go Published Applications. This command is evoked from connected X2Go client applications. .PP \fBx2gogetapps\fR is run with normal user privileges. .SH RETURN VALUES \fBx2gogetapps\fR returns one or multiple items in the below format: [ ... base64 encoded image information ...] [ ... selected fields form .desktop file ... ] ... As exitcode \fBx2gogetapps\fR always returns 0. .SH SECURITY INFORMATION / DISCLAIMER Users are advised to not misinterpret X2GoServer's Published Application Mode as a security feature. .PP Even when using Published Application Mode, it is still possible for users to locally configure an X2Go Client with any setting they want, and use that to connect. .PP So if you're trying to keep users from running a certain application on the host, using Published Application Mode to "lock" the configuration is the *wrong* way. The users will still be able to run that application by creating their own, local configuration file and using that. .PP To keep users from running an application on the server, you have to use *filesystem permissions*. In the simplest case, this means setting chmod 750 or 550 on the particular application on the host, and making sure the users in question are not the owner and also not a member of the group specified for the application. .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2gogetservers.80000644000000000000000000000121413377671145017473 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gogetservers 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2gogetservers \- Retrieve list of available X2Go servers .SH SYNOPSIS 'nh .fi .ad l x2gogetservers .SH DESCRIPTION \fBx2gogetservers\fR retrieves a list of available X2Go servers. This command is used in X2Go load balancing scenarios. .PP The \fBx2gogetservers\fR is run with X2Go user privileges. .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2golistdesktops.80000644000000000000000000000246613377671145020044 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2golistdesktops 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2golistdesktops \- List Available X Desktops .SH SYNOPSIS 'nh .fi .ad l x2golistdesktops [\fI\fR] .SH DESCRIPTION \fBx2golistdesktops\fR returns a list of active desktop sessions running on server \fI\fR. If no server hostname is given at the command line, the fully qualified domain name of the local system is used here. .PP \fBx2golistdesktops\fR is run with X2Go user privileges and it is used by X2Go clients to render a list of available desktops that may be candidates for X2Go desktop sharing (shadow sessions). .PP The list of desktops will include local desktop sessions (launched via KDM, GDM, etc.) run by the same user, X2Go desktop sessions run by the same user and desktop sessions of other users (local or remote) that are announced via the \fBx2godesktopsharing\fR utility. .SH RETURN VALUES A list of available X desktops, line-by-line. .PP As exitcode \fBx2golistdesktop\fR always returns 0. .SH SEE ALSO x2godesktopsharing(1) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2golistmounts.80000644000000000000000000000250213377671145017524 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2golistmounts 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2golistmounts \- List Mounted Shares for an X2Go Session .SH SYNOPSIS 'nh .fi .ad l x2golistmounts [\fI\fR] .SH DESCRIPTION \fBx2golistmounts\fR returns a list of mounted client-side folders or devices for X2Go session \fI\fR. .PP If this commands get evoked inside an X2Go session, the \fI\fR parameter can be omitted (and the env var $X2GO_SESSION will be used instead). .PP \fBx2golistmounts\fR is run with normal user privileges and it is used by X2Go clients to render a list of SSHFS mounts for a given X2Go sessions. .SH RETURN VALUES A line-by-line list of mounted shares is returned by \fBx2golistmounts\fR. Each line consists of two mount point attribute fields separated by the pipe symbol (,,|''). .PP The meanings of these mount point attributes are: field 01: \fI\fR field 02: \fI\fR As exitcode \fBx2golistmounts\fR always returns 0. .SH SEE ALSO x2gomountdirs(8), x2goumount-session(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2golistsessions.80000644000000000000000000000422213377671145020046 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2golistsessions 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2golistsessions \- List Available X2Go Sessions for User .SH SYNOPSIS 'nh .fi .ad l x2golistsessions [\fI\fR|\fI--all-servers\fR] .SH DESCRIPTION \fBx2golistsessions\fR returns a list of running or suspended X2Go sessions for X2Go server \fI\fR. If no server hostname is given at the command line, the session list query runs for the local system. .PP \fBx2golistsessions\fR is run with normal user privileges and it is used by X2Go clients to render a list of available X2Go sessions. .SH X2GO CLUSTER MODE If \fBx2golistsessions\fR is executed with the \fI--all-servers\fR option then the central database of your X2Go cluster is queried for running/suspended sessions belonging to the user executing this command. These sessions may be active on any of the X2Go servers within your cluster. .SH RETURN VALUES A line-by-line list of available X2Go sessions. Each line consists of several session attribute fields separated by the pipe symbol (,,|''). .PP The meaning of the session attributes of each output line are shown below: field 01: \fI\fR field 02: \fI\fR field 03: \fI\fR field 04: \fI\fR field 05: \fI\fR field 06: \fI\fR field 07: \fI\fR field 08: \fI\fR field 09: \fI\fR field 10: \fI\fR field 11: \fI\fR field 12: \fI\fR field 13: \fI\fR field 14: \fI\fR field 15: \fI\fR (if Telekinesis is available/enabled) field 15: \fI\fR (if Telekinesis is available/enabled) .PP As exitcode \fBx2golistsessions\fR always returns 0. .SH SEE ALSO x2golistsessions_root(8), x2golistdesktops(8), x2goresume-session(8), x2gosuspend-session(8), x2goterminate-session(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2golistsessions_root.80000644000000000000000000000156613377671145021121 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2golistsessions_root 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Admin Tool" .SH NAME x2golistsessions_root \- List X2Go Sessions for System .SH SYNOPSIS 'nh .fi .ad l x2golistsessions_root [\fI\fR] .SH DESCRIPTION \fBx2golistsessions_root\fR shows a list of all available X2Go sessions on the server \fI\fR. If no server hostname is given at the command line, the session list query runs for the local system. .PP \fBx2golistsessions_root\fR must be run with root privileges. .PP .SH RETURN VALUES Same as explained in x2golistsessions(8). .SH SEE ALSO x2golistsessions(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2golistshadowsessions.80000644000000000000000000000414313377671145021256 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2golistshadowsessions 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2golistshadowsessions \- List Available X2Go Shadow Sessions for User .SH SYNOPSIS 'nh .fi .ad l x2golistshadowsessions [\fI\fR|\fI--all-servers\fR] .SH DESCRIPTION \fBx2golistshadowsessions\fR returns a list of running or suspended X2Go shadow sessions (sessions that provide the X2Go Desktop Sharing feature) for X2Go server \fI\fR. If no server hostname is given at the command line, the shadow session list query runs for the local system. .PP \fBx2golistshadowsessions\fR is run with normal user privileges and it is used by X2Go clients to render a list of available X2Go shadow sessions. .SH X2GO CLUSTER MODE If \fBx2golistshadowsessions\fR is executed with the \fI--all-servers\fR option then the central database of your X2Go cluster is queried for running/suspended shadow sessions belonging to the user executing this command. These sessions may be active on any of the X2Go servers within your cluster. .SH RETURN VALUES A line-by-line list of available X2Go sessions. Each line consists of several session attribute fields separated by the pipe symbol (,,|''). .PP The meaning of the session attributes of each output line are shown below: field 01: \fI\fR field 02: \fI\fR field 03: \fI\fR field 04: \fI\fR field 05: \fI\fR field 06: \fI\fR field 07: \fI\fR field 08: \fI\fR field 09: \fI\fR field 10: \fI\fR field 11: \fI\fR field 12: \fI\fR field 13: \fI\fR field 14: \fI\fR .PP As exitcode \fBx2golistshadowsessions\fR always returns 0. .SH SEE ALSO x2golistsessions(8), x2golistdesktops(8), x2goresume-session(8), x2gosuspend-session(8), x2goterminate-session(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2gomountdirs.80000644000000000000000000000510013377671145017324 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gomountdirs 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2gomountdirs \- Share Client-Side Folder with X2Go Session .SH SYNOPSIS 'nh .fi .ad l x2gomountdirs [ [ [...]]] .SH DESCRIPTION \fBx2gomountdirs\fR mounts client\-side folders or devices onto mountpoints that are accessible from within your remote X2Go session. .PP \fBx2gomountdirs\fR is run with X2Go user privileges and normally issued by an X2Go client application. .SH ARGUMENTS .TP \*(T<\fB\\fR\*(T> If the mount type is set to ,,dir'' then the client-side mount target is interpreted as a folder. If other, it is interpreted as a device. .TP \*(T<\fB\\fR\*(T> The is the unique identifier of the X2Go session that this command is run for. .TP \*(T<\fB\\fR\*(T> The owner of session is given as the argument. .TP \*(T<\fB\\fR\*(T> Location of a temporary private SSH key file (only valid for this command execution). .TP \*(T<\fB\ [ [ [...]]]\fR\*(T> A list of client-side folders or device mount points that shall be mounted for X2Go session . .PP .SH PERMISSIONS X2Go uses the fuse-based SSH filesystem (SSHFS) for sharing client\-side file resources with X2Go sessions. Users that shall use X2Go folder sharing must be members of the X2Go server's ,,fuse'' POSIX group. .SH RETURN VALUES \fBx2gomountdirs\fR returns some mount point information to stdout if the mounting process has been successful. The mount results are printed line\-by\-line. The individual lines must be interpreted as shown below: line 01: dirs:__REVERSESSH_PORT__ line 02: ssh port: line 03: Host: line 04: User: line 05: inserted, sshfs \-o \\ "@:"" \\ "" \-p line 06: mount ok line 07: fname: .PP If mounting of a client folder fails, either of the errors is returned (on stdout): error 01: mounting of failed error 02: insertion of failed (already mounted?), not mounting .PP As exitcode \fBx2gomoundirs\fR always returns 0. .SH SEE ALSO x2goumount-session(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2gopath.80000644000000000000000000000151113377671145016236 0ustar .TH x2gopath 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH Name .PP x2gopath - Show X2Go Server installation paths .SH Synopsis .PP \fBx2gopath\fP {\fIbase\fR|\fIlib\fR|\fIlibexec\fR|\fIshare\fR} .SH Description .PP \fBx2gopath\fP displays the paths of the selected X2Go installation directory. .TP \fBbase\fP The prefix under which X2Go was installed. This is generally \fB/usr\fP or \fB/usr/local\fP. .TP \fBlib\fP The location of X2Go architecture-dependent parts (e.g. libraries, but also Perl modules). .\" Possible examplares are /usr/lib64/x2go (traditional biarch) and .\" /usr/lib/x86_64-gnu-linux/x2go (Debian-style multiarch) .TP \fBlibexec\fP The location of private X2Go binaries. .\" Possible examples are /usr/libexec/x2go and /usr/lib/x2go. .TP \fBshare\fP The location of X2Go's data files. .\" prefix + /share/x2go x2goserver-4.1.0.3/x2goserver/man/man8/x2goresume-session.80000644000000000000000000000566613377671145020302 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2goresume-session 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2goresume-session \- Resume X2Go Session .SH SYNOPSIS 'nh .fi .ad l \fBx2goresume-session\fR \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ \fI\fR .SH DESCRIPTION \fBx2goresume-session\fR resumes the suspended session with session ID \fI\fR. .PP This command is normally issued by an X2Go client application with X2Go user privileges. .SH ARGUMENTS .TP \*(T<\fI\\fR\*(T> The session ID (or session name) of the suspend session that is to be resumed. .TP \*(T<\fI\\fR\*(T> Session window size on screen (allowed values: x or fullscreen). .TP \*(T<\fI\\fR\*(T> Any value out of: modem, isdn, adsl, wan or lan. .TP \*(T<\fI\\fR\*(T> NX compression method (see below for possible values). .TP \*(T<\fI\\fR\*(T> Cache type and color depth for X2Go session window. The most common value is: unix-kde-depth_24 where ,,24'' is the color depth in bit. .TP \*(T<\fI\\fR\*(T> Keyboard layout (e.g. us, de, etc.). .TP \*(T<\fI\\fR\*(T> Keyboard type/model (e.g. pc105/us). .TP \*(T<\fI\\fR\*(T> Force setting keyboard layout and type within the X2Go session on startup. Values: 0 or 1. .TP \*(T<\fI\\fR\*(T> The session's clipboard mode. Possible values: both, server, client, none. Allows one to configure clipboard security per session via the connecting X2Go client. If the clipboard parameter is set server-side in /etc/x2go/x2goagent.options, then that value will override client-side settings. .SH RETURN VALUES \fBx2goresume-session\fR reports to stderr if resuming of session \fI\fR failed. This very probably means that the session's X agent has died, so the session \fI\fR will be marked as finished in the X2Go session database. .PP If everything works out well, a list of session attributes is returned after successful session resumption. Session attributes will be presented on a line-by-line basis: field 01: \fI\fR field 02: \fI\fR field 03: \fI\fR field 04: \fI\fR (if Telekinesis is available/enabled) field 04: \fI\fR (if Telekinesis is available/enabled) .PP As exitcode \fBx2goresume-session\fR always returns 0. .SH SEE ALSO x2gostartagent(8), x2goruncommand(8), x2gosuspend-session(8), x2goterminate-session(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2goruncommand.80000644000000000000000000000336513377671145017456 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2goruncommand 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2goruncommand \- Launch Command inside an X2Go Session .SH SYNOPSIS 'nh .fi .ad l x2goruncommand .SH DESCRIPTION \fBx2goruncommand\fR launches a(n X-based) command inside of a given X2Go session. .PP \fBx2goruncommand\fR is run with X2Go user privileges and normally executed by an X2Go client application. .SH ARGUMENTS .TP \*(T<\fB\\fR\*(T> The X display number/port of the session this command is for. .TP \*(T<\fB\\fR\*(T> The process ID (pid) of the x2goagent instance that the given session runs in. .TP \*(T<\fB\\fR\*(T> The is the unique identifier of the X2Go session that this command is intended for. .TP \*(T<\fB\\fR\*(T> Execute command . Full paths will be ignored, the command has to be in the server's $PATH. Possible generic values for are: WWWBROWSER, OFFICE, MAILCLIENT and TERMINAL. .TP \*(T<\fB\\fR\*(T> Either of the possible sound systems supported by X2Go: pulse, esd, arts (obsolete) or none. .TP \*(T<\fB\\fR\*(T> Allowed values for are: D (desktop) and R (rootless). .SH RETURN VALUES By \fBx2goruncommand\fR nothing is reported on stdout or stderr. .PP As exitcode \fBx2goruncommand\fR always returns 0. .SH SEE ALSO x2gostartagent(8), x2goresume-session(8), x2gosuspend-session(8), x2goterminate-sessions(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2gosessionlimit.80000644000000000000000000000103413377671145020024 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gosessionlimit 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2gosessionlimit \- Detect Session Limit for User or Group .SH SYNOPSIS 'nh .fi .ad 1 x2gosessionlimit .SH DESCRIPTION \fBx2gosessionlimit\fR is not yet documented as a man page... TODO! .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2gosetkeyboard.80000644000000000000000000000224213377671145017620 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gosetkeyboard 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool (PyHoca)" .SH NAME x2gosetkeyboard \- Allow server-side Keyboard Setting Updates issued by X2Go Client .SH SYNOPSIS 'nh .fi .ad l x2gosetkeyboard .SH DESCRIPTION \fBx2gosetkeyboard\fR looks for a 'keyboard' file in the X2Go session directory and introspects the X2Go session keyboard settings requested from the client side. .PP If no 'keyboard' file is present in the X2Go session directory, nothing happens (i.e. no error will be raised). .SH RETURN VALUES If \fBx2gosetkeyboard\fR successfully sets the session's keyboard parameters an exit code of 0 is returned. Also, if the file ${HOME}/.x2go/C-${X2GO_SESSION}/keyboard is not presented at the expected location, a zero-exitcode is returned. .PP If the command fails on its way, then the exitcode of the failing command is returned. .SH FILES ${HOME}/.x2go/C-${X2GO_SESSION}/keyboard .PP .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2goshowblocks.80000644000000000000000000000127513377671145017467 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2goshowblocks 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2goshowblocks \- Show X2Go-Mounted Block Devices .SH SYNOPSIS 'nh .fi .ad l x2goshowblocks .SH DESCRIPTION \fBx2goshowblocks\fR lists mounted shares for user and X2Go session with ID . .PP The \fBx2goshowblocks\fR must be run with root privileges. .SH SEE ALSO x2gomountdirs(8), x2goumount-session(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2gostartagent.80000644000000000000000000000765613377671145017476 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gostartagent 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2gostartagent \- Start a New X2Go Session .SH SYNOPSIS 'nh .fi .ad l \fBx2gostartagent\fI \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ \fI\fR \ \\ .SH DESCRIPTION \fBx2gostartagent\fR coordinates the startup process of a new X2Go session. It expects quite a list of parameters, all of which are obligatory. .PP \fBx2gostartagent\fR is run with X2Go user privileges and normally executed by an X2Go client application. .SH ARGUMENTS .TP \*(T<\fI\\fR\*(T> Session window size on screen (allowed values: x or fullscreen). .TP \*(T<\fI\\fR\*(T> Any value out of: modem, isdn, adsl, wan or lan. .TP \*(T<\fI\\fR\*(T> NX compression method (see below for possible values). .TP \*(T<\fI\\fR\*(T> Cache type and color depth for X2Go session window. The most common value is: unix-kde-depth_24 where ,,24'' is the color depth in bit. .TP \*(T<\fI\\fR\*(T> Keyboard layout (e.g. us, de, etc.). .TP \*(T<\fI\\fR\*(T> Keyboard type/model (e.g. pc105/us). .TP \*(T<\fI\\fR\*(T> Force setting keyboard layout and type within the X2Go session on startup. Values: 0 or 1. .TP \*(T<\fI\\fR\*(T> Allowed values for are: D (desktop), R (rootless) or S (shadow session, X2Go desktop sharing). .TP \*(T<\fI\\fR\*(T> The command given by the argument is only used to create the session ID for this new X2Go session. The actual execution of a command is handled by \fBx2goruncommand\fR. .TP \*(T<\fI\\fR\*(T> The session's clipboard mode. Possible values: both, server, client, none. Allows one to configure clipboard security per session via the connecting X2Go client. If the clipboard parameter is set server-side in /etc/x2go/x2goagent.options, then that value will override client-side settings. .PP .SH RETURN VALUES A list of session attributes is returned after successful session startup. Session attributes will be presented on a line-by-line basis: field 01: \fI\fR field 02: \fI\fR field 03: \fI\fR field 04: \fI\fR field 05: \fI\fR field 06: \fI\fR field 07: \fI\fR field 08: \fI\fR (if Telekinesis is available/enabled) field 09: \fI\fR (if Telekinesis is available/enabled) .PP .SH NX COMPRESSION METHODS As NX compression methods (\fI\fR argument) the following values are possible. The % character must be replaced by a digit 0-9. .PP nopack, 8, 64, 256, 512, 4k, 32k, 64k, 256k, 2m, 16m 256-rdp, 256-rdp-compressed, 32k-rdp, 32k-rdp-compressed, 64k-rdp 64k-rdp-compressed, 16m-rdp, 16m-rdp-compressed rfb-hextile, rfb-tight, rfb-tight-compressed 8-tight, 64-tight, 256-tight, 512-tight, 4k-tight, 32k-tight 64k-tight, 256k-tight, 2m-tight, 16m-tight 8-jpeg-%, 64-jpeg, 256-jpeg, 512-jpeg, 4k-jpeg, 32k-jpeg 64k-jpeg, 256k-jpeg, 2m-jpeg, 16m-jpeg-% 8-png-jpeg-%, 64-png-jpeg, 256-png-jpeg, 512-png-jpeg, 4k-png-jpeg 32k-png-jpeg, 64k-png-jpeg, 256k-png-jpeg, 2m-png-jpeg, 16m-png-jpeg-% 8-png-%, 64-png, 256-png, 512-png, 4k-png 32k-png, 64k-png, 256k-png, 2m-png, 16m-png-% 16m-rgb-%, 16m-rle-% .SH SEE ALSO x2goruncommand(8), x2goresume-session(8), x2gosuspend-session(8), x2goterminate-session(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2gosuspend-session.80000644000000000000000000000205513377671145020450 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2gosuspend-session 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2gosuspend-session \- Suspend an X2Go Session .SH SYNOPSIS 'nh .fi .ad l x2gosuspend-session .SH DESCRIPTION \fBx2gosuspend-session\fR suspends the running session with session ID . .PP This command is normally issued by an X2Go client application with X2Go user privileges. .SH RETURN VALUES \fBx2gosuspend-session\fR reports to stderr if resuming of session failed. This very probably means that the session's X agent has died, so the session will be marked as finished in the X2Go session database. .PP As exitcode \fBx2gosuspend-session\fR always returns 0. .SH SEE ALSO x2gostartagent(8), x2goruncommand(8), x2goresume-session(8), x2goterminate-session(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2goterminate-session.80000644000000000000000000000165313377671145020762 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2goterminate-session 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2goterminate-session \- Terminate an X2Go Session .SH SYNOPSIS 'nh .fi .ad l x2goterminate-session .SH DESCRIPTION \fBx2goterminate-session\fR cleanly terminates the running or suspended session with session ID . .PP This command is normally issued by an X2Go client application with X2Go user privileges. .SH RETURN VALUES By \fBx2goterminate-session\fR nothing is reported on stdout or stderr. .PP As exitcode \fBx2goterminate-session\fR always returns 0. .SH SEE ALSO x2gostartagent(8), x2goruncommand(8), x2goresume-session(8), x2gosuspend-session(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2goumount-session.80000644000000000000000000000316013377671145020314 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2goumount-session 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2goumount-session \- Unshare mounted Folders from X2Go Session .SH SYNOPSIS 'nh .fi .ad l x2goumount-session [] .SH DESCRIPTION \fBx2goumount-session\fR is used to unshare client folders from X2Go session with session ID . Shared folders have been previously mounted into the X2Go session by the \fBx2gomountdirs\fR command. .PP \fBx2goumount-session\fR is run with X2Go user privileges and normally issued by an X2Go client application. .SH ARGUMENTS .TP \*(T<\fB\\fR\*(T> Unmount shared folder(s) as registered for X2Go session ID in the X2Go session database. .TP \*(T<\fB\\fR\*(T> Optionally, you can name a local path name (path name as found on the client-side) here. If given, only the named folder is unshared from the X2Go session . .PP If this optional argument is omitted, then ALL session folders will be unshared (including spool folders for printing and MIME box). .SH RETURN VALUES .SH RETURN VALUES By \fBx2goumount-session\fR nothing is reported on stdout or stderr. .PP As exitcode \fBx2goumount-session\fR return 0 on successful an umount action. If there is a failure during unmounting a shared folder a non-zero exit code is returned. .SH SEE ALSO x2gomountdirs(8) .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/x2goserver/man/man8/x2goversion.80000644000000000000000000000221013377671145016764 0ustar '\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2goversion 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2goversion \- Retrieve Code Versions of X2Go Server Components .SH SYNOPSIS 'nh .fi .ad l x2goversion [] .SH DESCRIPTION \fBx2goversion\fR allows one to retrieve code versions of X2Go server components. .PP If the \fB[]\fR parameter is omitted then a list of all available X2Go server component names and versions is listed. .PP If an X2Go component is specified with the \fB[]\fR parameter, then only the component's version is printed to stdout. .PP The \fBx2goversion\fR tool can be used by X2Go client implementations to query server-side versions of X2Go components. .SH RETURN VALUES \fBx2goversion\fR reports X2Go component version information to stdout. .PP As exitcode \fBx2goversion\fR always returns 0. .SH FILES /usr/share/x2go/versions/VERSION.* .PP .SH AUTHOR This manual has been written by Mike Gabriel for the X2Go project (https://www.x2go.org). x2goserver-4.1.0.3/X2Go/Server.pm0000644000000000000000000000307213377671145013254 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # Copyright (C) 2010-2015 Mike Gabriel # Copyright (C) 2013-2015 Guangzhou Nianguan Electronics Technology Co.Ltd. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. package X2Go::Server; =head1 NAME X2Go::Server - X2Go Server package for Perl =head1 DESCRIPTION X2Go::Server Perl package. =cut use strict; use Sys::Hostname; use X2Go::Server::DB qw(db_listsessions); use base 'Exporter'; our @EXPORT = ( 'get_session_info', ); sub get_session_info { my $theX2GoSID = $_[0]; foreach my $sessionLine (db_listsessions(hostname)) { if ($sessionLine =~ /$theX2GoSID/) { return split(/\|/,$sessionLine); } } return 0; } 1; x2goserver-4.1.0.3/x2goserver-printing/bin/x2goprint0000755000000000000000000001415513377671145017265 0ustar #!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder # Copyright (C) 2007-2018 Heinz-Markus Graesing # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use File::Basename; use File::Copy; use File::Path; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB; use X2Go::Log qw(loglevel); use X2Go::Utils qw(system_capture_merged_output); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); syslog('info', "x2goprint has been called with options: @ARGV"); sub check_root { my ($uname, $pass, $uid, $pgid, $quota, $comment, $gcos, $homedir, $shell, $expire) = getpwuid($<); my $realuser=$uname; if ($realuser ne "root") { syslog('err', "ERROR: x2goprint was called by user $realuser directly, x2goprint exits now!"); die "$realuser, you cannot use x2goprint as non-root user..."; } } sub check_usage { if (scalar(@ARGV) == 1) { syslog('info', "x2goprint was called with only one cmd line arg, running in x2golistsessions wrapper mode"); system ("su", "@ARGV[0]", "-s", "/bin/sh", "-c", "x2golistsessions --all-servers"); exit 0; } elsif (scalar(@ARGV) != 4) { syslog('err', "ERROR: x2goprint was called with a wrong number of cmd line args, x2goprint exits now!"); print { \*STDERR } "ERROR: Usage:\nx2goprint user session file titleFile\nx2goprint user\n"; exit 1; } } # sanity check, this script has to be run with root privileges check_root(); # check number of cmd line args check_usage(); # get options from the command line my ($user, $session, $pdfFile, $titleFile)=@ARGV; # location for incoming jobs is ~x2goprint my ($tm,$tm,$uid,$gid,$tm,$tm,$tm,$homedir)=getpwnam("x2goprint"); my $printdir=$homedir; # extract necessary information from title file and drop it afterwards my $title='UNTITLED'; if( -e "$printdir/$titleFile") { open (TITLE,"<$printdir/$titleFile"); $title=; close (TITLE); unlink("$printdir/$titleFile"); } syslog('notice', "x2goprint is processing $printdir/$pdfFile with print job title ,,$title\''"); # temp location for placing incoming spool files, so that # they can can be picked by the session user and further processed # with user privileges ($tm,$tm,$uid,$gid,$tm,$tm,$tm,$homedir)=getpwnam($user); my $spoolbase="/tmp/.x2go-$user/spool"; my $spooldir="$spoolbase/C-$session"; my $spooltmp="$spoolbase/tmp"; mkpath($spooltmp); chown $uid, $gid, "$spooltmp"; chmod 0700, "$spooltmp"; # this last part mainly uses the session user's privileges my $mounts=system_capture_merged_output("su", "$user", "-c", "x2golistmounts $session"); if ( $mounts=~m/$spooldir/) { # if the client side spool dir (the directory where x2goclient # waits for incoming print job files) is mounted in the session # we will copy the print files from the temp location above to # the SSHFS share mounted from the client system. syslog('info', "client-side spool dir is mounted, transferring printable file $pdfFile to X2Go client system"); if (not move("$printdir/$pdfFile", "$spooltmp")) { syslog('err', "ERROR: x2goprint failed to process print spool job for file $pdfFile"); die "$0: Can't move $printdir/$pdfFile to $spooltmp/"; } chown $uid, $gid, "$spooltmp/$pdfFile"; system("su", "$user", "-c", "mv $spooltmp/$pdfFile $spooldir"); syslog('debug', "x2goprint moved file $pdfFile to X2Go client's spool dir"); # Different fuse versions seem to handle cross-boundary moves differently. # Older fuse versions seem to move files atomically (which is what we expect), i.e., # the file turns up on the remote file system fully populated. # Newer fuse versions first create the file and then populate it, leading to a race # condition with X2Go Client: # - X2Go Client sees the .ready file # - immediately tries to read its content # - deletes the file # # To further understand what is happening, consider that an mv operation is only # (somewhat) guaranteed to be atomic for moves within a file system. In this case, # mv uses the rename(2) system call, which, according to POSIX/SUS shall be atomic # in certain cases (though it seems to only hold when the target file already # exists). Then again, the C standard itself, which POSIX is also referencing, # does not make any guarantees when it comes to atomicity, rather it says that the # behavior is "implementation-defined" when the target file already exists. When # crossing boundaries, all bets are off. Such an operation might be atomic, but # might also be implemented as the equivalent of cp && rm. # # We'll handle this by generating a temporary file on the local server file system # (suffixed .notready), copying that to the fuse mount and then issuing a fs-local # mv/rename operation that we really, really, really hope will be atomic. open (RFILE,">$spooltmp/$pdfFile.notready"); print RFILE "$pdfFile\n$title"; close (RFILE); chown $uid, $gid, "$spooltmp/$pdfFile.notready"; system ("su", "$user", "-c", "mv $spooltmp/$pdfFile.notready $spooldir"); system ("su", "$user", "-c", "mv $spooldir/$pdfFile.notready $spooldir/$pdfFile.ready"); syslog('debug', "x2goprint moved file $pdfFile.ready to X2Go client's spool dir, X2Go client should start the print dialog very soon"); } else { # if the client-side spool dir is not mounted via SSHFS, we will simply drop the # printable PDF file syslog('info', "client-side spool dir is _not_ mounted, dropping spool job $pdfFile"); unlink("$printdir/$pdfFile"); } # closing syslog closelog; �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-printing/Makefile�����������������������������������������������������0000755�0000000�0000000�00000005001�13377671145�016264� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/make -f SRC_DIR=$(CURDIR) SHELL=/bin/bash INSTALL_DIR=install -d -o root -g root -m 755 INSTALL_FILE=install -o root -g root -m 644 INSTALL_PROGRAM=install -o root -g root -m 755 RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty DESTDIR ?= PREFIX ?= /usr/local ETCDIR=/etc/x2go BINDIR=$(PREFIX)/bin SBINDIR=$(PREFIX)/sbin LIBDIR=$(PREFIX)/lib/x2go MANDIR=$(PREFIX)/share/man SHAREDIR=$(PREFIX)/share/x2go BIN_SCRIPTS=$(shell cd bin && echo *) FEATURE_SCRIPTS=$(shell cd share/x2gofeature.d && echo *.features) man_pages = `cd man && find * -type f` MAN2HTML_BIN = $(shell which man2html) MAN2HTML_SRC = man MAN2HTML_DEST = .build_man2html/html all: clean build build: build-arch build-indep build-arch: build-indep: build_man2html build_man2html: if [ -n "$(MAN2HTML_BIN)" ]; then \ mkdir -p $(MAN2HTML_DEST); \ for man_page in $(man_pages); do mkdir -p `dirname $(MAN2HTML_DEST)/$$man_page`; done; \ for man_page in $(man_pages); do $(MAN2HTML_BIN) $(MAN2HTML_SRC)/$$man_page > $(MAN2HTML_DEST)/$$man_page.html; done; \ fi clean: clean_man2html clean_man2html: rm -rf `dirname $(MAN2HTML_DEST)` install: install_scripts install_config install_man install_version install_scripts: $(INSTALL_DIR) $(DESTDIR)$(BINDIR) $(INSTALL_PROGRAM) bin/* $(DESTDIR)$(BINDIR)/ $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/x2gofeature.d/ $(INSTALL_PROGRAM) share/x2gofeature.d/*.features $(DESTDIR)$(SHAREDIR)/x2gofeature.d/ install_config: install_man: $(INSTALL_DIR) $(DESTDIR)$(MANDIR) $(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man8 $(INSTALL_FILE) man/man8/*.8 $(DESTDIR)$(MANDIR)/man8 gzip -f $(DESTDIR)$(MANDIR)/man8/x2go*.8 install_version: $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/versions $(INSTALL_FILE) VERSION.x2goserver-printing $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-printing uninstall: uninstall_scripts uninstall_config uninstall_man uninstall_version uninstall_scripts: for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(BINDIR)/$$file; done for file in $(FEATURE_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(SHAREDIR)/x2gofeature.d/$$file; done uninstall_config: uninstall_man: for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man8/$$file.8.gz; done for file in $(SBIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man8/$$file.8.gz; done $(RM_DIR) $(DESTDIR)$(MANDIR) || true uninstall_version: $(RM_FILE) $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-printing $(RM_DIR) $(DESTDIR)$(SHAREDIR)/versions || true �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-printing/man/man8/x2goprint.8�����������������������������������������0000644�0000000�0000000�00000004743�13377671145�020300� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������'\" -*- coding: utf-8 -*- .if \n(.g .ds T< \\FC .if \n(.g .ds T> \\F[\n[.fam]] .de URL \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac .TH x2goprint 8 "Nov 2018" "Version 4.1.0.3" "X2Go Server Tool" .SH NAME x2goprint \- Process X2Go Print Job .SH SYNOPSIS 'nh .fi .ad l x2goprint <username> <session_id> <pdf_file> <title_file> .SH DESCRIPTION X2Go print jobs are rendered by the \fBcups-x2go\fR backend on your network's (central) CUPS server and then get copied to the X2Go server that the X2Go print job was issued from. .PP On that X2Go server \fBcups-x2go\fR places two print job files (a PDF file and a title file) into the home directory of the POSIX system user ,,x2goprint'' where they await further processing by \fBx2goprint\fR. .PP The \fBx2goprint\fR command on the session's X2Go server (executed by \fBcups-x2go\fR backend) then prepares the job files for delivery to the X2Go client-side. .PP \fBx2goprint\fR must run with root privileges and is executed by \fBcups-x2go\fR. .SH ARGUMENTS .TP \*(T<\fB\<username>\fR\*(T> The owner of the incoming print jobs is given as the <username> argument. .TP \*(T<\fB\<session_id>\fR\*(T> The <session_id> is the unique identifier of the X2Go session that the processed print job is coming from. .TP \*(T<\fB\<pdf_file>\fR\*(T> The filename of the PDF file as dropped into ~x2goprint by \fBcups-x2go\fR. .TP \*(T<\fB\<title_file>\fR\*(T> The filename of the title file as dropped into ~x2goprint by \fBcups-x2go\fR. .PP .SH PERMISSIONS X2Go uses the fuse-based SSH filesystem (SSHFS) for transferring print jobs from X2Go server to X2Go client. Users that shall use X2Go printing must be members of the X2Go server's ,,fuse'' POSIX group. .PP .SH X2GO CLUSTER MODE If X2Go server and CUPS server are the same machine, no further setup for X2Go printing is necessary. .PP However, if X2Go server and CUPS server are hosted on separate machines then a special setup of sudo and SSH is required on X2Go server(s) and the central CUPS server. .PP Refer to https://wiki.x2go.org/installing_x2go_printing_debian_ubuntu for further information. .PP .SH RETURN VALUES By \fBx2goprint\fR nothing is reported on stdout or stderr. .PP If \fBx2goprint\fR has run successfully, an exitcode of 0 is returned. If the script has either been called by a non-root user or with the wrong number of command line arguments, a non-zero exitcode is returned. .SH AUTHOR This manual has been written by Mike Gabriel <mike.gabriel@das-netzwerkteam.de> for the X2Go project (https://www.x2go.org). �����������������������������x2goserver-4.1.0.3/x2goserver-printing/README.md����������������������������������������������������0000644�0000000�0000000�00000000407�13377671145�016105� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# x2goserver-printing This folder contains the x2go printing service feature. * bin contains the script that lets you run the print job remotely at your client side. * man man page documentations * share contains the feature definition itself. ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-printing/share/x2gofeature.d/x2goserver-printing.features�������������0000755�0000000�0000000�00000002261�13377671145�026106� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2011-2018 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> # Copyright (C) 2011-2018 Heinz-Markus Graesing <heinz-m.graesing@obviously-nice.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" X2GO_FEATURE=$1 # check for X2Go server core features case "$X2GO_FEATURE" in "X2GO_PRINTING") echo "ok"; exit 0;; *) exit -1;; esac �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-printing/VERSION.x2goserver-printing����������������������������������0000644�0000000�0000000�00000000010�13377671145�021621� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������4.1.0.3 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver/README.md�������������������������������������������������������������0000644�0000000�0000000�00000002336�13377671145�014260� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# x2goserver core component ## x2goserver/bin This folder contains all the scripts to be used by the server in order to provide functionality to all the clients. The scripts itself are used for various different functions listed below: * x2gobasepath - _todo_ * x2gocmdexitmessage - _todo_ * x2gofeature - _todo_ * x2gofeaturelist - _todo_ * x2gogetapps - _todo_ * x2gogetservers - _todo_ * x2golistdesktops - _todo_ * x2golistmounts - _todo_ * x2golistsessions - _todo_ * x2gomountdirs - _todo_ * x2gopath - _todo_ * x2goresume-session - _todo_ * x2goruncommand - _todo_ * x2gosessionlimit - _todo_ * x2gosetkeyboard - _todo_ * x2goshowblocks - _todo_ * x2gostartagent - _todo_ * x2gosuspend-session - _todo_ * x2goterminate-session - _todo_ * x2goumount\_session -> x2goumount-session - _todo_ * x2goumount-session - _todo_ * x2goversion - _todo_ ## x2goserver/doc Documentation folder, contains only documentation. ## x2goserver/etc Default configurations for x2goserver and nxagent. ## x2goserver/lib perl scripts for usage by the server. ## x2goserver/man man page folder of this package. ## x2goserver/sbin x2goserver administrative scripts. contains x2gocleansessions, x2godbadmin as well as x2golistsessions ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver/sbin/x2gocleansessions������������������������������������������������0000755�0000000�0000000�00000033256�13377671145�017340� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> # Copyright (C) 2007-2018 Heinz-Markus Graesing <heinz-m.graesing@obviously-nice.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; $ENV{'PATH'} = "/bin:/sbin:/usr/bin:/usr/sbin"; use Sys::Hostname; use Sys::Syslog qw( :standard :macros ); use POSIX; use X2Go::Config qw( get_config ); use X2Go::Log qw( loglevel ); use X2Go::SupeReNicer qw( superenice ); use X2Go::Server::Agent qw( session_is_suspended session_is_running session_has_terminated ); use X2Go::Server::DB qw( dbsys_rmsessionsroot ); use X2Go::Utils qw( system_capture_stdout_output is_true ); my $x2go_lib_path = system_capture_stdout_output("x2gopath", "libexec"); use Getopt::Long; use Pod::Usage; Getopt::Long::Configure("gnu_getopt", "no_auto_abbrev"); my $debug = 0; my $help = 0; my $man = 0; GetOptions('debug|d' => \$debug, 'help|?|h' => \$help, 'man' => \$man) or pod2usage(2); pod2usage(1) if $help; pod2usage(-verbose => 2, -exitval => 0) if $man; openlog($0,'cons,pid','user'); if ($debug) { setlogmask( LOG_UPTO (LOG_DEBUG) ); } else { setlogmask( LOG_UPTO(loglevel()) ); } sub check_pid { my $pid=shift; my $sess=shift; my $sec=shift; if ($sec < 30) { return 1; } open (F,"</proc/$pid/cmdline") or return 0; my $text=<F>; close (F); if ($text =~ m/$sess/) { return 1; } return 0; } sub catch_term { unlink("/var/run/x2goserver.pid"); closelog; exit; } sub log_message { my $loglevel=shift; my $msg=shift; syslog($loglevel, $msg); if ($debug) { my $logtime = localtime (time ()); print "$logtime ::: $loglevel ::: $msg\n"; } } my $uname; my $serv = hostname; my $pid; if (! $debug) { $pid = fork(); } if ((!$debug) && (not defined $pid)) { print "resources not avilable.\n"; } elsif ($pid != 0) { open (F,">/var/run/x2goserver.pid"); print F "$pid\n"; close(F); closelog; } elsif ($pid == 0 ) { # check if we are to use the superenicer script for throttling does the nice level # of suspended sessions... my $Config = get_config(); my $superenice_enable = is_true($Config->param("superenicer.enable")); my $superenice_forceuser = is_true($Config->param("superenicer.force-user-renice")); my $superenice_normal=$Config->param("superenicer.normal-nice-level"); my $superenice_idle=$Config->param("superenicer.idle-nice-level"); my $superenice_ignoredusers=$Config->param("superenicer.ignored-users"); if ( ! $debug ) { # close any open file descriptor left open by our parent before the fork my $fd; for (glob "/proc/$$/fd/*") { if ( ! -e $_ ) { next; } if ($_ =~ m/\/proc\/\d+\/fd\/(\d+)/) { $fd = $1; if ( $fd < 3 ) { next; } if (! POSIX::close($fd)) { log_message('warning', "Error Closing $_: $!"); } } } # redirect stdin, stdout and stderr open *STDIN, q{<}, '/dev/null'; open *STDOUT, q{>>}, '/dev/null'; open *STDERR, q{>>}, '/dev/null'; } $SIG{TERM}=\&catch_term; $SIG{CHLD} = sub { wait }; my @remembered_finished_sessions = (); my %remembered_sessions_status = (); my %remembered_sessions_status_since_time = (); my %remembered_sessions_status_since_iterations = (); my $last_reniced = 0; my $user; my $effective_user; while(sleep 2) { my $outp=system_capture_stdout_output("$x2go_lib_path/x2golistsessions_sql", "$serv"); my @outp=split("\n","$outp"); # forget earlier remembered blocked sessions while ( my ($session, $remembered_since) = each(%remembered_sessions_status_since_time) ) { if (! join(',', @outp)=~m/$session/) { delete $remembered_sessions_status{$session}; delete $remembered_sessions_status_since_time{$session}; delete $remembered_sessions_status_since_iterations{$session}; } } push (@outp, @remembered_finished_sessions); for (my $i=0;$i<@outp;$i++) { my @sinfo=split('\\|',"@outp[$i]"); # Clean up invalid sessions (i.e., those for which no nxagent process is running anymore) # from the session database, if the status didn't change for more than 10 seconds. if ((!@sinfo[0]) && (defined ($remembered_sessions_status_since_time{@sinfo[1]})) && ((time () - $remembered_sessions_status_since_time{@sinfo[1]}) >= 10)) { dbsys_rmsessionsroot(@sinfo[1]); next; } # Update current status once per session. Avoids race conditions. my $current_status = system_capture_stdout_output ("$x2go_lib_path/x2gogetstatus", "@sinfo[1]"); if (length ($current_status)) { if (@sinfo[4] ne $current_status) { log_message ('debug', "@sinfo[1]: updating session status from '@sinfo[4]' to '$current_status'."); } @sinfo[4] = $current_status; } else { log_message ('debug', "@sinfo[1]: removed from database, not updating status."); } # Record the status of either previously unseen or status-changing sessions and the current time. if (!(defined ($remembered_sessions_status_since_time{@sinfo[1]})) || ($remembered_sessions_status{@sinfo[1]} !~ m/@sinfo[4]/)) { $remembered_sessions_status{@sinfo[1]} = @sinfo[4]; $remembered_sessions_status_since_time{@sinfo[1]} = time (); $remembered_sessions_status_since_iterations{@sinfo[1]} = 0; } else { # Current status matches previously seen status and a time is recorded. # Increment counter for this session. ++$remembered_sessions_status_since_iterations{$sinfo[1]}; } #print @sinfo[1], ': ', $remembered_sessions_status_since_time{@sinfo[1]},' (' , $remembered_sessions_status_since_iterations{@sinfo[1]} ,'iterations) ',$remembered_sessions_status{@sinfo[1]},"\n"; if (@sinfo[4] eq 'F') { if (!check_pid (@sinfo[0], @sinfo[1], 100)) { # No clean up necessary, as the agent is dead. # Removing sockets again would only lead to potentially # overwriting the socket another session claimed in-between. log_message ('debug', "@sinfo[1]: in failed state, but agent is gone, forgetting."); @remembered_finished_sessions = grep (!/\Q@sinfo[1]\E/, @remembered_finished_sessions); delete $remembered_sessions_status{@sinfo[1]}; delete $remembered_sessions_status_since_time{@sinfo[1]}; delete $remembered_sessions_status_since_iterations{@sinfo[1]}; next; } # Reaching this part means that nxagent is still executing. log_message ('debug', "@sinfo[1]: is blocked."); # Only add to finished list if it isn't in there already. if (!(grep { ((defined ($_)) && ($_ =~ m/\Q@sinfo[1]\E/)) } @remembered_finished_sessions)) { log_message ('debug', "@sinfo[1]: adding to finished list."); push (@remembered_finished_sessions, join ('|', @sinfo)); } # Kill the process if blocked for more than 20 seconds and nxagent is still up. if ((time () - $remembered_sessions_status_since_time{@sinfo[1]}) >= 20) { log_message ('debug', "@sinfo[1]: blocked for more than 20 seconds."); # send SIGKILL to dangling X-server processes log_message('warning', "@sinfo[1]: found stale X-server process (@sinfo[0]), sending SIGKILL"); system("kill", "-9", "@sinfo[0]"); # Remove all references to this sessions. We will never see it again. @remembered_finished_sessions = grep (!/\Q@sinfo[1]\E/, @remembered_finished_sessions); delete $remembered_sessions_status{@sinfo[1]}; delete $remembered_sessions_status_since_time{@sinfo[1]}; delete $remembered_sessions_status_since_iterations{@sinfo[1]}; my $display = @sinfo[2]; if (-S "/tmp/.X11-unix/X$display") { # remove the NX-X11 socket file (as the agent will not have managed after a kill -9) log_message('warning', "@sinfo[1], pid @sinfo[0]: cleaning up stale X11 socket file: /tmp/.X11-unix/X$display"); unlink("/tmp/.X11-unix/X$display"); } if (-e "/tmp/.X$display-lock") { # remove the NX-X11 lock file (as the agent will not have managed after a kill -9) log_message('warning', "@sinfo[1], pid @sinfo[0]: cleaning up stale X11 lock file: /tmp/.X$display-lock"); unlink("/tmp/.X$display-lock"); } log_message('debug', "@sinfo[1]: unmounting all shares"); system( "su", "@sinfo[11]", "-s", "/bin/sh", "-c", "x2goumount-session @sinfo[1]"); #remove port forwarding system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "$x2go_lib_path/x2gormforward @sinfo[1]"); } } elsif (! check_pid (@sinfo[0],@sinfo[1],@sinfo[12])) { $user = @sinfo[11]; # For shadow sessions we need to su to the user who provided the shared desktop (not the one who # requested the desktop sharing)... if ( @sinfo[1] =~ m/$user-[0-9]{2,}-[0-9]{10,}_stS(0|1)XSHAD.*XSHAD.*/ ) { $effective_user = @sinfo[1]; $effective_user =~ s/$user\-[0-9]{2,}\-[0-9]{10}_stS[0-1]XSHAD(.*)XSHAD.*/$1/; $user = $effective_user; } log_message('debug', "@sinfo[1], pid @sinfo[0]: does not exist, changing status from @sinfo[4] to F"); system("su", "$user", "-s", "/bin/sh", "-c", "$x2go_lib_path/x2gochangestatus 'F' @sinfo[1]"); my $display = @sinfo[2]; if (-S "/tmp/.X11-unix/X$display") { # remove the NX-X11 socket file (we don't know how the agent disappeared, # someone might have shot it with kill -9) log_message('warning', "@sinfo[1], pid @sinfo[0]: cleaning up stale X11 socket file: /tmp/.X11-unix/X$display"); unlink("/tmp/.X11-unix/X$display"); } if (-e "/tmp/.X$display-lock") { # remove the NX-X11 lock file (we don't know how the agent disappeared, # someone might have shot it with kill -9) log_message('warning', "@sinfo[1], pid @sinfo[0]: cleaning up stale X11 lock file: /tmp/.X$display-lock"); unlink("/tmp/.X$display-lock"); } log_message('debug', "@sinfo[1]: unmounting all shares"); system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "x2goumount-session @sinfo[1]"); } else { if (@sinfo[4] eq 'R') { if (session_is_suspended(@sinfo[1],@sinfo[11])) { system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "$x2go_lib_path/x2gochangestatus S @sinfo[1]"); log_message('debug', "@sinfo[1]: is suspended, changing status from @sinfo[4] to S"); log_message('debug', "@sinfo[1]: unmounting all shares"); system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "x2goumount-session @sinfo[1]"); #remove port forwarding system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "$x2go_lib_path/x2gormforward @sinfo[1]"); } } if (@sinfo[4] eq 'S') { if (session_is_running(@sinfo[1],@sinfo[11])) { # Give the session a grace period of one iteration. # If it didn't change into suspended state by then, suspend it "forcefully". if ($remembered_sessions_status_since_iterations{@sinfo[1]} == 1) { log_message('debug', "@sinfo[1]: unmounting all shares"); system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "x2goumount-session @sinfo[1]"); system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "x2gosuspend-session @sinfo[1]"); log_message('debug', "@sinfo[1]: was found running and has now been suspended"); } elsif ($remembered_sessions_status_since_iterations{@sinfo[1]} == 2) { # Issue a diagnostic warning in case suspension was already tried, but failed to # actually change the status for some reason. log_message('warning', "@sinfo[1]: session status @sinfo[4] desynchronized with current status (R) and session suspend already tried unsuccessfully"); } } } if (@sinfo[4] eq 'T') { if (!session_has_terminated(@sinfo[1],@sinfo[11])) { log_message('debug', "@sinfo[1]: unmounting all shares"); system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "x2goumount-session @sinfo[1]"); system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "x2goterminate-session @sinfo[1]"); log_message('debug', "@sinfo[1]: termination has been requested via the session DB"); #remove port forwarding system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "$x2go_lib_path/x2gormforward @sinfo[1]"); } } } } # call superenicer script if requested through x2goserver.conf every six seconds if ( $superenice_enable ) { $last_reniced += 2; if ( $last_reniced ge 4 ) { superenice($superenice_normal, $superenice_idle, $superenice_ignoredusers, $superenice_forceuser); $last_reniced = 0; } } } } __END__ =head1 NAME x2gocleansessions - X2Go Server Cleanup Daemon =head1 SYNOPSIS x2gocleansessions [options] Options: --help|-h|-? brief help message --man full documentation --debug|-d enable debugging and don't daemonize =head1 OPTIONS =over 8 =item B<--help>|B<-?>|B<-h> Print a brief help message and exits. =item B<--man> Prints the manual page and exits. =item B<--debug>|B<-d> Override debugging setting in global config and keep application in foreground instead of daemonizing. =back =head1 DESCRIPTION B<x2gocleansessions> is run as a service on X2Go servers to handle the cleanup of stale sessions. B<x2gocleansessions> must be run (as a service) with root privileges. =head1 AUTHOR This manual has been written by Mike Gabriel <mike.gabriel@das-netzwerkteam.de> for the X2Go project (https://www.x2go.org). =cut ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver/sbin/x2godbadmin������������������������������������������������������0000755�0000000�0000000�00000122172�13377671145�016061� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> # Copyright (C) 2007-2018 Heinz-Markus Graesing <heinz-m.graesing@obviously-nice.de> # Copyright (C) 2017-2018 Walid Moghrabi <w.moghrabi@servicemagic.eu> # Copyright (C) 2018 Mihai Moldovan <ionic@ionic.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use File::Path; use Getopt::Long; use DBI; use Try::Tiny; use X2Go::Config qw( get_sqlconfig ); use X2Go::Log qw( loglevel ); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); sub show_usage() { print "X2Go SQL admin interface. Use it to create x2go database and insert or remove users or groups in x2go database\n". "Usage:\nx2godbadmin --createdb\n". "x2godbadmin --updatedb\n". "x2godbadmin --listusers\n". "x2godbadmin --adduser|rmuser <UNIX user>\n". "x2godbadmin --addgroup|rmgroup <UNIX group>\n"; } my $help=''; my $createdb=''; my $updatedb=''; my $adduser=''; my $rmuser=''; my $addgroup=''; my $rmgroup=''; my $listusers=''; GetOptions('listusers' => \$listusers, 'createdb' => \$createdb, 'updatedb' => \$updatedb, 'help' => \$help, 'adduser=s' => \$adduser, 'addgroup=s' => \$addgroup, 'rmuser=s' => \$rmuser, 'rmgroup=s' => \$rmgroup); if ($help || ! ( $createdb || $updatedb || $adduser || $rmuser || $addgroup || $rmgroup || $listusers)) { show_usage(); exit(0); } my $Config = get_sqlconfig(); if ($Config->param("backend") eq 'sqlite') { my $user="x2gouser"; my ($name, $pass, $uid, $pgid, $quota, $comment, $gcos, $dir, $shell, $expire) = getpwnam($user) or die ("Can not find user ($user)\n"); my $dbfile="$dir/x2go_sessions"; if ($listusers|| $adduser||$addgroup||$rmuser||$rmgroup) { print "Only \"--createdb\" and \"--updatedb\" options are available with SQLite3 backend\n"; exit(0); } if ($updatedb) { if ( ! -e $dbfile) { $createdb = 1; } else { # Update the session DB file my $dbh=DBI->connect("dbi:SQLite:dbname=$dbfile","","",{AutoCommit => 1, PrintError => 0, PrintWarn => 1, RaiseError => 1 }) or die $_; my $coltest; my $sth; # Update missing column on sessions table: tekictrl_port try { $dbh->prepare(" select tekictrl_port from sessions "); } catch { print "ADDING: tekictrl_port column to table sessions\n"; $sth=$dbh->prepare("alter table sessions add column 'tekictrl_port' int"); $sth->execute(); $sth->finish(); }; # Update missing column on sessions table: tekidata_port try { $dbh->prepare("select tekidata_port from sessions"); } catch { print "ADDING: tekidata_port column to table sessions\n"; $sth=$dbh->prepare("alter table sessions add column 'tekidata_port' int"); $sth->execute(); $sth->finish(); }; exit(0); } } if ($createdb) { if (! -d "$dir" ) { if ( defined (&File::Path::make_path) ) { File::Path::make_path("$dir"); } elsif ( defined (&File::Path::mkpath) ) { File::Path::mkpath("$dir"); } else { die "Unable to create folders with File::Path"; } } if ( -e $dbfile) { unlink($dbfile); } my $dbh=DBI->connect("dbi:SQLite:dbname=$dbfile","","",{AutoCommit => 1}) or die $_; my $sth=$dbh->prepare(" create table sessions( session_id varchar(500) primary key, display integer not null, uname varchar(100) not null, server varchar(100) not null, client inet, status char(1) not null default 'R', init_time timestamp not null default CURRENT_TIMESTAMP, last_time timestamp not null default CURRENT_TIMESTAMP, cookie char(33), agent_pid int, gr_port int, sound_port int, fs_port int, tekictrl_port int, tekidata_port int, unique(display)) "); $sth->execute() or die; $sth->finish(); my $sth=$dbh->prepare("create table messages(mess_id varchar(20) primary key, message text)"); $sth->execute() or die; $sth->finish(); my $sth=$dbh->prepare(" create table user_messages( mess_id varchar(20) not null, uname varchar(100) not null) "); $sth->execute() or die; $sth->finish(); my $sth=$dbh->prepare(" create table used_ports( server varchar(100) not null, session_id varchar(500) references sessions on delete cascade, port integer primary key) "); $sth->execute() or die; $sth->finish(); my $sth=$dbh->prepare(" create table mounts( session_id varchar(500) references sessions on delete restrict, path varchar(512) not null, client inet not null, primary key(path,client)) "); $sth->execute() or die; $sth->finish(); my $sth=$dbh->prepare(" CREATE TRIGGER fkd_mounts_session_id BEFORE DELETE ON sessions FOR EACH ROW BEGIN SELECT CASE WHEN ((SELECT session_id FROM mounts WHERE session_id = OLD.session_id) IS NOT NULL) THEN RAISE(ABORT, 'delete on table \"sessions\" violates foreign key on table \"mounts\"') END; END; "); $sth->execute() or die; $sth->finish(); my $sth=$dbh->prepare(" CREATE TRIGGER fkd_ports_session_id BEFORE DELETE ON sessions FOR EACH ROW BEGIN DELETE FROM used_ports WHERE session_id = OLD.session_id; END; END; "); $sth->execute() or die; $sth->finish(); # undef $dbh should be preferred to $dbh->disconnect(), see # https://www.perlmonks.org/?node_id=665714 undef $dbh; chmod(0770, "$dir"); chown('root',$pgid,"$dir"); chmod(0660, "$dbfile"); chown('root',$pgid,"$dbfile"); exit(0); } } if ($Config->param("backend") eq 'postgres') { my $host=$Config->param("postgres.host"); my $port=$Config->param("postgres.port"); my $sslmode=$Config->param("postgres.ssl"); if (!$sslmode) { $sslmode="prefer"; } my $dbadmin=$Config->param("postgres.dbadmin"); my $x2goadmin="x2godbuser"; my $x2goadminpass=`pwgen -s -c -n 32 1`; chomp ($x2goadminpass); my $db="x2go_sessions"; if (!$host) { $host='localhost'; } if (!$port) { $port='5432'; } if (!$dbadmin) { $dbadmin='postgres'; } open (FL,"< /etc/x2go/x2gosql/passwords/pgadmin") or die "Can't read password file /etc/x2go/x2gosql/passwords/pgadmin"; my $dbadminpass=<FL>; close(FL); chomp($dbadminpass); if ($updatedb) { # check if the DB already exists, if not, create it... my $dbh; until ( $dbh = DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass",{AutoCommit => 1, RaiseError => 0, PrintError => 0}) ) { $createdb = 1; last; }; if (!$createdb) { $dbh = DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass",{AutoCommit => 1}); if ($dbh) { my $update_views_n_rules = 0; my $sth_tekictrl; my $sth_tekidata; my $sth_update; try { $sth_tekictrl = $dbh->prepare("select tekictrl_port from sessions"); $sth_tekictrl->execute(); } catch { print "ADDING: tekictrl_port column to table sessions\n"; $sth_tekictrl = $dbh->prepare(" alter table sessions add column tekictrl_port int "); $sth_tekictrl->execute() or die; $sth_tekictrl->finish(); $update_views_n_rules = 1; }; try { $sth_tekidata = $dbh->prepare("select tekidata_port from sessions"); $sth_tekidata->execute(); } catch { print "ADDING: tekidata_port column to table sessions\n"; $sth_tekidata=$dbh->prepare(" alter table sessions add column tekidata_port int "); $sth_tekidata->execute() or die; $sth_tekidata->finish(); $update_views_n_rules = 1; }; if ($update_views_n_rules) { print "UPDATING VIEW: sessions_view\n"; $sth_update=$dbh->prepare(" create or replace VIEW sessions_view as SELECT agent_pid, session_id, display, server, status, init_time, cookie, client, gr_port, sound_port, last_time, uname, fs_port, tekictrl_port, tekidata_port from sessions where creator_id = current_user "); $sth_update->execute() or die; print "UPDATING RULE: update_sess_view\n"; $sth_update=$dbh->prepare(" create or replace RULE update_sess_view AS ON UPDATE TO sessions_view DO INSTEAD update sessions set status=NEW.status, last_time=NEW.last_time, cookie=NEW.cookie, agent_pid=NEW.agent_pid, client=NEW.client, gr_port=NEW.gr_port, sound_port=NEW.sound_port, fs_port=NEW.fs_port, tekictrl_port=NEW.tekictrl_port, tekidata_port=NEW.tekidata_port where session_id=OLD.session_id and creator_id=current_user "); $sth_update->execute() or die; $sth_update->finish(); } } if ($dbh) { undef $dbh; } exit(0); } else { print "No session DB found. Use --createdb instead of --updatedb.\n"; } } if ($createdb) { create_database($host, $port, $dbadmin, $dbadminpass, $db, $x2goadmin, $x2goadminpass, $sslmode); create_tables($host, $port, $dbadmin, $dbadminpass, $db, $x2goadmin, $sslmode); exit(0); } if ($listusers) { list_users($host, $port, $dbadmin, $dbadminpass, $sslmode); exit(0); } if ($adduser) { add_user($host, $port, $dbadmin, $dbadminpass, $db, $adduser, $sslmode); } if ($addgroup) { my ($name, $passwd, $gid, $members) = getgrnam( $addgroup); my @grp_members=split(' ',$members); foreach (@grp_members) { chomp($_); add_user($host, $port, $dbadmin, $dbadminpass, $db, $_, $sslmode); } } if ($rmuser) { rm_user($host, $port, $dbadmin, $dbadminpass, $db, $rmuser, $sslmode); } if ($rmgroup) { my ($name, $passwd, $gid, $members) = getgrnam( $rmgroup); my @grp_members=split(' ',$members); foreach (@grp_members) { chomp($_); rm_user($host, $port, $dbadmin, $dbadminpass, $db, $_, $sslmode); } } } if ($Config->param("backend") eq 'mysql') { die "Backend currently not implemented!"; my $host=$Config->param("mysql.host"); my $port=$Config->param("mysql.port"); my $unet=$Config->param("mysql.unet"); my $dbadmin=$Config->param("mysql.dbadmin"); my $x2goadmin="x2godbuser"; my $x2goadminpass=`pwgen 8 1`; chomp ($x2goadminpass); my $db="x2go_sessions"; if (!$host) { $host='localhost'; } if (!$port) { $port='3306'; } if (!$dbadmin) { $dbadmin='root'; } open (FL,"< /etc/x2go/x2gosql/passwords/mysqladmin") or die "Can't read password file /etc/x2go/x2gosql/passwords/mysqladmin"; my $dbadminpass=<FL>; close(FL); chomp($dbadminpass); if ($updatedb) { # check if the DB already exists, if not, create it... my $dbh; until ( $dbh = DBI->connect("dbi:mysql:database=$db;host=$host;port=$port", "$dbadmin", "$dbadminpass", {AutoCommit => 1, RaiseError => 0, PrintError => 0}) ) { $createdb = 1; last; }; if (!$createdb) { $dbh = DBI->connect("dbi:mysql:database=$db;host=$host;port=$port", "$dbadmin", "$dbadminpass", {AutoCommit => 1}); if ($dbh) { # Intentionally left blank. # MySQL support was only added in X2Go Server 4.1.0.x, while SQLite and PostgreSQL support # have been around prior to 4.1.0.0, which is the first version that introduced new teki-related # columns. } if ($dbh) { undef $dbh; } exit(0); } else { print "No session DB found. Use --createdb instead of --updatedb.\n"; } } if ($createdb) { create_database($host, $port, $dbadmin, $dbadminpass, $db, $x2goadmin, $x2goadminpass, $unet); create_tables($host, $port, $dbadmin, $dbadminpass, $db, $x2goadmin, $unet); exit(0); } if ($listusers) { list_users($host, $port, $dbadmin, $dbadminpass); exit(0); } if ($adduser) { add_user($host, $port, $dbadmin, $dbadminpass, $db, $adduser, $unet); } if ($addgroup) { my ($name, $passwd, $gid, $members) = getgrnam($addgroup); my @grp_members=split(' ',$members); foreach (@grp_members) { chomp($_); add_user($host, $port, $dbadmin, $dbadminpass, $db, $_, $unet); } } if ($rmuser) { rm_user($host, $port, $dbadmin, $dbadminpass, $db, $rmuser, $unet); } if ($rmgroup) { my ($name, $passwd, $gid, $members) = getgrnam($rmgroup); my @grp_members=split(' ',$members); foreach (@grp_members) { chomp($_); rm_user($host, $port, $dbadmin, $dbadminpass, $db, $_, $unet); } } } sub create_tables { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $db = shift or die "No db parameter supplied"; my $x2goadmin = shift or die "No x2goadmin (user-level database username) parameter supplied"; my $sslmode = undef; my $unet = undef; if ($Config->param("backend") eq 'postgres') { $sslmode = shift or die "No sslmode parameter supplied"; pg_create_tables($host, $port, $dbadmin, $dbadminpass, $db, $x2goadmin, $sslmode); } elsif ($Config->param("backend") eq 'mysql') { $unet = shift or die "No unet parameter supplied"; mysql_create_tables($host, $port, $dbadmin, $dbadminpass, $db, $x2goadmin, $unet); } else { die "Invalid database backend"; } } sub pg_create_tables { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $db = shift or die "No db parameter supplied"; my $x2goadmin = shift or die "No x2goadmin (user-level database username) parameter supplied"; my $sslmode = shift or die "No sslmode parameter supplied"; my $dbh = DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass", {AutoCommit => 1}) or die $_; my $sth=$dbh->prepare(" create table sessions( session_id text primary key, display integer not null, uname text not null, server text not null, client inet, status char(1) not null default 'R', init_time timestamp not null default now(), last_time timestamp not null default now(), cookie char(33), agent_pid int, gr_port int, sound_port int, fs_port int, tekictrl_port int, tekidata_port int, creator_id text NOT NULL default current_user, unique(display)) "); $sth->execute() or die; $sth=$dbh->prepare(" create VIEW sessions_view as SELECT agent_pid, session_id, display, server, status, init_time, cookie, client, gr_port, sound_port, last_time, uname, fs_port, tekictrl_port, tekidata_port from sessions where creator_id = current_user "); $sth->execute() or die; $sth=$dbh->prepare(" create VIEW servers_view as SELECT server, display, status from sessions "); $sth->execute() or die; $sth=$dbh->prepare(" create or replace RULE update_sess_priv AS ON UPDATE TO sessions where (OLD.creator_id <> current_user or OLD.creator_id <> NEW.creator_id) and current_user <> '$x2goadmin' DO INSTEAD NOTHING "); $sth->execute() or die; $sth=$dbh->prepare(" create or replace RULE insert_sess_priv AS ON INSERT TO sessions where NEW.creator_id <> current_user and current_user <> '$x2goadmin' DO INSTEAD NOTHING "); $sth->execute() or die; $sth=$dbh->prepare(" create or replace RULE delete_sess_priv AS ON DELETE TO sessions where OLD.creator_id <> current_user and current_user <> '$x2goadmin' DO INSTEAD NOTHING "); $sth->execute() or die; $sth=$dbh->prepare(" create or replace RULE update_sess_view AS ON UPDATE TO sessions_view DO INSTEAD update sessions set status=NEW.status, last_time=NEW.last_time, cookie=NEW.cookie, agent_pid=NEW.agent_pid, client=NEW.client, gr_port=NEW.gr_port, sound_port=NEW.sound_port, fs_port=NEW.fs_port, tekictrl_port=NEW.tekictrl_port, tekidata_port=NEW.tekidata_port where session_id=OLD.session_id and creator_id=current_user "); $sth->execute() or die; $sth=$dbh->prepare("create table messages(mess_id varchar(20) primary key, message text)"); $sth->execute() or die; $sth=$dbh->prepare(" create table user_messages( mess_id text not null, uname text not null) "); $sth->execute() or die; $sth=$dbh->prepare(" create table used_ports( server text not null, session_id text references sessions on delete cascade, creator_id text NOT NULL default current_user, port integer primary key) "); $sth->execute() or die; $sth=$dbh->prepare(" create VIEW ports_view as SELECT server, port from used_ports "); $sth->execute() or die; $sth=$dbh->prepare(" create or replace RULE insert_port_priv AS ON INSERT TO used_ports where NEW.creator_id <> current_user and current_user <> '$x2goadmin' DO INSTEAD NOTHING "); $sth->execute() or die; $sth=$dbh->prepare(" create or replace RULE update_port_priv AS ON UPDATE TO used_ports where (NEW.creator_id <> current_user or OLD.creator_id <> current_user) and current_user <> '$x2goadmin' DO INSTEAD NOTHING "); $sth->execute() or die; $sth=$dbh->prepare(" create or replace RULE delete_port_priv AS ON DELETE TO used_ports where OLD.creator_id <> current_user and current_user <> '$x2goadmin' DO INSTEAD NOTHING "); $sth->execute() or die; $sth=$dbh->prepare(" create table mounts( session_id text references sessions on delete restrict, path text not null, client inet not null, creator_id text NOT NULL default current_user, primary key(path,client)) "); $sth->execute() or die; $sth=$dbh->prepare(" create VIEW mounts_view as SELECT client,path, session_id from mounts where creator_id = current_user "); $sth->execute() or die; $sth=$dbh->prepare(" create or replace RULE delete_mounts_view AS ON DELETE TO mounts_view DO INSTEAD delete from mounts where session_id=OLD.session_id and creator_id=current_user and path=OLD.path "); $sth->execute() or die; $sth=$dbh->prepare(" create or replace RULE insert_mount_priv AS ON INSERT TO mounts where NEW.creator_id <> current_user and current_user <> '$x2goadmin' DO INSTEAD NOTHING "); $sth->execute() or die; $sth=$dbh->prepare(" create or replace RULE update_mount_priv AS ON UPDATE TO mounts where (NEW.creator_id <> current_user or OLD.creator_id <> current_user) and current_user <> '$x2goadmin' DO INSTEAD NOTHING "); $sth->execute() or die; $sth=$dbh->prepare(" create or replace RULE delete_mount_priv AS ON DELETE TO mounts where OLD.creator_id <> current_user and current_user <> '$x2goadmin' DO INSTEAD NOTHING "); $sth->execute() or die; $sth=$dbh->prepare("GRANT ALL PRIVILEGES ON sessions, messages, user_messages, used_ports, mounts TO $x2goadmin"); $sth->execute() or die; $sth->finish(); undef $dbh; } sub mysql_create_tables { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $db = shift or die "No db parameter supplied"; my $x2goadmin = shift or die "No x2goadmin (user-level database username) parameter supplied"; my $unet = shift or die "No unet parameter supplied"; my $dbh = DBI->connect("dbi:mysql:database=$db;host=$host;port=$port", "$dbadmin", "$dbadminpass", {AutoCommit => 1}) or die $_; my $sth=$dbh->prepare(" CREATE TABLE `sessions` ( `session_id` varchar(2048) NOT NULL, `display` int NOT NULL, `uname` varchar(100) NOT NULL, `server` varchar(512) NOT NULL, `client` varchar(45) DEFAULT NULL, `status` char(1) NOT NULL DEFAULT 'R', `init_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `last_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `cookie` char(33) DEFAULT NULL, `agent_pid` int DEFAULT NULL, `gr_port` int DEFAULT NULL, `sound_port` int DEFAULT NULL, `fs_port` int DEFAULT NULL, `tekictrl_port` int DEFAULT NULL, `tekidata_port` int DEFAULT NULL, PRIMARY KEY (`session_id`), UNIQUE KEY `idx_sessions_display_server` (`display`,`server`)) "); $sth->execute() or die; $sth=$dbh->prepare(" CREATE TABLE `messages` ( `mess_id` varchar(20) NOT NULL, `mesage` longtext, PRIMARY KEY (`mess_id`)) "); $sth->execute() or die; $sth=$dbh->prepare(" CREATE TABLE `user_messages` ( `mess_id` varchar(20) NOT NULL, `uname` varchar(100) NOT NULL, PRIMARY KEY (`mess_id`)) "); $sth->execute() or die; $sth=$dbh->prepare(" CREATE TABLE `used_ports` ( `server` varchar(512) NOT NULL, `session_id` varchar(2048) DEFAULT NULL, `port` int NOT NULL, PRIMARY KEY (`port`), KEY `used_ports_session_id_fkey_idx` (`session_id`), CONSTRAINT `used_ports_session_id_fkey` FOREIGN KEY (`session_id`) REFERENCES `sessions` (`session_id`) ON DELETE CASCADE ON UPDATE NO ACTION) "); $sth->execute() or die; $sth=$dbh->prepare(" CREATE TABLE `mounts` ( `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, `session_id` varchar(2048) DEFAULT NULL, `path` varchar(2048) NOT NULL, `client` varchar(45) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `mounts_pkey` (`path`,`client`), KEY `mounts_session_id_fkey_idx` (`session_id`), CONSTRAINT `mounts_session_id_fkey` FOREIGN KEY (`session_id`) REFERENCES `sessions` (`session_id`) ON DELETE RESTRICT ON UPDATE NO ACTION) "); $sth->execute() or die; $sth=$dbh->prepare("GRANT ALL PRIVILEGES ON `sessions`, `messages`, `user_messages`, `used_ports`, `mounts` TO `$x2goadmin`@`$unet`"); $sth->execute() or die; $sth->finish(); undef $dbh; } sub create_database { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $db = shift or die "No db parameter supplied"; my $x2goadmin = shift or die "No x2goadmin (user-level database username) parameter supplied"; my $x2goadminpass = shift or die "No x2goadminpass (user-level database pasword) parameter supplied"; my $sslmode = undef; my $unet = undef; if ($Config->param("backend") eq 'postgres') { $sslmode = shift or die "No sslmode parameter supplied"; pg_create_database($host, $port, $dbadmin, $dbadminpass, $db, $x2goadmin, $x2goadminpass, $sslmode); } elsif ($Config->param("backend") eq 'mysql') { $unet = shift or die "No unet parameter supplied"; mysql_create_database($host, $port, $dbadmin, $dbadminpass, $db, $x2goadmin, $x2goadminpass, $unet); } else { die "Invalid database backend"; } } sub pg_create_database { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $db = shift or die "No db parameter supplied"; my $x2goadmin = shift or die "No x2goadmin (user-level database username) parameter supplied"; my $x2goadminpass = shift or die "No x2goadminpass (user-level database pasword) parameter supplied"; my $sslmode = shift or die "No sslmode parameter supplied"; my $dbh=DBI->connect("dbi:Pg:dbname=postgres;host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass", {AutoCommit => 1}) or die $_; #drop db if exists my $sth=$dbh->prepare("drop database if exists $db"); $sth->execute(); #drop x2goadmin $sth=$dbh->prepare("drop user if exists $x2goadmin"); $sth->execute(); #create db $sth=$dbh->prepare("create database $db"); $sth->execute() or die; #create x2goadmin $sth=$dbh->prepare("create USER $x2goadmin WITH ENCRYPTED PASSWORD '$x2goadminpass'"); $sth->execute() or die; #save x2goadmin password open (FL,"> /etc/x2go/x2gosql/passwords/x2gopgadmin") or die "Can't write password file /etc/x2go/x2gosql/passwords/x2gopgadmin"; print FL $x2goadminpass; close(FL); $sth->finish(); undef $dbh; } sub mysql_create_database { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $db = shift or die "No db parameter supplied"; my $x2goadmin = shift or die "No x2goadmin (user-level database username) parameter supplied"; my $x2goadminpass = shift or die "No x2goadminpass (user-level database pasword) parameter supplied"; my $unet = shift or die "No unet parameter supplied"; my $dbh=DBI->connect("dbi:mysql:database=mysql;host=$host;port=$port", "$dbadmin", "$dbadminpass", {AutoCommit => 1}) or die $_; #drop db if exists my $sth=$dbh->prepare("DROP DATABASE IF EXISTS `$db`"); $sth->execute(); #drop x2goadmin $sth=$dbh->prepare("DROP USER IF EXISTS `$x2goadmin`@`$unet`"); $sth->execute(); #create db $sth=$dbh->prepare("CREATE DATABASE IF NOT EXISTS `$db`"); $sth->execute() or die; #create x2goadmin $sth=$dbh->prepare("CREATE USER `$x2goadmin`@`$unet` IDENTIFIED BY '$x2goadminpass'"); $sth->execute() or die; #save x2goadmin password open (FL,"> /etc/x2go/x2gosql/passwords/x2gomysqladmin") or die "Can't write password file /etc/x2go/x2gosql/passwords/x2gomysqladmin"; print FL $x2goadminpass; close(FL); $sth->finish(); undef $dbh; } sub list_users { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $sslmode = undef; if ($Config->param("backend") eq 'postgres') { $sslmode = shift or die "No sslmode parameter supplied"; pg_list_users($host, $port, $dbadmin, $dbadminpass, $sslmode); } elsif ($Config->param("backend") eq 'mysql') { mysql_list_users($host, $port, $dbadmin, $dbadminpass); } else { die "Invalid database backend"; } } sub pg_list_users { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $sslmode = shift or die "No sslmode parameter supplied"; my $dbh=DBI->connect("dbi:Pg:dbname=postgres;host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass", {AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("select rolname from pg_roles where rolname like 'x2gouser_%'"); $sth->execute()or die; printf ("%-20s DB user\n","UNIX user"); print "---------------------------------------\n"; my @data; while (@data = $sth->fetchrow_array) { @data[0]=~s/x2gouser_//; printf ("%-20s x2gouser_@data[0]\n",@data[0]); } $sth->finish(); undef $dbh; } sub mysql_list_users { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $dbh=DBI->connect("dbi:mysql:host=$host;port=$port", "$dbadmin", "$dbadminpass", {AutoCommit => 1}) or die $_; my $sth=$dbh->prepare("select user from mysql.user where user like 'x2gouser_%'"); $sth->execute()or die; printf ("%-20s DB user\n","UNIX user"); print "---------------------------------------\n"; my @data; while (@data = $sth->fetchrow_array) { @data[0]=~s/x2gouser_//; printf ("%-20s x2gouser_@data[0]\n",@data[0]); } $sth->finish(); undef $dbh; } sub add_user { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $db = shift or die "No db parameter supplied"; my $user_to_add = shift or die "No user-to-add parameter supplied"; my $sslmode = undef; my $unet = undef; if ($Config->param("backend") eq 'postgres') { $sslmode = shift or die "No sslmode parameter supplied"; pg_add_user($host, $port, $dbadmin, $dbadminpass, $db, $user_to_add, $sslmode); } elsif ($Config->param("backend") eq 'mysql') { $unet = shift or die "No unet parameter supplied"; mysql_add_user($host, $port, $dbadmin, $dbadminpass, $db, $user_to_add, $unet); } else { die "Invalid database backend"; } } sub pg_add_user { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $db = shift or die "No db parameter supplied"; my $user_to_add = shift or die "No user-to-add parameter supplied"; my $sslmode = shift or die "No sslmode parameter supplied"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass", {AutoCommit => 1}) or die $_; my ($name, $pass, $uid, $pgid, $quota, $comment, $gcos, $dir, $shell, $expire) = getpwnam($user_to_add); if (! $name) { print "Cannot find user ($user_to_add)\n"; return; } elsif ($name eq "root") { print "The super-user \"root\" is not allowed to use X2Go\n"; return; } $pass=`pwgen -s -c -n 32 1`; chomp($pass); my $sth=$dbh->prepare("REVOKE ALL PRIVILEGES ON sessions, used_ports, mounts FROM \"x2gouser_$user_to_add\""); $sth->{Warn}=0; $sth->{PrintError}=0; $sth->execute(); my $sth=$dbh->prepare("REVOKE ALL PRIVILEGES ON sessions_view, mounts_view, servers_view, ports_view FROM \"x2gouser_$user_to_add\""); $sth->{Warn}=0; $sth->{PrintError}=0; $sth->execute(); my $sth=$dbh->prepare("DROP OWNED BY \"x2gouser_$user_to_add\""); $sth->{Warn}=0; $sth->{PrintError}=0; $sth->execute(); $sth=$dbh->prepare("drop USER if exists \"x2gouser_$user_to_add\""); $sth->{Warn}=0; $sth->{PrintError}=0; $sth->execute(); print ("create DB user \"x2gouser_$user_to_add\"\n"); $sth=$dbh->prepare("create USER \"x2gouser_$user_to_add\" WITH ENCRYPTED PASSWORD '$pass'"); $sth->execute(); $sth=$dbh->prepare("GRANT INSERT, UPDATE, DELETE ON sessions, used_ports, mounts TO \"x2gouser_$user_to_add\""); $sth->execute(); $sth=$dbh->prepare("GRANT SELECT ON used_ports TO \"x2gouser_$user_to_add\""); $sth->execute(); $sth=$dbh->prepare("GRANT SELECT, UPDATE, DELETE ON sessions_view, mounts_view, servers_view, ports_view TO \"x2gouser_$user_to_add\""); $sth->execute(); $sth->finish(); if (! -d "$dir/.x2go" ) { if ( defined (&File::Path::make_path) ) { File::Path::make_path("$dir/.x2go"); } elsif ( defined (&File::Path::mkpath) ) { File::Path::mkpath("$dir/.x2go"); } else { die "Unable to create folders with File::Path"; } } #save user password open (FL,"> $dir/.x2go/pgsqlpass") or die "Can't open password file $dir/.x2go/pgsqlpass"; print FL $pass; close(FL); chmod(0700,"$dir/.x2go"); chown($uid,$pgid,"$dir/.x2go"); chmod(0600,"$dir/.x2go/pgsqlpass"); chown($uid,$pgid,"$dir/.x2go/pgsqlpass"); } sub mysql_add_user { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $db = shift or die "No db parameter supplied"; my $user_to_add = shift or die "No user-to-add parameter supplied"; my $unet = shift or die "No unet parameter supplied"; my $dbh=DBI->connect("dbi:mysql:database=$db;host=$host;port=$port", "$dbadmin", "$dbadminpass", {AutoCommit => 1}) or die $_; my ($name, $pass, $uid, $pgid, $quota, $comment, $gcos, $dir, $shell, $expire) = getpwnam($user_to_add); if (! $name) { print "Cannot find user ($user_to_add)\n"; return; } elsif ($name eq "root") { print "The super-user \"root\" is not allowed to use X2Go\n"; return; } $pass=`pwgen -s -c -n 32 1`; chomp($pass); my $sth=$dbh->prepare("DROP USER IF EXISTS `x2gouser_$user_to_add`@`$unet`"); $sth->{Warn}=0; $sth->{PrintError}=0; $sth->execute(); print ("create DB user \"x2gouser_$user_to_add\"\n"); $sth=$dbh->prepare("CREATE USER `x2gouser_$user_to_add`@`$unet` IDENTIFIED BY '$pass'"); $sth->execute(); $sth=$dbh->prepare("GRANT SELECT, INSERT, UPDATE, DELETE ON * TO `x2gouser_$user_to_add`@`$unet`"); $sth->execute(); $sth->finish(); if (! -d "$dir/.x2go" ) { if ( defined (&File::Path::make_path) ) { File::Path::make_path("$dir/.x2go"); } elsif ( defined (&File::Path::mkpath) ) { File::Path::mkpath("$dir/.x2go"); } else { die "Unable to create folders with File::Path"; } } #save user password open (FL,"> $dir/.x2go/mysqlpass") or die "Can't open password file $dir/.x2go/mysqlpass"; print FL $pass; close(FL); chmod(0700,"$dir/.x2go"); chown($uid,$pgid,"$dir/.x2go"); chmod(0600,"$dir/.x2go/mysqlpass"); chown($uid,$pgid,"$dir/.x2go/mysqlpass"); } sub rm_user { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $db = shift or die "No db parameter supplied"; my $user_to_remove = shift or die "No user-to-remove parameter supplied"; my $sslmode = undef; my $unet = undef; if ($Config->param("backend") eq 'postgres') { $sslmode = shift or die "No sslmode parameter supplied"; pg_rm_user($host, $port, $dbadmin, $dbadminpass, $db, $user_to_remove, $sslmode); } elsif ($Config->param("backend") eq 'mysql') { $unet = shift or die "No unet parameter supplied"; mysql_rm_user($host, $port, $dbadmin, $dbadminpass, $db, $user_to_remove, $unet); } else { die "Invalid database backend"; } } sub pg_rm_user { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $db = shift or die "No db parameter supplied"; my $user_to_remove = shift or die "No user-to-remove parameter supplied"; my $sslmode = shift or die "No sslmode parameter supplied"; my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbadmin", "$dbadminpass", {AutoCommit => 1}) or die $_; print ("rm DB user \"x2gouser_$user_to_remove\"\n"); my $sth=$dbh->prepare("REVOKE ALL PRIVILEGES ON sessions, used_ports, mounts FROM \"x2gouser_$user_to_remove\""); $sth->execute(); my $sth=$dbh->prepare("REVOKE ALL PRIVILEGES ON sessions_view, mounts_view, servers_view, ports_view FROM \"x2gouser_$user_to_remove\""); $sth->execute(); my $sth=$dbh->prepare("DROP OWNED BY \"x2gouser_$user_to_remove\""); $sth->execute(); my $sth=$dbh->prepare("drop USER if exists \"x2gouser_$user_to_remove\""); $sth->execute(); $sth->finish(); my ($name, $pass, $uid, $pgid, $quota, $comment, $gcos, $dir, $shell, $expire) = getpwnam($user_to_remove); if (! $uid) { return; } if ( -e "$dir/.x2go/pgsqlpass" ) { unlink("$dir/.x2go/pgsqlpass"); } if ( -e "$dir/.x2go/sqlpass" ) { unlink("$dir/.x2go/sqlpass"); } } sub mysql_rm_user { my $host = shift or die "No host parameter supplied"; my $port = shift or die "No port parameter supplied"; my $dbadmin = shift or die "No dbadmin parameter supplied"; my $dbadminpass = shift or die "No dbadminpass (database administrator password) parameter supplied"; my $db = shift or die "No db parameter supplied"; my $user_to_remove = shift or die "No user-to-remove parameter supplied"; my $unet = shift or die "No unet parameter supplied"; my $dbh=DBI->connect("dbi:mysql:database=$db;host=$host;port=$port", "$dbadmin", "$dbadminpass", {AutoCommit => 1}) or die $_; print ("rm DB user \"x2gouser_$user_to_remove\"\n"); my $sth=$dbh->prepare("DROP USER IF EXISTS `x2gouser_$user_to_remove`@`$unet`"); $sth->execute(); $sth->finish(); my ($name, $pass, $uid, $pgid, $quota, $comment, $gcos, $dir, $shell, $expire) = getpwnam($user_to_remove); if (! $uid) { return; } if ( -e "$dir/.x2go/mysqlpass" ) { unlink("$dir/.x2go/mysqlpass"); } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver/sbin/x2golistsessions_root��������������������������������������������0000755�0000000�0000000�00000003635�13377671145�020272� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> # Copyright (C) 2007-2018 Heinz-Markus Graesing <heinz-m.graesing@obviously-nice.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Hostname; use Sys::Syslog qw( :standard :macros ); use X2Go::Log qw(loglevel); use X2Go::Utils qw(system_capture_stdout_output); use X2Go::Server::Agent qw(session_is_suspended has_agent_state_file); my $x2go_lib_path = system_capture_stdout_output("x2gopath", "libexec"); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); my $uname; my $serv=shift; if ( ! $serv) { $serv=hostname; } my $outp=system_capture_stdout_output("$x2go_lib_path/x2golistsessions_sql","$serv"); my @outp=split("\n","$outp"); for (my $i=0;$i<@outp;$i++) { my @sinfo=split('\\|',"@outp[$i]"); if (@sinfo[4]eq 'F') { print "@outp[$i]\n"; } else { if (has_agent_state_file(@sinfo[1],@sinfo[11])) { if (@sinfo[4]eq 'R') { if (session_is_suspended(@sinfo[1],@sinfo[11])) { system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "$x2go_lib_path/x2gochangestatus 'S' @sinfo[1] > /dev/null"); @outp[$i] =~ s/\|R\|/\|S\|/; } } } print "@outp[$i]\n"; } } ���������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver/sbin/x2goshowblocks���������������������������������������������������0000755�0000000�0000000�00000002736�13377671145�016644� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> # Copyright (C) 2007-2018 Heinz-Markus Graesing <heinz-m.graesing@obviously-nice.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Server::DB; use X2Go::Log qw(loglevel); use X2Go::Utils qw(system_capture_merged_output); openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(loglevel()) ); syslog('info', "x2goshowblocks has been called with options: @ARGV"); my $uname=shift; my $id=shift; my $tbl="mounts"; my @outp=dbsys_getmounts( $id); for (my $i=0;$i<@outp;$i++) { my $path=(split("\\|",@outp[$i]))[1]; print system_capture_merged_output("su", "$uname", "-c", "lsof | grep \"$path\""); } # closing syslog closelog; ����������������������������������x2goserver-4.1.0.3/x2goserver.service���������������������������������������������������������������0000644�0000000�0000000�00000000314�13377671145�014355� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������[Unit] Description=X2Go Server Daemon Documentation=man:x2goserver.conf(5) [Service] Type=forking ExecStart=/usr/sbin/x2gocleansessions PIDFile=/run/x2goserver.pid [Install] WantedBy=multi-user.target ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver/share/x2gofeature.d/x2goserver.features�������������������������������0000755�0000000�0000000�00000003133�13377671145�022425� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2011-2018 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> # Copyright (C) 2011-2018 Heinz-Markus Graesing <heinz-m.graesing@obviously-nice.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" X2GO_FEATURE=$1 # check for X2Go server core features case "$X2GO_FEATURE" in "X2GO_LIST_DESKTOPS") echo "ok"; exit 0;; "X2GO_MOUNTDIRS") echo "ok"; exit 0;; "X2GO_UMOUNTSESSION_ALL") echo "ok"; exit 0;; "X2GO_UMOUNTSESSION_ONLYPATH") echo "ok"; exit 0;; "X2GO_PUBLISHED_APPLICATIONS") echo "ok"; exit 0;; "X2GO_SERVERSIDE_DESKTOPCOMMANDS") echo "ok"; exit 0;; "X2GO_SET_KEYBOARD") echo "ok"; exit 0;; "X2GO_LIST_SHADOWSESSIONS") echo "ok"; exit 0;; "X2GO_MOUNT_UNCPATHS") echo "ok"; exit 0;; "X2GO_CLIPBOARD_MODES") echo "ok"; exit 0;; *) exit -1;; esac �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver/VERSION.x2goserver����������������������������������������������������0000644�0000000�0000000�00000000010�13377671145�016141� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������4.1.0.3 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-x2goagent/bin/.keep���������������������������������������������������0000644�0000000�0000000�00000000000�13377671145�016354� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-x2goagent/etc/keystrokes.cfg������������������������������������������0000644�0000000�0000000�00000002272�13377671145�020333� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!DOCTYPE NXKeystroke> <keystrokes> <keystroke action="close_session" Control="1" AltMeta="1" key="t" /> <keystroke action="switch_all_screens" Control="1" AltMeta="1" key="f" /> <keystroke action="minimize" Control="1" AltMeta="1" key="m" /> <keystroke action="resize" Control="1" AltMeta="1" key="r" /> <keystroke action="defer" Control="1" AltMeta="1" key="e" /> <keystroke action="ignore" Control="1" AltMeta="1" key="BackSpace" /> <keystroke action="force_synchronization" Control="1" AltMeta="1" key="j" /> <keystroke action="debug_tree" Control="1" AltMeta="1" key="q" /> <keystroke action="regions_on_screen" Control="1" AltMeta="1" key="a" /> <keystroke action="test_input" Control="1" AltMeta="1" key="x" /> <keystroke action="deactivate_input_devices_grab" Control="1" AltMeta="1" key="y" /> <keystroke action="fullscreen" Control="1" Shift="1" AltMeta="1" key="f" /> <keystroke action="viewport_move_left" Control="1" Shift="1" AltMeta="1" key="Left" /> <keystroke action="viewport_move_up" Control="1" AltMeta="1" key="Up" /> <keystroke action="viewport_move_right" Control="1" AltMeta="1" key="Right" /> <keystroke action="viewport_move_down" Control="1" AltMeta="1" key="Down" /> </keystrokes> ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-x2goagent/etc/x2goagent.keyboard��������������������������������������0000644�0000000�0000000�00000000016�13377671145�021061� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������rules=xfree86 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-x2goagent/etc/x2goagent.options���������������������������������������0000644�0000000�0000000�00000003137�13377671145�020763� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# # This file can be used to specify default options that are passed to nxagent. # # These options can be overridden by the client! # # See the output of `nxagent -help` for the full list of options. # # Remember: # "-extension" disables an extension. # "+extension" enables an extension. X2GO_NXAGENT_DEFAULT_OPTIONS="" # Uncomment to disable GLX, the old mesa version is hopelessly outdated anyways. # Unbreaks the gnome3 control center # #X2GO_NXAGENT_DEFAULT_OPTIONS+=" -extension GLX" # Launch X2Go's X-server x2goagent with option "-nolisten tcp". # # This is the default setting and the X2Go developers really recommend not to # touch this. However, if you play with this (i.e. if you comment it out) you # should really know what you are doing. # # For everyone else: don't touch the line below!!! X2GO_NXAGENT_DEFAULT_OPTIONS+=" -nolisten tcp" # Enforce clipboard behaviour in X2Go sessions globally (for all connecting clients) # Possible values for the -clipboard option: both, server, client, none # If this option stays commented out, clients can choose the sessions' clipboard behaviour... #X2GO_NXAGENT_DEFAULT_OPTIONS+=" -clipboard both" # BIG-REQUESTS can be problematic. Older versions of nx-libs did not implement # this extension correctly, leading to all sorts of weird crashes if left # enabled. # Newer versions should handle this extension much better, but if you see # crashes related to BIG-REQUESTS, uncomment this line to disable the # extension. #X2GO_NXAGENT_DEFAULT_OPTIONS+=" -extension BIG-REQUESTS" # Extra nxagent nx/nx options, separated by commas. For example: sleep=0 X2GO_NXOPTIONS="" ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-x2goagent/Makefile����������������������������������������������������0000755�0000000�0000000�00000006752�13377671145�016346� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/make -f SRC_DIR=$(CURDIR) SHELL=/bin/bash INSTALL_DIR=install -d -o root -g root -m 755 INSTALL_FILE=install -o root -g root -m 644 INSTALL_PROGRAM=install -o root -g root -m 755 INSTALL_SYMLINK=ln -s -f RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty DESTDIR ?= PREFIX ?= /usr/local ETCDIR=/etc/x2go BINDIR=$(PREFIX)/bin LIBDIR=$(PREFIX)/lib/x2go NXLIBDIR ?= $(LIBDIR)/../nx MANDIR=$(PREFIX)/share/man SHAREDIR=$(PREFIX)/share/x2go BIN_SCRIPTS=x2goagent $(shell cd bin && echo *) FEATURE_SCRIPTS=$(shell cd share/x2go/x2gofeature.d && echo *.features) man_pages = `cd man && find * -type f` MAN2HTML_BIN = $(shell which man2html) MAN2HTML_SRC = man MAN2HTML_DEST = .build_man2html/html all: clean build build: build-arch build-indep build-arch: build-indep: build_man2html build_man2html: if [ -n "$(MAN2HTML_BIN)" ]; then \ mkdir -p $(MAN2HTML_DEST); \ for man_page in $(man_pages); do mkdir -p `dirname $(MAN2HTML_DEST)/$$man_page`; done; \ for man_page in $(man_pages); do $(MAN2HTML_BIN) $(MAN2HTML_SRC)/$$man_page > $(MAN2HTML_DEST)/$$man_page.html; done; \ fi clean: clean_man2html clean_man2html: rm -rf `dirname $(MAN2HTML_DEST)` install: install_scripts install_config install_data install_man install_version install_scripts: $(INSTALL_DIR) $(DESTDIR)$(BINDIR) $(INSTALL_SYMLINK) ../../$(NXLIBDIR)/bin/x2goagent $(DESTDIR)$(BINDIR)/x2goagent $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/x2gofeature.d $(INSTALL_PROGRAM) share/x2go/x2gofeature.d/*.features $(DESTDIR)$(SHAREDIR)/x2gofeature.d/ $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/bin/ $(INSTALL_SYMLINK) nxagent $(DESTDIR)$(NXLIBDIR)/bin/x2goagent install_data: $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/ $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/../pixmaps/ $(INSTALL_FILE) share/pixmaps/x2goagent.xpm $(DESTDIR)$(SHAREDIR)/../pixmaps/ install_config: $(INSTALL_DIR) $(DESTDIR)$(ETCDIR)/ $(INSTALL_FILE) etc/x2goagent.options $(DESTDIR)$(ETCDIR)/ $(INSTALL_FILE) etc/x2goagent.keyboard $(DESTDIR)$(ETCDIR)/ $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)$(ETCDIR)/ install_man: $(INSTALL_DIR) $(DESTDIR)$(MANDIR) $(INSTALL_DIR) $(DESTDIR)$(MANDIR)/man1 $(INSTALL_FILE) man/man1/*.1 $(DESTDIR)$(MANDIR)/man1 gzip -f $(DESTDIR)$(MANDIR)/man1/x2go*.1 install_version: $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/versions $(INSTALL_SYMLINK) ../../nx/VERSION.nxagent $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-x2goagent uninstall: uninstall_scripts uninstall_config uninstall_data uninstall_man uninstall_version uninstall_scripts: for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(BINDIR)/$$file; done for file in x2goagent; do $(RM_FILE) $(DESTDIR)$(NXLIBDIR)/$$file; done for file in $(FEATURE_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(SHAREDIR)/x2gofeature.d/$$file; done uninstall_data: cd share && for file in pixmaps/x2go.xpm; do \ $(RM_FILE) $(DESTDIR)$(SHAREDIR)/../$$file; \ $(RM_DIR) $(shell dirname $(DESTDIR)$(SHAREDIR)/../$$file); \ done uninstall_config: $(RM_FILE) $(DESTDIR)$(ETCDIR)/x2goagent.options $(RM_FILE) $(DESTDIR)$(ETCDIR)/x2goagent.keyboard $(RM_FILE) $(DESTDIR)$(ETCDIR)/keystrokes.cfg $(RM_DIR) $(DESTDIR)$(ETCDIR) || true uninstall_man: for file in $(BIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(MANDIR)/man1/$$file.1.gz; done $(RM_DIR) $(DESTDIR)$(MANDIR) || true uninstall_version: $(RM_FILE) $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-x2goagent $(RM_DIR) $(DESTDIR)$(SHAREDIR)/versions || true ����������������������x2goserver-4.1.0.3/x2goserver-x2goagent/man/man1/x2goagent.1����������������������������������������0000644�0000000�0000000�00000002115�13377671145�020257� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������.TH x2goagent 1 .SH NAME x2goagent \- X2Go Agent. .SH SYNOPSIS .B x2goagent .I "[options]" .SH DESCRIPTION \fBx2goagent\fR is a wrapper around nxagent. The nxagent Xserver is an Xnest-like X server for remote application/desktop access. .PP \fBx2goagent\fR implements a very efficient compression of the X11 protocol. .PP This increases performance when using X applications over high latency and low bandwidth networks, while providing a local (LAN-like) usage experience even if connecting from off-site locations (via cable modem or GSM). .PP \fBx2goagent\fR is not designed to be used as a standalone application. It has to be launched on the server side by the X2Go server software. .PP Available clients are \fBx2goclient\fR, \fBpyhoca-gui\fR and \fBpyhoca-gui\fR (using the Python X2Go API). .SH OPTIONS .TP .B \-help Lists all others options that are not listed here. .SH FURTHER READINGS Information on X2Go: https://wiki.x2go.org .PP Information on NX: https://github.com/ArcticaProject/nx-libs .SH AUTHOR This manual page was written by Mike Gabriel <mike.gabriel@das-netzwerkteam.de>. ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-x2goagent/share/pixmaps/x2goagent.xpm���������������������������������0000644�0000000�0000000�00000043716�13377671145�022113� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/**************************************************************************/ /* */ /* Copyright 2008 Heinz-M. Graesing <heinz-m.graesing@obviously-nice.de> */ /* Copyright 2018 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> */ /* */ /* NXAGENT, NX protocol compression and NX extensions to this software */ /* are copyright of the aforementioned persons and companies. */ /* */ /* Redistribution and use of the present software is allowed according */ /* to terms specified in the file LICENSE which comes in the source */ /* distribution. */ /* */ /* All rights reserved. */ /* */ /**************************************************************************/ /* XPM */ static char *x2goagentIconData[]={ "128 128 18 1", ". c None", ": c #FFFFFF", "m c #323232", "l c #323232", "f c #323232", "e c #323232", "o c #323232", "# c #323232", "h c #323232", "i c #323232", "n c #323232", "d c #323232", "a c #323232", "g c #323232", "j c #323232", "b c #323232", "k c #323232", "c c #323232", ".....#abccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccbde.....", "...fbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccgf...", "..#ccccaheeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeijccckf..", ".ecccgl::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ejcckf.", ".bccd:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mdccg.", "#cca:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mjcce", "gckm::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::eccd", "ccn::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::jcb", "cce::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::icc", "ccm::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::meeee::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::eeeeeeeeoiiiiiiiinggggggggjccccccccccccc::::#ggggggggggggggggggggggggggggf:::::::::::::ggggggggggggggggggggggf::::ecc", "cc::::meeeeoiiiiiiiinggggggggjccccccccccccccccccccc::::icccccccccccccccccccccccccccce:::::::::::::cccccccccccccccccccccce::::ecc", "cc::::::::::::::::::::::::::::::::::::meeeeeeeeoiii::::icccccccccccccccccccccccccccce:::::::::::::cccccccccccccccccccccce::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::menbccccccccccccccccccbhe::::::::::::::::::logccccccccccccghe:::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::iccccccccccccccccdm:::::::::::::::::::::::#cccccccccke::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::lee:::::::::::#cccccccccccccckm:::::::::::::::::::::::::jccccccckm:::::::::::ecc", "cc::::::::feeeeeeeeoiiiiiiiiiaggggggggjcccccccccccc::::::::::::icccccccccccccd::::::::::::::::::::::::::icccccccf::::::::::::ecc", "cc::::meeeeeoiiiiiiiinggggggggjcccccccccccccccccccciiiiii#m:::::jcccccccccccci::::::::::::::::::::::::::icccccci:::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::eeeeeeeeeiiiiiiiiigl::::eccccccccccccd::::::::::::::::::::::::::dcccccj::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::dcccccccccccj::::::::::::::::::::::::::bccccce::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::lccccccccccccl::::::::::::::::::::::::lccccca:::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::meeeeeeee#iiiie::::dccccccccccch::::::::::::::::::::::::icccccl:::::::::::::::ecc", "cc:::::::::meeeeeeeeoiiiiiiiinggggggggjccccccccccccccccccccccb::::ecccccccccccb::::::::::::::::::::::::bccccn::::::::::::::::ecc", "cc::::meeeeiiiiiiiiiaggggggggbcccccccccccccccccccccccccccccccc#::::gccccccccccco::::::::::::::::::::::#cccckm::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::meeeeeeeeeiiiiiiiiiaggggd::::#cccccccccccg::::::::::::::::::::::bcccci:::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::bcccccccccccf::::::::::::::::::::#cccckm:::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::hcccccccccccd:::::::::::::::::::mkcccci::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::meeeeeeeeoiiiiiiiil:::mkcccccccccccl::::::::::::::::::icccckm::::::::::::::::::ecc", "cc:::::::::eeeeeeeeoiiiiiiiinggggggggjccccccccccccccccccccccccccn::::dccccccccccci:::::::::::::::::mkcccci:::::::::::::::::::ecc", "cc::::meeeeeiiiiiiiiiaggggggggbccccccccccccccccccccccccccccccccckm:::lccccccccccck:::::::::::::::::icccckm:::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::leeeeeeeeoiiiiiiiiigggggggo::::accccccccccc#:::::::::::::::mkcccch::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecccccccccccb:::::::::::::::iccccb:::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::jccccccccccce:::::::::::::mkcccc#:::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::meeeeeeeeehiiiiiiii#::::#ccccccccccca:::::::::::::nccccb::::::::::::::::::::::ecc", "cc::::::::feeeeeeee#iiiiiiiiigggggggggkccccccccccccccccccccccccccccl::::kcccccccccccl:::::::::::lccccc#::::::::::::::::::::::ecc", "cc::::meeeeeoiiiiiiiiigggggggggkcccccccccccccccccccccccccccccccccccd::::icccccccccccd:::::::::::dccccb:::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::leeeeeeeeoiiiiiiiingggggggga::::mccccccccccckm:::::::::lccccc#:::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::dccccccccccch:::::::::dccccb::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::lcccccccccccb::::::::lccccc#::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::meeeeeeeeoiiiiiiiingggo::::gccccccccccc#:::::::dccccg:::::::::::::::::::::::::ecc", "cc:::::::::meeeeeeeeoiiiiiiiinggggggggjccccccccccccccccccccccccccccccg::::occcccccccccg::::::lccccce:::::::::::::::::::::::::ecc", "cc::::meeeeiiiiiiiiiaggggggggbcccccccccccccccccccccccccccccccccccccccce::::bccccccccccce:::::gccccg::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::meeeeeeeeeiiiiiiiiigggggggggkcccd::::#cccccccccccd::::eccccce::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mkcccccccccccl:::gccccg:::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::nccccccccccci..eccccce:::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::meeeeeeeeoiiiiiiiingggggggm:::lccccccccccckm.gccccg::::::::::::::::::::::::::::ecc", "cc:::::::::eeeeeeeeoiiiiiiiinggggggggjcccccccccccccccccccccccccccccccccc#::::dccccccccccc#eccccce::::::::::::::::::::::::::::ecc", "cc::::meeeeeiiiiiiiiiaggggggggkcccccccccccccccccccccccccccccccccccccccccb::::ecccccccccccbgccccg:::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::leeeeeeeeoiiiiiiiiigggggggggkccccco::::gccccccccccccccccl:::::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#cccccccccccccccd::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::bccccccccccccccl::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::leeeeeeeeeiiiiiiiiiagggggggi::::icccccccccccccd:::::::::::::::::::::::::::::::ecc", "cc::::::::feeeeeeee#iiiiiiiingggggggggkccccccccccccccccccccccccccccccccccckm:::mkccccccccccccl:::::::::::::::::::::::::::::::ecc", "cc::::meeeeeoiiiiiiiiigggggggggkccccccccccccccccccccccccccccccccccccccccccci::::dccccccccccca::::::::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::leeeeeeeeoiiiiiiiiigggggggggccccccck::::lccccccccccckm:::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::accccccccccc#:::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecccccccccccb:::::::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::leeeeeeeeeiiiiiiiiiaggggggggbcce::::bccccccccccce::::::::::::::::::::::::::::::ecc", "cc:::::::feeeeeeee#iiiiiiiiigggggggggkcccccccccccccccccccccccccccccccccccccccd::::#cccccccccccg::::::::::::::::::::::::::::::ecc", "cc::::meeeeeeoiiiiiiiingggggggggccccccccccccccccccccccccccccccccccccccccccccccl::::kcccccccccccl:::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::feeeeeeeehiiiiiiiidggggggggbccccccccci::::ncccccccccccd:::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mm::::bccccccccccccm::::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#ccccccccccccci::::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::leeeeeeee#iiiiiiiidggggggggbcccccl::::bccccccccccccck::::::::::::::::::::::::::::ecc", "cc::::::feeeeeeeehiiiiiiiiaggggggggkccccccccccccccccccccccccccccccccccccccccd::::#ccccccccccccccc#:::::::::::::::::::::::::::ecc", "cc::::meeeeeee#iiiiiiiidggggggggjcccccccccccccccccccccccccccccccccccccccccccl::::bcccccccccccccccb:::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::meeeeeeeeeiiiiiiiiigggggggggkcccccd::::#cccccbccccccccccce::::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::bccccdhcccccccccccg::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#ccccclmkcccccccccccl:::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::meeeeeeeeeiiiiiiiiiaggggggggbkm::::bccccd..ncccccccccccd:::::::::::::::::::::::::ecc", "cc:::::leeeeeeeeoiiiiiiiiigggggggggkccccccccccccccccccccccccccccccccccccci::::hcccckl..lccccccccccccm::::::::::::::::::::::::ecc", "cc::::meeeeeeeehiiiiiiiidggggggggbcccccccccccccccccccccccccccccccccccccckm:::mkcccci::::dccccccccccci::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::leeeeeeee#iiiiiiiinggggggggjcci::::icccckm::::eccccccccccck::::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mkcccci::::::gccccccccccc#:::::::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::icccckm::::::#cccccccccccb:::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::leeeeeeeeoiiiiiiiiigggggggga::::mkcccci::::::::bccccccccccce::::::::::::::::::::::ecc", "cc::::meeeeeeeeoiiiiiiiiigggggggggkccccccccccccccccccccccccccccccccccci::::icccckm::::::::hcccccccccccg::::::::::::::::::::::ecc", "cc:::::feeeeeeeehiiiiiiiiaggggggggkcccccccccccccccccccccccccccccccccckm:::mkcccci:::::::::mkcccccccccccl:::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::feeeeeeeehiiiiiiiiagggggggh::::icccckm::::::::::icccccccccccd:::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mkcccci:::::::::::lccccccccccccm::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::icccckm::::::::::::dccccccccccci::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::eeeeeeeeehiiiiiiiidggga::::mkcccci:::::::::::::fccccccccccck::::::::::::::::::::ecc", "cc::::::feeeeeeee#iiiiiiiingggggggggccccccccccccccccccccccccccccccci::::iccccb:::::::::::::::gccccccccccc#:::::::::::::::::::ecc", "cc::::meeeeeeeoiiiiiiiiigggggggggbcccccccccccccccccccccccccccccccckm:::mkcccc#:::::::::::::::occcccccccccb:::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::meeeeeeeeeiiiiiiiiidgggg#::::iccccb:::::::::::::::::bccccccccccce::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mkcccc#:::::::::::::::::#cccccccccccg::::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::iccccb::::::::::::::::::mkcccccccccccl:::::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::eeeeeeeeeiiiiiiiiiaga::::mkcccc#:::::::::::::::::::icccccccccccd:::::::::::::::::ecc", "cc:::::leeeeeeee#iiiiiiiinggggggggjccccccccccccccccccccccccccccci::::iccccb::::::::::::::::::::lccccccccccccm::::::::::::::::ecc", "cc::::meeeeeeee#iiiiiiiiigggggggggkcccccccccccccccccccccccccccckm:::mkcccc#:::::::::::::::::::::dccccccccccci::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::leeeeeeeeoiiiiiiiiiah::::iccccb::::::::::::::::::::::lccccccccccck::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mkcccc#:::::::::::::::::::::::gccccccccccc#:::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::dccccj::::::::::::::::::::::::ecccccccccccj:::::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::leeeeeeeeeiiiiiiih::::lccccce:::::::::::::::::::::::::bccccccccccce::::::::::::::ecc", "cc::::meeeeeeeeeiiiiiiiiidgggggggggcccccccccccccccccccccccccci::::dccccg::::::::::::::::::::::::::#ccccccccccca::::::::::::::ecc", "cc:::::feeeeeeeeiiiiiiiinggggggggbcccccccccccccccccccccccccckm:::lccccce:::::::::::::::::::::::::::kcccccccccccl:::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::leeeeeeeehiiiiiiiih::::dccccg::::::::::::::::::::::::::::ncccccccccccd:::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::lccccce::::::::::::::::::::::::::::fccccccccccccf::::::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::dccccb::::::::::::::::::::::::::::::jcccccccccccg::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::meeeeeeeeoiiiiil::::lcccccn::::::::::::::::::::::::::::::icccccccccccce:::::::::::ecc", "cc::::::feeeeeeeehiiiiiiiigggggggggccccccccccccccccjgggggo:::::gccccc#::::::::::::::::::::::::::::::eccccccccccccbm::::::::::ecc", "cc::::meeeeeeeoiiiiiiiiidgggggggggccccccccccccccccc:::::::::::hcccccco:::::::::::::::::::::::::::::::cccccccccccccn::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::leeeeeee::::::::::ecccccccn::::::::::::::::::::::::::::::lcccccccccccccc#:::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::::#kccccccckf:::::::::::::::::::::::::::::nccccccccccccccc#::::::::ecc", "cc::::::::::::::::::::::::::::::::::::::::::::::::::::::::ldcccccccccck#m:::::::::::::::::::::::::lncccccccccccccccccdl::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::feeeeeee::::ogjcccccccccccccccggi::::::::::::::::::oggbcccccccccccccccccccccja::::ecc", "cc:::::leeeeeeee#iiiiiiiidggggggggbcccccccccccccccc::::icccccccccccccccccccg::::::::::::::::::icccccccccccccccccccccccccc::::ecc", "cc::::meeeeeeeehiiiiiiiiaggggggggkccccccccccccccccc::::icccccccccccccccccccg::::::::::::::::::icccccccccccccccccccccccccc::::ecc", "cc::::::::::::::::::::::::::::::::::::::::feeeeeeee::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cc:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::ecc", "cce::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::hcc", "ccn::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::acb", "jcb:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::lcca", "hcci::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::acc#", "mkcc#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::dccb.", ".occci:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::macccf.", "..#cccbne:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::menkccc#..", "...okccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccbe...", "....mhjccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccg#....."}; ��������������������������������������������������x2goserver-4.1.0.3/x2goserver-x2goagent/share/x2go/x2gofeature.d/x2goserver-x2goagent.features������0000755�0000000�0000000�00000002210�13377671145�027067� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/bash # Copyright (C) 2015, Mike Gabriel <mike.gabriel@das-netzwerkteam.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # silently bail out if X2Go Server is not installed if ! which x2gopath 1>/dev/null; then exit 0 fi X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" X2GO_FEATURE=$1 # check for X2Go Agent features case "$X2GO_FEATURE" in "X2GOAGENT_RANDRXINERAMA") echo "ok"; exit 0;; *) exit -1;; esac ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-xsession/doc/README.Xsession-X2Go�������������������������������������0000644�0000000�0000000�00000000657�13377671145�020672� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Xsession-X2Go README ==================== With X2Go it is possible to use Xsession config files of your local X11 system. By default most files and folders related to Xsession config are symlinks to the corresponding file/folder in /etc/X11. If you want to customize your X2Go server's Xsession setup copy the corresponding files from /etc/X11 to /etc/x2go and adapt the setup to your needs. light+love, Mike Gabriel, 20111027 ���������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-xsession/etc/Xsession�������������������������������������������������0000755�0000000�0000000�00000017226�13377671145�017172� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/bash # # /etc/x2go/Xsession # # X2Go Xsession file -- used by x2goserver Xsession.d add-on. # This file has been derived from the global Xsession file in Debian squeeze set -e X2GO_LIBEXEC_PATH="$(x2gopath libexec)"; PROGNAME=XSession-x2go message () { # pretty-print messages of arbitrary length; use xmessage if it # is available and $DISPLAY is set MESSAGE="$PROGNAME: $*" echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2 if [ -n "$DISPLAY" ] && which xmessage 1> /dev/null 2>&1; then echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file - fi } message_nonl () { # pretty-print messages of arbitrary length (no trailing newline); use # xmessage if it is available and $DISPLAY is set MESSAGE="$PROGNAME: $*" printf '%s' "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2; if [ -n "$DISPLAY" ] && which xmessage 1> /dev/null 2>&1; then printf '%s' "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file - fi } errormsg () { # exit script with error message "$*" exit 1 } internal_errormsg () { # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message # One big call to message() for the sake of xmessage; if we had two then # the user would have dismissed the error we want reported before seeing the # request to report it. errormsg "$*" \ "Please report the installed version of the \"X2Go Server\"" \ "package and the complete text of this error message to" \ "<x2go-dev@lists.x2go.org>." } # Load profile for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do if [ -f "$file" ]; then echo "Loading profile from $file"; set +e . "$file" set -e fi done cur_hostname="$(hostname)" if [ -z "${cur_hostname}" ] || [ "${cur_hostname}" = "(none)" ] || [ "${cur_hostname}" = "localhost" ]; then errormsg "Hostname not set correctly; aborting." fi # initialize variables for use by all session scripts OPTIONFILE=/etc/x2go/Xsession.options SYSRESOURCES=/etc/x2go/Xresources USRRESOURCES=$HOME/.Xresources-x2go SYSSESSIONDIR=/etc/x2go/Xsession.d USERXSESSION=$HOME/.xsession-x2go USERXSESSIONRC=$HOME/.xsessionrc-x2go ALTUSERXSESSION=$HOME/.Xsession-x2go ERRFILE="${HOME}/.xsession-x2go-${cur_hostname}-errors" # Move the old error log file away. if [ -f "${ERRFILE}" ]; then if [ -L "${ERRFILE}" ]; then resolved_errfile="$(perl -e 'use Cwd qw (abs_path); print abs_path ("' "${ERRFILE}" '") . "\n";')" mv "${resolved_errfile}" "${resolved_errfile}.old" || errormsg "Unable to move symlinked old log/error file '${resolved_errfile}'; aborting." else mv "${ERRFILE}" "${ERRFILE}.old" || errormsg "Unable to move old log/error file '${ERRFILE}'; aborting." fi fi # attempt to create an error file; abort if we cannot if (umask 177 && touch "$ERRFILE") 2> /dev/null && [ -w "$ERRFILE" ] && [ ! -L "$ERRFILE" ]; then chmod 600 "$ERRFILE" elif ERRFILE=$(umask 077 && mktemp 2> /dev/null); then if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-x2go-${cur_hostname}-$USER"; then message "warning: unable to symlink \"$TMPDIR/xsession-x2go-${cur_hostname}-$USER\" to" \ "\"$ERRFILE\"; look for session log/errors in" \ "\"$TMPDIR/xsession-x2go-$USER\"." fi else errormsg "unable to create X session (X2Go) log/error file; aborting." fi exec >>"$ERRFILE" 2>&1 echo "$PROGNAME: X session started for $LOGNAME at $(date)" # Attempt to create a file of non-zero length in /tmp; a full filesystem can # cause mysterious X session failures. We do not use touch, :, or test -w # because they won't actually create a file with contents. We also let standard # error from mktemp and echo go to the error file to aid the user in # determining what went wrong. WRITE_TEST=$(mktemp) if ! echo "*" >>"$WRITE_TEST"; then message "warning: unable to write to ${WRITE_TEST%/*}; X session (X2Go) may" \ "exit with an error" fi rm -f "$WRITE_TEST" if [ -f /etc/debian_version ] || [ -f /etc/devuan_version ]; then # sanity check; is our session script directory present? if [ ! -d "$SYSSESSIONDIR" ]; then errormsg "no \"$SYSSESSIONDIR\" directory found; aborting." fi # use run-parts to source every file in the session directory; we source # instead of executing so that the variables and functions defined above # are available to the scripts, and so that they can pass variables to each # other SESSIONFILES=$(run-parts --list $SYSSESSIONDIR) SYSSESSIONDIR=/etc/x2go/Xsession.d SESSIONFILES=$(run-parts --list $SYSSESSIONDIR) ### source Xsession files if [ -n "$SESSIONFILES" ]; then set +e for SESSIONFILE in $SESSIONFILES; do "$X2GO_LIBEXEC_PATH/x2gosyslog" "$0" "info" "executing $SESSIONFILE" . $SESSIONFILE done set -e fi elif [ -f /etc/redhat-release ] || [ -f /etc/gentoo-release ] || [ -f /etc/SUSE-brand ] || [ -f /etc/SuSE-release ] || [ -f /etc/os-rt-release ]; then # define a fallback... (should never be needed). The XSESSION_EXEC var gets set in # X2Go's x2goruncommand script and can be used with obsolete switchdesk or with # Xclients.d scripts (also rarely used, see below...). XSESSION_EXEC=${XSESSION_EXEC:-xterm} # Set up i18n environment if [ -r /etc/profile.d/lang.sh ]; then set +e . /etc/profile.d/lang.sh set -e fi # merge in defaults [ -r "$SYSRESOURCES" ] && xrdb -nocpp -merge "$SYSRESOURCES" [ -r "$USRRESOURCES" ] && xrdb -merge "$USRRESOURCES" # RHEL's Xsession file for X11 allows playing with setxkbmap / xmodmap # We provide this for compat, but disrecommend using it. Make sure to # disable any Keyboard setup in X2Go Client / PyHoca-GUI if you want to # use server-side key mappings. USRMODMAP=$HOME/.Xmodmap-x2go USRXKBMAP=$HOME/.Xkbmap-x2go SYSMODMAP=/etc/x2go/Xmodmap SYSXKBMAP=/etc/x2go/Xkbmap # merge in keymaps if [ -r "$SYSXKBMAP" ]; then setxkbmap $(cat "$SYSXKBMAP") XKB_IN_USE=yes fi if [ -r "$USRXKBMAP" ]; then setxkbmap $(cat "$USRXKBMAP") XKB_IN_USE=yes fi # xkb and xmodmap don't play nice together if [ -z "$XKB_IN_USE" ]; then [ -r "$SYSMODMAP" ] && xmodmap "$SYSMODMAP" [ -r "$USRMODMAP" ] && xmodmap "$USRMODMAP" fi unset XKB_IN_USE # run all system xinitrc shell scripts. for file in /etc/x2go/xinitrc.d/* ; do set +e [ -r "$file" ] && . $file set -e done # Prefix launch of session with ssh-agent if available and not already running. SSH_AGENT= if [ -x /usr/bin/ssh-agent -a -z "$SSH_AGENT_PID" ]; then if [ "x$TMPDIR" != "x" ]; then SSH_AGENT="/usr/bin/ssh-agent /bin/env TMPDIR=$TMPDIR" else SSH_AGENT="/usr/bin/ssh-agent" fi fi CK_XINIT_SESSION= if [ -x /usr/bin/ck-xinit-session -a -z "$XDG_SESSION_COOKIE" ]; then CK_XINIT_SESSION="/usr/bin/ck-xinit-session" fi # At the time of integrating X2Go Xsession support for RHEL6 / Fedora # the Xsession stuff in Fedora/RHEL6 seems to be a little mess. # The proposed strategy is to have Xclients.$WM.sh files in # /etc/X11/xinit/Xclients.d. Currently, only wmx uses this mechanism. # As it is a described but rather unused ,,standard'' we will not support it # in X2Go for now, but leave it here as a reminder... # XCLIENTS_D=/etc/x2go/Xclients.d #if [ -d "$XCLIENTS_D" -a -x "$XCLIENTS_D/Xclients.${XSESSION_EXEC}.sh" ]; then # exec /bin/bash -c "exec -l \"$SHELL\" -c \"$CK_XINIT_SESSION $SSH_AGENT $XCLIENTS_D/Xclients.$1.sh\"" #fi # switchdesk support is also totally deprecated in RHEL, but we leave it here # as a reminder, as well, in case we need it in the future for special setups... #if [ -x "$SWITCHDESKPATH/Xclients.${XSESSION_EXEC}" ]; then # exec /bin/bash -c "exec -l \"$SHELL\" -c \"$SWITCHDESKPATH/Xclients.${XSESSION_EXEC}\"" #fi exec $CK_XINIT_SESSION $SSH_AGENT /bin/bash -c "exec -l \"$SHELL\" -c \"$STARTUP\"" else errormsg 'Unknown operating system, XSession startup not implemented!' fi exit 0 ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-xsession/Makefile�����������������������������������������������������0000755�0000000�0000000�00000006561�13377671145�016321� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/make -f SRC_DIR=$(CURDIR) SHELL=/bin/bash INSTALL_DIR=install -d -o root -g root -m 755 INSTALL_FILE=install -o root -g root -m 644 INSTALL_SYMLINK=ln -s -f INSTALL_PROGRAM=install -o root -g root -m 755 RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty DESTDIR ?= PREFIX ?= /usr/local ETCDIR=/etc/x2go BINDIR=$(PREFIX)/bin SBINDIR=$(PREFIX)/sbin LIBDIR=$(PREFIX)/lib/x2go MANDIR=$(PREFIX)/share/man SHAREDIR=$(PREFIX)/share/x2go XSESSIONDIR ?= /etc/X11/Xsession.d XSESSIONOPTIONFILE ?= /etc/X11/Xsession.options XINITRCDIR ?= /etc/X11/xinit/xinitrc.d XCLIENTSDIR ?= /etc/X11/xinit/Xclients.d ETC_FILES=$(shell cd etc && echo *) FEATURE_SCRIPTS=$(shell cd share/x2gofeature.d && echo *.features) all: clean build build: build-arch build-indep build-arch: build-indep: build_man2html build_man2html: clean: clean_man2html clean_man2html: install: install_scripts install_config install_man install_version install_scripts: $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/x2gofeature.d $(INSTALL_PROGRAM) share/x2gofeature.d/*.features $(DESTDIR)$(SHAREDIR)/x2gofeature.d/ install_config: $(INSTALL_DIR) $(DESTDIR)$(ETCDIR) # provide target dirs for X11 related symlinks $(INSTALL_PROGRAM) etc/Xsession $(DESTDIR)$(ETCDIR)/ $(INSTALL_SYMLINK) /etc/X11/Xresources $(DESTDIR)$(ETCDIR)/ if [ -e /etc/debian_version ]; then if [ -e $(XSESSIONOPTIONFILE) ]; then $(INSTALL_SYMLINK) $(XSESSIONOPTIONFILE) $(DESTDIR)$(ETCDIR)/Xsession.options; else touch $(DESTDIR)$(ETCDIR)/Xsession.options; fi; fi if [ -e /etc/debian_version ]; then if [ -d $(XSESSIONDIR) ]; then $(RM_FILE) $(DESTDIR)$(ETCDIR)/Xsession.d; $(INSTALL_SYMLINK) $(XSESSIONDIR) $(DESTDIR)$(ETCDIR)/Xsession.d; else $(INSTALL_DIR) $(DESTDIR)$(ETCDIR)/Xsession.d; fi; fi if [ -e /etc/redhat-release ] || [ -e /etc/gentoo-release ]; then if [ -d $(XINITRCDIR) ]; then $(INSTALL_SYMLINK) $(XINITRCDIR) $(DESTDIR)$(ETCDIR)/xinitrc.d; else $(INSTALL_DIR) $(DESTDIR)$(ETCDIR)/xinitrc.d; fi; fi if [ -e /etc/redhat-release ] || [ -e /etc/gentoo-release ]; then if [ -d $(XCLIENTSDIR) ]; then $(INSTALL_SYMLINK) $(XCLIENTSDIR) $(DESTDIR)$(ETCDIR)/Xclients.d; else $(INSTALL_DIR) $(DESTDIR)$(ETCDIR)/Xclients.d; fi; fi if [ -e /etc/os-release ] && cat /etc/os-release | grep "suse" 1>/dev/null || [ -d /usr/share/doc/packages/brp-check-suse ]; then if [ -d $(XINITRCDIR) ]; then $(INSTALL_SYMLINK) $(XINITRCDIR) $(DESTDIR)$(ETCDIR)/xinitrc.d; else $(INSTALL_DIR) $(DESTDIR)$(ETCDIR)/xinitrc.d; fi; fi install_man: install_version: $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR) $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/versions $(INSTALL_FILE) VERSION.x2goserver-xsession $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-xsession uninstall: uninstall_scripts uninstall_config uninstall_man uninstall_version uninstall_scripts: for file in $(FEATURE_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(SHAREDIR)/x2gofeature.d/$$file; done uninstall_config: for file in $(ETC_FILES); do $(RM_FILE) $(DESTDIR)$(ETCDIR)/$$file; done $(RM_FILE) $(DESTDIR)$(ETCDIR)/Xresources $(RM_FILE) $(DESTDIR)$(ETCDIR)/Xsession.options $(RM_FILE) $(DESTDIR)$(ETCDIR)/Xsession.d $(RM_FILE) $(DESTDIR)$(ETCDIR)/xinitrc.d $(RM_FILE) $(DESTDIR)$(ETCDIR)/Xclients.d uninstall_man: uninstall_version: $(RM_FILE) $(DESTDIR)$(SHAREDIR)/versions/VERSION.x2goserver-xsession $(RM_DIR) $(DESTDIR)$(SHAREDIR)/versions || true �����������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-xsession/README.md����������������������������������������������������0000644�0000000�0000000�00000000371�13377671145�016126� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# x2goserver-xsession This folder contains the scripts to enable you to use your own Xsession file instead of the system ones. * doc documentation folder * etc contains the default Xsession file * share contains the feature itself �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-xsession/share/x2gofeature.d/x2goserver-xsession.features�������������0000755�0000000�0000000�00000002262�13377671145�026151� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/bin/bash # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2011-2018 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> # Copyright (C) 2011-2018 Heinz-Markus Graesing <heinz-m.graesing@obviously-nice.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. X2GO_LIB_PATH="$(x2gopath libexec)"; $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" X2GO_FEATURE=$1 # check for X2Go server core features case "$X2GO_FEATURE" in "X2GO_XSESSION") echo "ok"; exit 0;; *) exit -1;; esac ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/x2goserver-xsession/VERSION.x2goserver-xsession����������������������������������0000644�0000000�0000000�00000000010�13377671145�021663� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������4.1.0.3 ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/X2Go/SupeReNicer.pm��������������������������������������������������������������0000644�0000000�0000000�00000020233�13377671145�014170� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/perl # Copyright (C) 2013-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2013-2015 Guangzhou Nianguan Electronics Technology Co.Ltd. <opensource@gznianguan.com> # Copyright (C) 2013-2015 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. package X2Go::SupeReNicer; =head1 NAME X2Go::SupeReNicer- X2Go SupeReNicer package for Perl =head1 DESCRIPTION X2Go::SupeReNicer Perl package. =cut use strict; use Sys::Syslog qw( :standard :macros ); use X2Go::Utils qw( sanitizer clups system_capture_stdout_output ); use base 'Exporter'; our @EXPORT=('superenice'); sub checkPID { my $pid = sanitizer("num",$_[0]); if ( $pid ) { open(PS,"/bin/ps --no-headers -o %u,%p,%n,%c -p $pid|"); my ($pidInf,undef) = <PS>; close(PS); my ($user,$pid,$nice,$cmd) = split(/\,/,clups($pidInf)); $pid =~ s/\D//g; return ($pid,$user,$nice,$cmd); } else { return (-1, "failure", 0, "failed to sanitize PID"); } } sub sanitizeNL { my $NL = shift; my $fallbackNL = shift; if ($NL =~ m/^(-|\+|)\d+$/) { $NL = int $NL; if ($NL > 19) { $NL = 19; } elsif ($NL < -19) { $NL = -19; } } else { $NL = $fallbackNL; } return $NL; } sub superenice { # Normal: Nice LEVEL? my $normalNL = shift; $normalNL = 0 unless defined $normalNL; $normalNL = sanitizeNL($normalNL, 0); # Idle: Nice LEVEL? my $idleNL = shift; $idleNL = 19 unless defined $idleNL; $idleNL = sanitizeNL($idleNL, 19); # Ignore these users (comma separated list as string) my $ignore_users = shift; $ignore_users = "" unless defined $ignore_users; # if set to "1" we will force renicing of entire user, even on systems with "/proc" my $forceUSERrenice = shift; $forceUSERrenice = 0 unless defined $forceUSERrenice; #Path to the "x2golistsessions_root" perl script... my $x2golsrpath = system_capture_stdout_output("x2gopath", "base") . "/sbin/x2golistsessions_root"; ########################################################################################### # Load list of users to "ignore". These users will never be reniced... my %ignore; while (split(",", $ignore_users)) {my $iu = clups($_);if (length($iu) > 0) {$ignore{$iu} = 1;}} # Load list of users to "ignore". These users will never be reniced... ########################################################################################### if ((-f "/proc/$$/environ") and ($forceUSERrenice ne 1)) { ########################################################################################### # Great! We're on a system with "/proc" so we're able to do this on individual sessions! # Basicaly we're checking the users /proc/<$PID>/environ files for the "X2GO_SESSION" env... my @x2goSessions; # Read the current list of X2Go sessions and their running state open(XGOLS,"$x2golsrpath|"); while (<XGOLS>) { my $line = clups($_); my ($agentPid,$x2gosid,undef,undef,$x2goState,undef,undef,undef,undef,undef,undef,$userID,undef,undef) = split(/\|/,$line); #syslog('debug', "$agentPid,$x2gosid,$x2goState,$userID"); unless (($ignore{$userID} eq 1) || ($x2gosid =~ m/.*XSHAD.*XSHAD/)) { push @x2goSessions, "$x2goState:$agentPid:$x2gosid:$userID"; } } close(XGOLS); foreach my $x2goSInf (@x2goSessions) { my ($x2goState,$agentPid,$x2gosid,$userID,undef) = split(/\:/,$x2goSInf); $agentPid = sanitizer("num",$agentPid); # We're only working with "portable" unix usernames. $userID = sanitizer("pnixusername",$userID); # So if the sanitizer returns something we'll do this.... if ($userID) { # Using the NICE value of the agent to figgure out the current nice state... my ($psP,$psU,$psN,$psC) = checkPID($agentPid); if ($psP > -1) { if ($x2goState eq "R") { # State is R (Running?)... if ($psN ne $normalNL) { # If nice level is not normal, renice to normal... syslog('notice', "ReNicing \"$userID\" to level $normalNL for session \"$x2gosid\""); # For the sake of getting a user back to normal ASAP... We'll renice the entire user not just individual sessions... system("renice", "-n", "$normalNL", "-u", "$userID"); } } elsif ($x2goState eq "S") { # State is S (suspended) if ($psN ne $idleNL) { # Did we renice this? open(AUPS,"/bin/ps --no-headers -o %u,%p,%n,%c -u $userID|"); # use PS to fetch a list of the users current processes while (<AUPS>) { my ($user,$pid,$nice,$cmd) = split(/\,/,clups($_)); $pid = sanitizer("num",$pid); if (-f "/proc/$pid/environ") { open(ENVIRON,"/proc/$pid/environ");my ($Environ,undef) = <ENVIRON>;close(ENVIRON); if ($Environ =~ m/X2GO_SESSION=$x2gosid/) { # If the x2go Session ID is in environ... renice the pid... #syslog('debug', "$pid: X2GO_SESSION=$x2gosid"); system("renice", "-n", "$idleNL", "-p", "$pid"); } } } close(AUPS); # Renice the AGENT so that we'll know that this one is already reniced. system("renice", "-n", "$idleNL", "-p", "$agentPid"); syslog('notice', "ReNicing \"$userID\" to level $idleNL for session \"$x2gosid\""); } } } } } # Great! We're on a system with "/proc" so we're able to do this on individual sessions! ############################################################################################ } else { ########################################################################################### # Oh no.... No "/proc"? Lets do this on a per user basis instead then... # If a user have more than one session, both need to be suspended before we renice.... # Resuming any of that users sessions would return them all to normal priority. my %niceUsers; # Read the current list of X2Go sessions and their running state open(XGOLS,"$x2golsrpath|"); while (<XGOLS>) { my $line = clups($_); my ($agentPid,$x2gosid,undef,undef,$x2goState,undef,undef,undef,undef,undef,undef,$userID,undef,undef) = split(/\|/,$line); syslog('debug', "$agentPid,$x2gosid,,$x2goState,$userID"); # If user is in ignore list... we're not going a damn thing.. unless (($ignore{$userID} eq 1) || ($x2gosid =~ m/.*XSHAD.*XSHAD/)) { unless ($niceUsers{$userID} =~ /^R:/) { # Basically if we got an R we're sticking with it... $niceUsers{$userID} = "$x2goState:$agentPid"; } } } close(XGOLS); foreach my $nUser (keys %niceUsers) { $nUser = sanitizer("pnixusername",$nUser); # We're only working with "portable" unix usernames.. if ($nUser) { # So if the sanitizer return something we'll do this.... my ($x2goState,$agentPid) = split(/\:/, $niceUsers{$nUser}); # Using the NICE value of the agent to figgure out the current nice state... my ($psP,$psU,$psN,$psC) = checkPID($agentPid); syslog('debug', "$nUser:$x2goState,$agentPid:$psP,$psU,$psN,$psC"); if ($psP > -1) { # State is R (Running?)... if ($x2goState eq "R") { # If nice level is not normal, renice to normal... if ($psN ne $normalNL) { syslog('debug', "ReNicing \"$nUser\" to level $normalNL"); system("renice", "-n", "$normalNL", "-u", "$nUser"); } # State is S (suspended) } elsif ($x2goState eq "S") { # Did we renice this? if ($psN ne $idleNL) { syslog('debug', "ReNicing \"$nUser\" to level $idleNL"); system("renice", "-n", "$idleNL", "-u", "$nUser"); } } } } } # Oh no.... No "/proc"? Lets do this on a per user basis instead then... ########################################################################################### } } 1; ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������x2goserver-4.1.0.3/X2Go/Utils.pm��������������������������������������������������������������������0000644�0000000�0000000�00000010726�13377671145�013112� 0����������������������������������������������������������������������������������������������������ustar ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/perl # Copyright (C) 2007-2018 X2Go Project - https://wiki.x2go.org # Copyright (C) 2007-2018 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> # Copyright (C) 2007-2018 Heinz-Markus Graesing <heinz-m.graesing@obviously-nice.de> # Copyright (C) 2013-2015 Guangzhou Nianguan Electronics Technology Co.Ltd. <opensource@gznianguan.com> # Copyright (C) 2013-2015 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. package X2Go::Utils; =head1 NAME X2Go::Utils - X2Go utilities and helper functions for Perl =head1 DESCRIPTION X2Go::Utils Perl package. =cut use strict; use base 'Exporter'; our @EXPORT = ( 'load_module', 'is_true', 'source_environment', 'clups', 'sanitizer', 'system_capture_merged_output', 'system_capture_stdout_output', 'check_x2go_sessionid'); use Sys::Syslog qw( :standard :macros ); use Capture::Tiny qw ( :all ); sub load_module { for (@_) { (my $file = "$_.pm") =~ s{::}{/}g; require $file; } } sub is_true { my $value = shift; if ( $value =~ m/(1|yes|Yes|YES|on|On|ON|True|true|TRUE)/ ) { return 1 } return 0 } sub source_environment { my $name = shift; open my $fh, "<", $name or return -1; while (<$fh>) { chomp; my $line = $_; if ( $line =~ m/^#.*/ ) { next; } my ($k, $v) = split /=/, $line, 2; $v =~ s/^(['"])(.*)\1/$2/; #' fix highlighter $v =~ s/\$([a-zA-Z]\w*)/$ENV{$1}/g; $v =~ s/`(.*?)`/`$1`/ge; #dangerous $ENV{$k} = $v; } } # Over-zealous string sanitizer that makes perl strict and perl -T happy... sub sanitizer { my $type = lc($_[0]); my $string = $_[1]; if ($type eq "anumazcs") { $string =~ s/[^a-zA-Z0-9]//g; if ($string =~ /^([a-zA-Z0-9]*)$/) { $string = $1; return $string; } else {return 0;} } elsif ($type eq "anumazlc") { $string = lc($string); $string =~ s/[^a-z0-9]//g; if ($string =~ /^([a-z0-9]*)$/) { $string = $1; return $string; } else {return 0;} } elsif ($type eq "num") { $string =~ s/\D//g; if ($string =~ /^([0-9]*)$/) { $string = $1; return $string; } else {return 0;} } elsif ($type eq "pnnum") { $string =~ s/[^0-9\+\-]//g; if ($string =~ /^([0-9\+\-]*)$/) { $string = $1; return $string; } else {return 0;} } elsif ($type eq "anumazcsdaus") { $string =~ s/[^a-zA-Z0-9\_\-]//g; if ($string =~ /^([a-zA-Z0-9\_\-]*)$/) { $string = $1; return $string; } else {return 0;} } elsif ($type eq "pnixusername") { $string =~ s/[^a-zA-Z0-9\.\_\-\@]//g; if ($string =~ /^([a-zA-Z0-9\.\_][a-zA-Z0-9\.\_\-\@]*)$/) { $string = $1; return $string; } else {return 0;} } elsif ($type eq "x2gosid") { $string =~ s/[^a-zA-Z0-9\.\_\-\@]//g; if ($string =~ /^([a-zA-Z0-9\.\_\-\@]*)$/) { $string = $1; if ($string =~ /^([a-zA-Z0-9\.\_][a-zA-Z0-9\.\_\-\@]*)\-([\d]{2,4})\-([\d]{9,12})\_[a-zA-Z0-9\.\_\-]*\_dp[\d]{1,2}$/) { return $string; } else {return 0;} } else {return 0;} } elsif ($type eq "SOMETHINGELSE") { return 0; } else { return 0; } } sub clups { my $string = "@_"; $string =~ s/\n//g; $string =~ s/\ //g; $string =~ s/\s//g; return $string; } sub system_capture_stdout_output { my $cmd = shift; my @args = @_; syslog("debug", "executing external command ,,$cmd'' with args: ".join(",", @args)); my ($stdout, $stderr, @result) = capture { system( $cmd, @args ); }; return $stdout; } sub system_capture_merged_output { my $cmd = shift; my @args = @_; syslog("debug", "executing external command ,,$cmd'' with args: ".join(",", @args)); return capture_merged { system( $cmd, @args ); }; } sub check_x2go_sessionid { if (sanitizer("x2gosid",$ARGV[0])) { return sanitizer("x2gosid",$ARGV[0]); } elsif (sanitizer("x2gosid",$ENV{'X2GO_SESSION'})) { return sanitizer("x2gosid",$ENV{'X2GO_SESSION'}); } else { die "No X2Go Session ID in ARGV or ENV!\n"; } } 1; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������