Commit Graph

149 Commits

Author SHA1 Message Date
matt335672
660ac303f0 Replace various types used for auth_info
The loadable sesman authentication modules use different types for the
authentication handle returned from auth_userpass(). The PAM module
uses a pointer, and the other modules use (effectively) a boolean. Within
sesman itself, a long or tbus (intptr_t) is used.

This PR replaces all of these types with a pointer to an incomplete type.

Consequently:-
- A single better-labelled type is used it all places within sesman so
  it's more obvious what's being handled.
- There is no need to cast the authentication handle within the PAM
  module to a long and back again.
- The compiler can check function signatures between auth.h and the
  various verify modules.
2022-09-16 10:46:53 +01:00
a1346054
7fe18cc1c0
fix typos 2022-09-03 02:01:48 +00:00
Koichiro IWAO
2c25e60abc
sesman: fix spacing in log
[20220301-18:25:01] [INFO ] Starting window manager on display 12from user home directory: /home/user/startwm.sh
                                                                ^^
2022-05-28 01:27:47 +09:00
matt335672
3e488773d7 Updated session allocation policy for sesman
Made session allocation policies more readable and maintainable.

The 'C' policy which was confusing before has been replaced with the
'Separate' keyword. This is a public interface change, but is unlikely
to affect many users.

The logging in session_get_bydata() is substantially improved, making
it far easier to spot why sessions are getting matched or not matched.
2022-05-18 12:35:07 +01:00
matt335672
79bec8110c Unify connection fields for the connected client
The connected client is currently described in two places in
the xrdp_client_info structure:-

1) In the connection_description field. This was introduced as
   field client_ip by commit d797b2cf49
   for xrdp v0.6.0

2) In the client_addr and client_port fields introduced by commit
   25369460a1 for xrdp v0.8.0

This commit unifies these two sets of fields into a single
set of fields describing the connection IP and port (for
AF_INET/AF_INET6 connections only) and a connection description
for all connection types.

The code in os_calls to provide client logging has been simplified
somewhat which should make it easier to add new connection types (e.g.
AF_VSOCK).

The old connection_description field used to be passed to sesman to
inform sesman of the IP address of the client, and also to provide
a string for 'C' field session policy matching. 'C' field session policy
matching does not actually need this string (see #2239), and so now only
the IP field is passed to sesman.
2022-05-18 12:35:07 +01:00
matt335672
4183d8ddbf Moved initgroups call to before auth_start_session()
This is required for PAM systems that depend on group membership being
available during PAM processing. This is used by pam_group on FreeBSD
and pam_group on Linux-PAM, although the functionality of both is
different.
2022-04-05 16:07:26 +01:00
matt335672
c0cb03801c Move sesman to new SCP interface 2022-03-15 10:45:00 +00:00
matt335672
8bd597a038 Fix signal handling in sesman 2022-03-04 11:37:45 +00:00
matt335672
fcd991844a sesman : Move global declarations to sesman.h 2022-03-03 17:01:55 +00:00
matt335672
8b9b22c773 Create shared GUID module to simplify session guid handling 2021-11-25 13:29:55 +00:00
matt335672
5fb621ca53 Logged IP address for fail2ban on login failure 2021-10-25 11:35:35 +01:00
matt335672
60016c1f75 Rename client_ip to connection_description 2021-10-25 11:35:35 +01:00
matt335672
d4c81229ba Module testing now OK 2021-07-27 13:36:34 +01:00
Jay Sorg
738e346f81 sesman: work on moving sesman to trans, v0 scp working 2021-07-27 13:35:43 +01:00
Alexandre Quesnel
52707ac686 Fixing formatting with astyle 2021-05-08 16:58:11 +00:00
Alexandre Quesnel
cbf6adb4be Adding logs to sesman/session.c 2021-04-14 04:41:54 +00:00
matt335672
0a1a8f40e5 Moved a lot of string funcs to string_calls module 2020-12-22 11:57:24 +00:00
metalefty
785db575ca
Merge pull request #1751 from matt335672/address-minor-user-comments
Cosmetic fixes for minor issues
2020-12-21 16:12:58 +09:00
Koichiro IWAO
31214f15a6
sesman: reflect review suggestions on cleanup_sockets
* Use LOG_LEVEL_WARNING for the deletion failure
* Log the error condition when the deletion failed
2020-12-21 13:28:53 +09:00
Koichiro IWAO
5114d1ee64 sesman: address the issue of socket file leftovers
There are two points.

Make sure cleanup files happen after chansrv and Xserver exit. If these
child processes lock socket files, the deletion might fail.

Usually, cleanup of xorgxrdp related socket files is handled by
xorgxrdp. Just in case it failed, perform cleanup also in sesman.

Fixes #1740. Thanks to @matt335672.

Sponsored by:   Cybertrust Japan
Sponsored by:   HAW International
2020-12-18 18:30:49 +09:00
matt335672
7ddc43aeea Cosmetic fixes for minor issues 2020-12-14 11:35:31 +00:00
Alexandre Quesnel
0c61a15fc5 Migrating logging to LOG() and LOG_DEVEL() in sesman/* 2020-11-30 00:36:20 +00:00
D.V.Yacenko
a6a785d7a4
Allow parameters for XRDP run bash script
Allows run bash script with parameters on xrdp. For example rdesktop -s "myscript.sh params"
2020-10-22 16:12:55 +01:00
Alexandre Quesnel
a9ec1ebd99 Unifying logging in chanserv
This commit adds:
* replace multiple logging macros with LOG and LOG_DEVEL
* logging configuration for chanserv
* logging configuration for console output
* logging configuration for per file or method log level filtering for
debug builds
* file, line, and method name in log message for debug builds
2020-10-19 05:10:47 +00:00
matt335672
edda1b064d chansrv improved config support 2020-09-08 16:58:03 +01:00
matt335672
3c4b42b1aa Implemented resize and multimon support for VNC backend 2020-06-04 15:10:35 +01:00
Jaroslaw Osmanski
56fe961349 Fixed style and format issues. 2019-03-08 08:42:18 +01:00
Jaroslaw Osmanski
7d7e8184ae Use CHANSRV_RESTRICT_OUTBOUND_CLIPBOARD env between sesman -> chansrv 2019-03-02 16:53:15 +01:00
Koichiro IWAO
9192e95c96
sesman: fix logging after default_wm change 2018-06-16 16:44:37 +09:00
Koichiro IWAO
a39b413746
sesman: make the path of reconnect script configurable 2018-06-16 16:44:37 +09:00
Koichiro IWAO
e82f212f34
sesman: accept full path for DefaultWindowManager
Solves: #1143

Also, this idea is inspired by Fedora's patch [1]. Some distro wants to
put all scripts in libexec directory due to SELinux. This enables
distros to put such scripts anywhere.

[1] https://src.fedoraproject.org/cgit/rpms/xrdp.git/tree/xrdp-0.9.6-scripts-libexec.patch?id=02f845c1b8cea781313cf3e9efcd6d7d50341824
2018-06-16 16:44:37 +09:00
matt335672
cde5b09129 Copy the PAM session environment for the reconnect script
This provides access to variables set at login which may be
required by the script (e.g. KRB5CCNAME)
2018-05-31 10:54:38 +01:00
Koichiro IWAO
c50015122c
FreeBSD: rework setsid code
Pull request #650 is not valid to avoid run session twice.
It certainly stops running session twice but causes #1016.

In FreeBSD, sesman process will run like this. The intermediate
sesman is needed to detect session termination correctly.

xrdp-sesman (daemon)
    |
    +- xrdp-sesman (FreeBSD specific intermediate sesman)
        |
        +- xrdp-sesman (bsd sesion leader & each session)
             |
             +- Xorg
             +- startwm.sh
             +- xrdp-chansrv

To stop runninng session twice correctly, just exit before the
intermediate sesman executes Xorg, WM and chansrv.
2018-02-06 16:03:10 +09:00
Koichiro IWAO
08f847d74b
sesman: refactor, change variable names
session_variables1 -> env_names
session_variables2 -> env_values

Use the name used in callee function env_set_user(). The former names
are not clear.
2018-01-11 10:57:47 +09:00
Koichiro IWAO
dcf64e43ca
remove trailing space 2018-01-11 10:57:43 +09:00
Koichiro IWAO
26394870e5 sesman: delete socket files when session exits 2017-09-13 09:04:58 +09:00
Jay Sorg
b6bd8acef1 sesman: move auth_start_session, auth_stop_session, and auth_end to child process 2017-07-12 17:58:36 +09:00
Pavel Roskin
148afd1170 Rename file_loc.h to xrdp_sockets.h, install it
Include xrdp_sockets.h directly, not through headers.
2017-03-28 00:59:16 -07:00
Jay Sorg
4b8a33e087 sesman: move auth/pam calls to main process 2017-03-21 21:56:28 -07:00
Jay Sorg
05c599666d sesman: remove sessvc, one less process to manage 2017-03-19 17:16:36 -07:00
Pavel Roskin
58c9cb43e9 Make socket directory configurable, don't hardcode /tmp/.xrdp
Use XRDP_SOCKET_PATH in file_loc.h

Don't define any non-socket paths in file_loc.h, they should come from
the makefiles.

Define all paths unconditionally, they should not be defined elsewhere.

Pass XRDP_SOCKET_PATH as environment variable to the backends.
2017-03-17 22:25:05 -07:00
Pavel Roskin
6ed4c969f4 Eliminate APP_CC and DEFAULT_CC 2017-03-14 00:21:48 -07:00
metalefty
cc48345f40 sesman: remove unnecessary fork for FreeBSD (#650)
it is not only unnecessary but causes another bug.
2017-01-28 21:14:55 +09:00
mirabilos
6257bae23f Add GNU/kFreeBSD support (#645)
* GNU/kFreeBSD is a FreeBSD variant, for code purposes.

* GNU/kFreeBSD uses GNU/Linux-ish init scripts, however.
2017-01-26 23:02:41 -02:00
Pavel Roskin
6664aac00f Use "void" for empty argument list in declarations
In C, an empty argument list in a declaration means that the function
can accept any arguments. Use "void" instead, it means "no arguments".

C++ treats void and empty list as "no arguments".
2017-01-05 17:27:20 -08:00
BLINDAUER Emmanuel
2927eed74c - Update copyright
- remove test on filename for xauth as we know what we send
- better names for variables in xauth
- if xauth fails, exit sesman
- g_bytes_to_hexstr returns a null-teminated string, don't set it twice.
2016-12-15 22:45:12 +01:00
BLINDAUER Emmanuel
b2f4f68ab8 - move function related to xauth in own file
- use of g_bytes_to_hexstr()
- correct typos and coding syntax
- don't create auth file, xauth can do that if needed
2016-12-15 18:06:35 +01:00
BLINDAUER Emmanuel
e72957b7c9 xauth: use the authfile if not using default value 2016-12-14 10:55:45 +01:00
BLINDAUER Emmanuel
7d1fdd04b5 Cosmetic change: follow coding standard 2016-12-14 08:28:25 +01:00
BLINDAUER Emmanuel
16b6471d88 use the correct size for snprintf 2016-12-14 07:16:06 +01:00