Commit Graph

4053 Commits

Author SHA1 Message Date
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
a16695efd4 Added unit tests for bitmask<->charstr calls 2022-05-18 12:35:07 +01:00
matt335672
61bfb264de Add bitmask to character string conversions 2022-05-18 12:35:07 +01:00
matt335672
c1d2dcfc7f Cosmetic fixes to string_calls 2022-05-18 12:35:07 +01:00
matt335672
a4c6c36cf2 Add PAM_RHOST support
Supplies the IP address that an authentication event is
received from as the PAM parameter PAM_RHOST for PAM-capable systems.
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
608d91a68b
Merge pull request #2266 from matt335672/wyse_thin_client
Improve RDS compatibility
2022-05-18 12:25:47 +01:00
matt335672
8fdc1ba216 Relaxed Channel Join PDU requirements for non-TLS
Windows 10 RDS is quite relaxed about missing channel join PDUs,
whereas we have to adhere quite tightly to the specification to
make sure we get a TLS "Client hello" where appropriate. This makes
us incompatible with older RDP clients. For example, the Wyse sx0
thin client does not send a channel join PDU for the user channel.
Older, non-TLS versions of xrdp supported these devices.

This commit re-implements the xrdp v0.6.1 behaviour for non-TLS
connections only, allowing system administrators to use these devices
on trusted networks. These devices are in any case too old to
establish a modern TLS connection.
2022-05-18 12:18:23 +01:00
matt335672
6838643494 Log connected client version 2022-05-18 12:18:23 +01:00
matt335672
28da2045d9 Send MS-compatible user channel
The Windows 10 RDS sets the user channel ID to be one more than the
ID of the last allocated static virtual channel. Currently we set it to
1002 (0x03ea) which is allocated to the server channel. This change
makes xrdp emulate RDS more closely.
2022-05-18 12:18:23 +01:00
matt335672
7eb44bd54c Update channel logging 2022-05-18 12:18:23 +01:00
matt335672
95f7a79b61
Merge pull request #2268 from matt335672/fix_autoconf_runstatedir
Cater for missing --runstatedir in autoconf 2.69
2022-05-18 09:05:34 +01:00
matt335672
d77de66c26 Cater for missing --runstatedir in autoconf 2.69 2022-05-17 12:15:53 +01:00
matt335672
6686cbf946
Merge pull request #2257 from matt335672/allow_static_only
Allow xrdp to be built with --disable-static
2022-05-11 09:57:44 +01:00
matt335672
978be50842 Allow xrdp to be built with --disable-static
This PR allows xrdp to be built with --disable-static, which prevents
'make install' installing additional unwanted .a files.
2022-05-10 12:12:14 +01:00
metalefty
df425c23c4
Merge pull request #2241 from metalefty/version
Change development version to 0.9.80
2022-05-10 17:28:02 +09:00
matt335672
9033066756
Merge pull request #2256 from matt335672/update_rfxcodec
Merge rfxcodec staging changes for GFX
2022-05-09 10:35:56 +01:00
matt335672
be8ae4677a Merge rfxcodec staging changes for GFX 2022-05-09 10:21:01 +01:00
matt335672
34fe9b60eb
Merge pull request #1983 from matt335672/pam_group_fix
Moved g_initgroups() call to before auth_start_session()
2022-05-04 09:29:15 +01:00
matt335672
43c52b1fad
Merge pull request #2235 from matt335672/uds_regression_warning
(UDS) Don't ask user to remove IP setting for VNC connection
2022-05-04 09:27:02 +01:00
matt335672
e6ff36f1b4
Merge pull request #2247 from matt335672/remove_tcp_sock_from_chansrv
Remove TCP socket support from chansrv (part of UDS migration)
2022-05-04 09:26:36 +01:00
matt335672
8f1bdaa95e Remove TCP socket support fron chansrv
The code in xrdp_mm.c to connect to chansrv over a TCP socket has
been removed, with the move to UDS. This PR simply removes the
chansrv TCP listening code. Without doing this, some configurations
result in a failure of xrdp to connect to chansrv.
2022-05-03 10:57:41 +01:00
Koichiro IWAO
017d18c045 Change development version to 0.9.80
This idea is inspired by TigerVNC.
2022-04-26 16:23:52 +09:00
matt335672
7868622a79
Merge pull request #2216 from matt335672/fix_stream_overflow_in_sextuple_monitor_happy_path_test
Fixes a stream overflow in the test suite
2022-04-20 12:43:37 +01:00
matt335672
2dc01f2749 Don't ask user to remove IP setting for VNC connection 2022-04-20 11:08:51 +01:00
matt335672
6a6f7bb83e
Merge pull request #2233 from matt335672/uds_fix_ip
Fix regression introduced with UDS
2022-04-20 09:53:39 +01:00
matt335672
902c951648 Fix regression introduced with UDS 2022-04-20 09:40:36 +01:00
matt335672
829106d793
Merge pull request #2219 from matt335672/off_by_one
Fix off-by-one errors in monitor resize logic
2022-04-19 09:11:58 +01:00
jsorg71
fd3f81e720
Merge pull request #2231 from jsorg71/va_arg
va_list parameter passing change
2022-04-18 11:53:32 -07:00
matt335672
dd4abcb27a
Merge pull request #2207 from matt335672/move_to_uds
Move to Unix Domain Socket for SCP (sesman)
2022-04-18 09:25:59 +01:00
matt335672
0db849fc5c Move SCP to a Unix Domain Socket
The TCP socket implementation of sesman has a number of limitations,
namely that it is affected by firewalls, and also that determining the
user on the other end requires a full authentication process.

The advantage of the TCP socket is that sesman and xrdp can be run on
separate machines. This is however not supported by the xorgxrdp
backend (shared memory), and is insecure, in that passwords are sent
in-the-clear, and the connection is susceptible to MitM attacks. This
architecture has been deprecated in release notes since xrdp v0.9.17,
and although it will continue to be supported in any further releases
in the x0.9.x series, it will not be supported in the next major
version.
2022-04-18 09:12:35 +01:00
matt335672
9c30d4c2f8 Add lock_uds module to sesman
When sesman used a standard TCP socket, we were guaranteed only one copy
of sesman could run on on address, as standard TCP listening rules
enforced this. This isn't the case with Unix Domain sockets. This
module implements a locking mechanism for a UDS which emulates the
standard TCP socket behaviour.
2022-04-18 09:09:46 +01:00
Jay Sorg
b91b9a3c62 va_list parameter passing change 2022-04-17 00:18:29 -07:00
matt335672
0a54106866 Added g_umask_hex() call 2022-04-15 11:12:01 +01:00
matt335672
4bfeddbbed
Merge pull request #2226 from matt335672/freebsd12_3
Bump FreeBSD CI version to 12.3
2022-04-15 11:11:02 +01:00
matt335672
54c2cab5ff Bump FreeBSD CI version to 12.3 2022-04-15 11:00:25 +01:00
matt335672
ffc6fa66a0
Merge pull request #2204 from matt335672/trans_connect
Rework transport connect logic
2022-04-15 10:33:11 +01:00
matt335672
7cfd3bb3d8 Fix off-by-one errors in monitor resize logic 2022-04-08 12:11:14 +01:00
matt335672
94a6f6282f Fixes a stream overflow in the test suite
This is triggered when xrdp is built with --enable-devel-logging

Also, the logging sub-system is initialised for libxrdp tests
2022-04-06 11:59:23 +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
dc72ca269b Set closed RDP socket to -1 rather than 0 2022-04-01 13:00:33 +01:00
matt335672
1d190c6ea8 Prevent unnecessary close of sck = -1 in trans_listen_address() 2022-04-01 11:51:11 +01:00
matt335672
275eaf7683 Rework transport connect logic
There are a number of ways the existing transport connect logic in
trans_connect could be improved for POSIX compatibility, and also
slightly tidied up:-
1) The same socket is re-used for multiple connect attempts following
   failure which isn't behaviour defined by POSIX.1-2017 (although it
   works on Linux).
2) An asynchronous connect is started, and then after a short
   delay connect() is called again on the same socket. POSIX.1-2017
   is clear that in this situation EALREADY is returned before the
   connection is established, but is silent on the behaviour expected
   when the connection is established. Returning success is an option,
   but so is returning EISCONN. The current code assumes the connect()
   call will succeed.
3) The code contains two virtually identical, quite complex loops for
   TCP and UNIX sockets, differing only in the calls to create a socket
   and connect it.
4) trans_connect() contains looping and retry logic, but this isn't
   seen as sufficient by the chansrv connect code in xrdp/xrdp_mm.c and
   the Xorg connect code in xup/xup.c. Both of these implement their own
   looping and retry logic on top of the logic in trans_connect(),
   resulting in slightly unpredictable behaviour with regard to
   timeouts.
5) A socket number can technically be zero, but in a couple of places
   this isn't allowed for.

This PR attempts to correct the implementation of trans_connect(),
and also to simplify the areas it is called from.

As part of the PR, the signature of the server_is_term member of the
xrdp module interface is changed to match the signature expected by the
is_term member of a struct trans. This allows for trans_connect()
in xrdp modules to directly access g_is_term() within the main xrdp
executable. At the moment this functionality is only used by the xup
module.
2022-03-31 20:48:07 +01:00
matt335672
cd1af4772c
Merge pull request #2201 from matt335672/neutrinordp_regression
Fix neutrinordp regression caused by bd9147d1
2022-03-29 10:59:15 +01:00
matt335672
d2be050911 Fix neutrinordp regression caused by bd9147d18f 2022-03-29 10:40:32 +01:00
matt335672
bf16cb5f2a
Merge pull request #2198 from matt335672/start_log_before_config
Open log in sesman before reading config
2022-03-29 09:34:16 +01:00
matt335672
46e23ebcab
Merge pull request #1895 from Nexarian/unify_monitor_description_processing_resize_sec
Unify monitor processing logic.
2022-03-29 09:32:39 +01:00
matt335672
104304aad1 Open log in sesman before reading config 2022-03-28 19:00:23 +01:00
Christopher Pitstick
bd9147d18f Updating to refactor xrdp_client_info
- Eliminate duplicaiton for display_size_description
- monitorCount needs to be uint32_t
- width/height -> session_width/session_height
- Update CLIENT_INFO_CURRENT_VERSION
- Also some misc unit test updates.
- Minor log updates.
2022-03-27 16:38:32 -04:00
Christopher Pitstick
4a0db63be7 Unify monitor processing logic.
There are two places where monitor descriptions are passed through the
RDP protocol:

- TS_UD_CS_MONITOR ([MS-RDPBCGR] 2.2.1.3.6 Client Monitor Data)
- DISPLAYCONTROL_PDU_TYPE_MONITOR_LAYOUT ([MS-RDPEDISP] 2.2.2.2)

The processing logic for both of them is similar enough that they should be unified.

Also update to define the constants for the maximum and minimum desktop width/height for monitors and total area.

Also a large number of clarifications for the constants and protocol
requirements.

Note that this is also the first step to making resizing work with the extension GFX channel as well as an important
foundational step to enable HiDPI compatibility.

Also some misc logging updates.
2022-03-26 23:45:16 -04:00