#!/bin/sh
java.lang.NullPointerException # xrdp: A Remote Desktop Protocol server.
java.lang.NullPointerException # Copyright (C) Jay Sorg and contributors 2004-2024
java.lang.NullPointerException # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at
java.lang.NullPointerException # http://www.apache.org/licenses/LICENSE-2.0
java.lang.NullPointerException # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.
java.lang.NullPointerException # Program to check permissions for xrdp when running in a non-privileged # mode
# Change these if they donot match your installation
CONF_DIR=@sysconfdir@/@sysconfsubdir@
XRDP_INI="$CONF_DIR"/xrdp.ini
SESMAN_INI="$CONF_DIR"/sesman.ini
RSAKEYS_INI="$CONF_DIR"/rsakeys.ini
DROPPRIV=@pkglibexecdir@/xrdp-droppriv
# Helper functions to print colored tag like "[ OK ]"
print_ok()
{ if [ -t 1 ]; then
printf "\033[1m[ \033[1;32mOK\033[0m ]\033[0m " else
printf "[ OK ] "
fi
}
print_warn()
{ if [ -t 1 ]; then
printf "\033[1m[ \033[1;33mWARN\033[0m ]\033[0m " else
printf "[ WARN ] "
fi
}
print_ng()
{ if [ -t 1 ]; then
printf "\033[1m[ \033[1;31mNG\033[0m ]\033[0m " else
printf "[ NG ] "
fi
}
# ----------------------------------------------------------------------------- # G E T I N I V A L U E
java.lang.NullPointerException # Gets a value from an ini file.
java.lang.NullPointerException # Params [ini_file] [key] # -----------------------------------------------------------------------------
GetIniValue()
{ # Look for a line matching 'key=' with optional whitespace # either side of the key. When we find one, strip everything # up to and including the first '=', print it, and quit
java.lang.NullPointerException # This doesn't take sections into account
sed -n -e '/^ *'"$2"' *=/{
s/^[^=]*=//p
q
}' "$1"
}
# ----------------------------------------------------------------------------- # M A I N # -----------------------------------------------------------------------------
if [ "$(id -u)" != 0 ]; then
print_ng
echo "** Must run this script as root" >&2 exit1
fi
OS=$(uname) case"$OS" in
FreeBSD | Linux) ;;
*) echo "Unsupported operating system $OS" >&2 exit1
esac
#Basicchecksonruntimeuser/group if[-z"$runtime_user"]&&[-z"$runtime_group"];then print_warn echo"Thissystemisnotconfiguredtorunxrdpwithoutprivilege" exit0 fi
if[-z"$runtime_user"]||[-z"$runtime_group"];then print_ng echo"Both'runtime_user'and'runtime_group'mustbeset" errors=$((errors+1)) exit1 fi
ifgetentpasswd"$runtime_user">/dev/null;then print_ok echo"runtime_user'$runtime_user'appearstoexist" else print_ng echo"runtime_user'$runtime_user'doesnotexist" errors=$((errors+1)) fi
GID= ifgetentgroup"$runtime_group">/dev/null;then print_ok echo"runtime_group'$runtime_group'appearstoexist" GID=$(getentgroupxrdp|cut-d:-f3) else print_ng echo"runtime_group'$runtime_group'doesnotexist" errors=$((errors+1)) fi
#Groupsagreebetweensesmanandxrdp? if["$runtime_user"="$SessionSockdirGroup"];then print_ok echo"xrdp.iniandsesman.iniagreeongroupownership" else print_ng echo"xrdp.iniandsesman.inidonotagreeongroupownership" errors=$((errors+1)) fi
#Checkwecanaccessrsakeys.ini # #Thisisourfile,sowecanbecompletelyprescriptiveabout #thepermissions if[-e$RSAKEYS_INI];then #OnlycheckifwehaveaGID if[-n"$GID"];then #Getthepermissions,UIDandGIDin$1..$3 case"$OS"in FreeBSD) #shellcheckdisable=SC2046 set--$(stat-f"%Lp%u%g"$RSAKEYS_INI) ;; *) #shellcheckdisable=SC2046 set--$(stat-c"%a%u%g"$RSAKEYS_INI) esac if["$1/$2/$3"="640/0/$GID"];then print_ok echo"$RSAKEYS_INIhascorrectpermissions" else if["$1"!=640];then print_ng echo"$RSAKEYS_INIshouldhavepermissions-rw-r-----" errors=$((errors+1)) fi if["$2"!=0];then print_ng echo"$RSAKEYS_INIshouldbeownedbyroot" errors=$((errors+1)) fi if["$3"!="$GID"];then print_ng echo"$RSAKEYS_INIshouldbeinthe$runtime_groupgroup" errors=$((errors+1)) fi fi fi else print_ng echo"$RSAKEYS_INIdoesnotexist" errors=$((errors+1)) fi
#Arecertandkeyreadable(butNOTwriteable)bytheuser? # #Thesearen'tnecessarilyourfiles,sowecan'tbetooprescriptiveabout #privileges.OnDebianforexample,wemightbeusingthe'ssl-cert' #grouptoobtainaccessto/etc/ssl/private/ssl-cert-snakeoil.key forfilein"$certificate""$key_file";do if![-e$file];then print_ng echo"$filedoesnotexist" errors=$((errors+1)) elif!$DROPPRIV"$runtime_user""$runtime_group"sh-c'[-r'"$file"']' then print_ng echo"$fileisnotreadableby$runtime_user:$runtime_group" errors=$((errors+1)) elif$DROPPRIV"$runtime_user""$runtime_group"sh-c'[-w'"$file"']' then print_ng echo"$fileiswriteableby$runtime_user:$runtime_group" errors=$((errors+1)) else print_ok echo"$fileisread-onlyfor$runtime_user:$runtime_group" fi done
echo if[$errors-eq0];then print_ok echo"-Summary-Permissionsappeartobecorrecttorunxrdpunprivileged" status=0 else print_ng echo"-Summary-$errorserror(s)found.Pleasecorrecttheseandtryagain" status=1 fi
exit$status
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.16Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-07-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.