diff options
-rw-r--r-- | net-misc/xrdp/Manifest | 1 | ||||
-rw-r--r-- | net-misc/xrdp/files/startwm.sh | 13 | ||||
-rw-r--r-- | net-misc/xrdp/files/xrdp-gcc8.patch | 15 | ||||
-rw-r--r-- | net-misc/xrdp/files/xrdp-initd | 28 | ||||
-rw-r--r-- | net-misc/xrdp/files/xrdp-oscalls.patch | 38 | ||||
-rw-r--r-- | net-misc/xrdp/files/xrdp-sesman.pamd | 4 | ||||
-rw-r--r-- | net-misc/xrdp/xrdp-0.9.22.1.ebuild | 140 |
7 files changed, 239 insertions, 0 deletions
diff --git a/net-misc/xrdp/Manifest b/net-misc/xrdp/Manifest new file mode 100644 index 0000000..71b1a96 --- /dev/null +++ b/net-misc/xrdp/Manifest @@ -0,0 +1 @@ +DIST xrdp-0.9.22.1.tar.gz 2059401 BLAKE2B 5bb6367f1a7cf97e5cd8156385ac204a903f9f6e6b67ba4a00fddaf78f3ad3bd545affeb7c982095bfafadd319138064058e0d3b75c11edcef2489897e9d1589 SHA512 a96f261bf9e3ecadbc305d265fb3384f4378627c1e518febd7a12e830218d73ff107615bfb591901f0b9c241203c14c9392dbd2dde053f687685af8961891d5f diff --git a/net-misc/xrdp/files/startwm.sh b/net-misc/xrdp/files/startwm.sh new file mode 100644 index 0000000..751c26a --- /dev/null +++ b/net-misc/xrdp/files/startwm.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# try hard to respect Gentoo's wm choice +. /etc/profile +[ -f /etc/rc.conf ] && . /etc/rc.conf +export XSESSION + +USERINITRC="$HOME/.xinitrc" +if [ -f "$USERINITRC" ]; then + . "$USERINITRC" +else + . /etc/X11/xinit/xinitrc +fi diff --git a/net-misc/xrdp/files/xrdp-gcc8.patch b/net-misc/xrdp/files/xrdp-gcc8.patch new file mode 100644 index 0000000..d6c94ae --- /dev/null +++ b/net-misc/xrdp/files/xrdp-gcc8.patch @@ -0,0 +1,15 @@ +--- a/common/log.c 2020-08-31 09:56:09.995682785 +0200 ++++ b/common/log.c 2020-08-26 04:32:21.000000000 +0200 +@@ -555,9 +555,10 @@ + now_t = time(&now_t); + now = localtime(&now_t); + +- snprintf(buff, 21, "[%.4d%.2d%.2d-%.2d:%.2d:%.2d] ", now->tm_year + 1900, ++ if (snprintf(buff, 21, "[%.4d%.2d%.2d-%.2d:%.2d:%.2d] ", now->tm_year + 1900, + now->tm_mon + 1, now->tm_mday, now->tm_hour, now->tm_min, +- now->tm_sec); ++ now->tm_sec) < 0) ++ *buff = '\0'; + + internal_log_lvl2str(lvl, buff + 20); + diff --git a/net-misc/xrdp/files/xrdp-initd b/net-misc/xrdp/files/xrdp-initd new file mode 100644 index 0000000..8f943e1 --- /dev/null +++ b/net-misc/xrdp/files/xrdp-initd @@ -0,0 +1,28 @@ +#!/sbin/openrc-run +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +depend() { + use net logger +} + +start() { + ebegin "Starting X remote desktop daemon" + start-stop-daemon --start --pidfile /var/run/xrdp.pid --exec /usr/sbin/xrdp > /dev/null + eend $? || return $? + + ebegin "Starting remote desktop session manager" + start-stop-daemon --start --pidfile /var/run/xrdp-sesman.pid --exec /usr/sbin/xrdp-sesman > /dev/null + eend $? +} + +stop() { + ebegin "Stopping X remote desktop daemon" + start-stop-daemon --stop --pidfile /var/run/xrdp.pid + eend $? + + ebegin "Stopping remote desktop session manager" + start-stop-daemon --stop --pidfile /var/run/xrdp-sesman.pid + eend $? +} diff --git a/net-misc/xrdp/files/xrdp-oscalls.patch b/net-misc/xrdp/files/xrdp-oscalls.patch new file mode 100644 index 0000000..95a9565 --- /dev/null +++ b/net-misc/xrdp/files/xrdp-oscalls.patch @@ -0,0 +1,38 @@ +--- a/common/os_calls.h 2020-06-26 13:13:58.000000000 +0200 ++++ b/common/os_calls.h 2020-12-28 15:03:43.000000000 +0100 +@@ -119,6 +119,26 @@ + int g_remove_dir(const char* dirname); + int g_file_delete(const char* filename); + int g_file_get_size(const char* filename); ++int g_strlen(const char* text); ++const char *g_strchr(const char *text, int c); ++char* g_strcpy(char* dest, const char* src); ++char* g_strncpy(char* dest, const char* src, int len); ++char* g_strcat(char* dest, const char* src); ++char* g_strdup(const char* in); ++char* g_strndup(const char* in, const unsigned int maxlen); ++int g_strcmp(const char* c1, const char* c2); ++int g_strncmp(const char* c1, const char* c2, int len); ++int g_strncmp_d(const char* c1, const char* c2, const char delim, int len); ++int g_strcasecmp(const char* c1, const char* c2); ++int g_strncasecmp(const char* c1, const char* c2, int len); ++int g_atoi(const char* str); ++int g_htoi(char* str); ++int g_bytes_to_hexstr(const void *bytes, int num_bytes, char *out_str, ++ int bytes_out_str); ++int g_pos(const char* str, const char* to_find); ++int g_mbstowcs(twchar* dest, const char* src, int n); ++int g_wcstombs(char* dest, const twchar* src, int n); ++int g_strtrim(char* str, int trim_flags); + long g_load_library(char* in); + int g_free_library(long lib); + void* g_get_proc_address(long lib, const char* name); +@@ -160,6 +179,7 @@ + int g_time3(void); + int g_save_to_bmp(const char* filename, char* data, int stride_bytes, + int width, int height, int depth, int bits_per_pixel); ++int g_text2bool(const char *s); + void * g_shmat(int shmid); + int g_shmdt(const void *shmaddr); + int g_gethostname(char *name, int len); + diff --git a/net-misc/xrdp/files/xrdp-sesman.pamd b/net-misc/xrdp/files/xrdp-sesman.pamd new file mode 100644 index 0000000..4712aa8 --- /dev/null +++ b/net-misc/xrdp/files/xrdp-sesman.pamd @@ -0,0 +1,4 @@ +auth include system-remote-login +account include system-remote-login +password include system-remote-login +session include system-remote-login diff --git a/net-misc/xrdp/xrdp-0.9.22.1.ebuild b/net-misc/xrdp/xrdp-0.9.22.1.ebuild new file mode 100644 index 0000000..b70117b --- /dev/null +++ b/net-misc/xrdp/xrdp-0.9.22.1.ebuild @@ -0,0 +1,140 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=7 + +inherit autotools eutils pam systemd + +DESCRIPTION="An open source Remote Desktop Protocol server" +HOMEPAGE="http://www.xrdp.org/" +SRC_URI="https://github.com/neutrinolabs/xrdp/releases/download/v${PV}/${P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86" +RESTRICT="mirror" +IUSE="debug fuse +ipv6 kerberos jpeg -neutrinordp pam +pulseaudio systemd +vsock +xorg -xrdpvr" + +RDEPEND="dev-libs/openssl:0= + pulseaudio? ( media-sound/pulseaudio:0= ) + x11-libs/libX11:0= + x11-libs/libXfixes:0= + x11-libs/libXrandr:0= + fuse? ( sys-fs/fuse:0= ) + jpeg? ( virtual/jpeg:0= ) + kerberos? ( virtual/krb5:0= ) + pam? ( sys-libs/pam:0= ) + neutrinordp? ( net-misc/freerdp:0= ) + xrdpvr? ( media-video/ffmpeg:0= )" +PDEPEND="xorg? ( net-misc/xorgxrdp )" +DEPEND="${RDEPEND} + app-arch/xz-utils + dev-lang/nasm" + +# RDEPEND="${RDEPEND} +# || ( +# net-misc/tigervnc:0[server,xorgmodule] +# net-misc/x11rdp:0 +# )" + +src_prepare() { + # don't let USE=debug adjust CFLAGS + sed -i -e 's/-g -O0//' configure.ac || die + # disallow root login by default + sed -i -e '/^AllowRootLogin/s/true/false/' sesman/sesman.ini || die + + # explicitly use Xorg - and not a fallback to Xorg.wrap, to allow non-console users + if [ -e '/usr/libexec/Xorg' ]; then + sed -i -e '/^param=/s!Xorg!/usr/libexec/Xorg!' sesman/sesman.ini || die + else + [ -u '/usr/bin/Xorg' ] && ewarn "Can't find an non-suid Xorg binary, xrdp requires this for proper functionality. Please specify path manually in /etc/xrdp/sesman.ini" + # sed -i -e '/^param=/s!Xorg!/usr/bin/Xorg!' sesman/sesman.ini || die + fi + + default + eautoreconf +} + +src_configure() { + use kerberos && use pam \ + && ewarn "Both kerberos & pam auth enabled, kerberos will take precedence." + + local myconf=( + # warning: configure.ac is completed flawed + + --localstatedir="${EPREFIX}"/var + + # -- authentication backends -- + $(use_enable pam) + $(use_enable kerberos) + # pam_userpass is not in Gentoo at the moment + #--disable-pamuserpass + + # -- jpeg support -- + $(use_enable jpeg) + # the package supports explicit linking against libjpeg-turbo + # (no need for -ljpeg compat) + $(use jpeg && has_version 'media-libs/libjpeg-turbo:0' && echo --enable-tjpeg) + + # -- others -- + $(use_enable debug debug-all) + $(use_enable fuse) + $(use_enable ipv6) + $(use_enable neutrinordp) + $(use_enable vsock) + $(use_enable xrdpvr) + + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" + ) + + econf "${myconf[@]}" +} + +src_install() { + default + find "${ED}" -name '*.la' -delete || die + + # use our pam.d file since upstream's incompatible with Gentoo + use pam && newpamd "${FILESDIR}"/xrdp-sesman.pamd xrdp-sesman + # and our startwm.sh + exeinto /etc/xrdp + doexe "${FILESDIR}"/startwm.sh + + # own /etc/xrdp/rsakeys.ini + : > rsakeys.ini + insinto /etc/xrdp + doins rsakeys.ini + + # contributed by Jan Psota <jasiupsota@gmail.com> + newinitd "${FILESDIR}/${PN}-initd" ${PN} +} + +pkg_preinst() { + # either copy existing keys over to avoid CONFIG_PROTECT whining + # or generate new keys (but don't include them in binpkg!) + if [[ -f ${EROOT}/etc/xrdp/rsakeys.ini ]]; then + cp {"${EROOT}","${ED}"}/etc/xrdp/rsakeys.ini || die + else + einfo "Running xrdp-keygen to generate new rsakeys.ini ..." + "${S}"/keygen/xrdp-keygen xrdp "${ED}"/etc/xrdp/rsakeys.ini \ + || die "xrdp-keygen failed to generate RSA keys" + fi +} + +pkg_postinst() { + # check for use of bundled rsakeys.ini (installed by default upstream) + if [[ $(cksum "${EROOT}"/etc/xrdp/rsakeys.ini) == '2935297193 1019 '* ]] + then + ewarn "You seem to be using upstream bundled rsakeys.ini. This means that" + ewarn "your communications are encrypted using a well-known key. Please" + ewarn "consider regenerating rsakeys.ini using the following command:" + ewarn + ewarn " ${EROOT}/usr/bin/xrdp-keygen xrdp ${EROOT}/etc/xrdp/rsakeys.ini" + ewarn + fi + + elog "Various session types require different backend implementations:" + elog "- sesman-Xvnc requires net-misc/tigervnc[server,xorgmodule]" + elog "- sesman-X11rdp requires net-misc/x11rdp" +} |