在成功设置dockerized guacamole 0.9.8之后
- http://guac-dev.org/doc/gug/guacamole-docker.html
- http://kalzi.github.io/2015/guacamole-with-docker-containers/
使用下面的脚本并使用用户登录:guacadmin 密码:guacadmin 我能够设置用户和 rdp 连接。Guacamole 的 UI 可以直接通过 docker setup 脚本中配置的映射端口(在我的例子中为 8380)使用,也可以通过根据 guacamoles 手册配置的反向 apache 代理使用:
<Location /guac/ >
Order allow,deny
Allow from all
ProxyPass http://localhost:8380/guacamole/ flushpackets=on
ProxyPassReverse http://localhost:8380/guacamole/
</Location>
我尝试按照 rdp 连接手册 http://guac-dev.org/doc/gug/configuring-guacamole.html#rdp
但是当使用反向代理时,结果是:
这也发生在其他用户身上,请参阅:
https://sourceforge.net/p/guacamole/discussion/1110834/thread/73abbe35/
我如何调试这种情况以找到正确的设置?
似乎有些可疑,因为作为管理员,例如 guacadmin,我 在尝试在以下对话框中启用和保存连接权限时确实得到了:
我可以访问用于权限的 mysql 数据库,例如
mysql> show tables;
+---------------------------------------+
| Tables_in_guacamole_db |
+---------------------------------------+
| guacamole_connection |
| guacamole_connection_group |
| guacamole_connection_group_permission |
| guacamole_connection_history |
| guacamole_connection_parameter |
| guacamole_connection_permission |
| guacamole_system_permission |
| guacamole_user |
| guacamole_user_permission |
+---------------------------------------+
这是我使用的鳄梨酱的 Dockerizing 脚本
#!/bin/bash
#
# WF 2015-10-26
#
# Guacamole (semi) automatic setup of guacamole Remote Desktop server for docker
# see
# http://guac-dev.org/doc/gug/guacamole-docker.html
# http://kalzi.github.io/2015/guacamole-with-docker-containers/
#
# Since: 2015-10-26
#
# config variables
# images
GUAC=glyptodon/guacamole
GUACD=glyptodon/guacd
MYSQL=mysql
# DB settings
DB=guacamole_db
DB_USER=guacamole_user
# prefix to be used for container names
prefix="lab"
#ansi colors
#http://www.csc.uvic.ca/~sae/seng265/fall04/tips/s265s047-tips/bash-using-colors.html
blue='\033[0;34m'
red='\033[0;31m'
green='\033[0;32m' # '\e[1;32m' is too bright for white bg.
endColor='\033[0m'
#
# a colored message
# params:
# 1: l_color - the color of the message
# 2: l_msg - the message to display
#
color_msg() {
local l_color="$1"
local l_msg="$2"
echo -e "${l_color}$l_msg${endColor}"
}
#
# error
#
# show an error message and exit
#
# params:
# 1: l_msg - the message to display
error() {
local l_msg="$1"
# use ansi red for error
color_msg $red "Error: $l_msg" 1>&2
exit 1
}
#
# show usage
#
usage() {
echo "usage: guac-setup"
# -h|--help|usage|show this usage
echo " -h|--help: show this usage"
# -m|--mysql|run mysql in linked container
echo " -m|--mysql:run mysql in linked container"
# -r|--run|run|run guacamole
echo " -p|--pull: pull guacamole"
echo " -pf|--prefix: set the containername prefix"
echo " -r|--run: run guacamole"
color_msg $blue "Example:"
echo " sudo ./guac-setup -p -pf test -r"
exit 1
}
#
# generate a random password
#
random_password() {
date +%N | sha256sum | base64 | head -c 16 ; echo
}
#
# run mysql in container
#
mysql_from_container() {
local l_option="$1"
local l_db="$2"
local l_dbparam=""
if [ "$l_db" != "" ]
then
l_dbparam=" $l_db"
fi
local l_cmd='exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'"$l_dbparam"
#echo "$l_cmd"
docker run $l_option --link $prefix-mysql:mysql --rm mysql sh -c "$l_cmd"
}
#
# initialize the database
#
init_db() {
local l_tmp=/tmp/initdb.sql
#docker run -it $GUAC /bin/bash
color_msg $blue creating database
cat << EOF | mysql_from_container -i
DROP DATABASE IF EXISTS $DB;
CREATE DATABASE IF NOT EXISTS $DB;
DROP USER '${DB_USER}';
CREATE USER '${DB_USER}' IDENTIFIED BY '${DB_PASSWD}';
GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole_user';
FLUSH PRIVILEGES;
EOF
color_msg $blue "getting initdb.sh"
docker run --rm $GUAC /opt/guacamole/bin/initdb.sh --mysql > $l_tmp
color_msg $blue "initializing database"
# pipe the result thru mysql
cat $l_tmp | mysql_from_container -i "$DB"
color_msg $blue "keeping password for db $DB at /var/lib/mysql/guac_passwd"
#echo $DB_PASSWD
echo $DB_PASSWD | docker exec -i $prefix-mysql /usr/bin/tee /var/lib/mysql/guac_passwd > /dev/null
}
#
# run guacamole
#
run () {
local l_prefix="$1"
MYSQL_ROOT_PASSWORD=`random_password`
color_msg $blue "starting $l_prefix-guacd"
docker run --name $l_prefix-guacd -d $GUACD
color_msg $blue "starting $l_prefix-mysql"
docker run --name $l_prefix-mysql -e MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD -d mysql:latest
docker ps -a --filter "name=$l_prefix*"
}
#
# pull images
#
pull() {
for image in $GUACD $GUAC $MYSQL
do
docker images | cut -c1-22 | grep $image
if [ $? -ne 0 ]
then
docker pull $image
else
color_msg $green "$image already pulled"
fi
done
}
#
# start it
#
startit() {
DB_PASSWD=`docker exec -i $prefix-mysql /bin/cat /var/lib/mysql/guac_passwd`
# now run the whole show
docker run --name $prefix-guacamole --link $prefix-guacd:guacd \
--link $prefix-mysql:mysql \
-e MYSQL_DATABASE=$DB \
-e MYSQL_USER=$DB_USER \
-e MYSQL_PASSWORD=$DB_PASSWD \
-d -p 8380:8080 $GUAC
}
# start of script
# check arguments
if [ $# -eq 0 ]
then
usage
fi
while test $# -gt 0
do
case $1 in
# -h|--help|usage|show this usage
-h|--help)
usage;;
# -p|--pull|pull|pull guacamole
-p|--pull)
pull;;
# -pf|--prefix|set containername prefix
-pf|--prefix)
shift
prefix=$1
;;
# -r|--run|run|run guacamole
-r|--run)
run $prefix;;
# -m|--mysql|run mysql connection to container
-m|--mysql)
mysql_from_container -it
;;
-ms|--mysql_shell)
docker exec -it $prefix-mysql /bin/bash
;;
-i|--initdb)
DB_PASSWD=`random_password`
init_db
;;
--setup)
pull
run $prefix
;;
--start)
startit
;;
esac
shift
done