[X2Go-Commits] [x2goserver] 03/03: x2goserver/bin/x2gostartagent: use x2goagent.port_randomization configuration value.
git-admin at x2go.org
git-admin at x2go.org
Mon Jan 1 06:12:01 CET 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch release/4.0.1.x
in repository x2goserver.
commit c07225145f43c34217c11549ed986b86e7242e8a
Author: Mihai Moldovan <ionic at ionic.de>
Date: Mon Jan 1 06:04:30 2018 +0100
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.
---
debian/changelog | 4 ++++
x2goserver/bin/x2gostartagent | 18 +++++++++---------
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 2074b7c..abaa2da 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,10 @@ x2goserver (4.0.1.23-0x2go1) UNRELEASED; urgency=medium
- 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.spec:
- RPMify x2goserver-xsession description.
- Remove qt4 stuff, we're not using the framework here.
diff --git a/x2goserver/bin/x2gostartagent b/x2goserver/bin/x2gostartagent
index ad82703..15e44ee 100755
--- a/x2goserver/bin/x2gostartagent
+++ b/x2goserver/bin/x2gostartagent
@@ -68,20 +68,20 @@ X2GO_LIB_PATH="$(x2gopath libexec)";
$X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@"
-# FIXME: this should be configurable option in x2goserver.conf.
-# If you use hosts on a /24 network, you should probably set "0" here,
-# as the addresses are unique.
-# Each hosts SSH_PORT will be set to 30.000 + (128 * last octet of IP address)
-# This results in no collisions on a /24 network with at least 128 ports
-# for each host available for different sessions.
-# If you select "1" here, the SSH_PORT will be set to 30000 + random(0..32767)
+# 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" "SSH port randomization requested."
+ ${X2GO_LIB_PATH}/x2gosyslog "$0" "debug" "Full SSH port randomization requested."
SSH_PORT="$(get_random_port)"
else
- ${X2GO_LIB_PATH}/x2gosyslog "$0" "debug" "IP-based SSH port initialization requested."
+ ${X2GO_LIB_PATH}/x2gosyslog "$0" "debug" "host-based SSH port initialization requested."
typeset ip_address="$(get_server_ip_address)"
if [ "$?" = "0" ]; then
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
More information about the x2go-commits
mailing list