Changes as requested

This commit is contained in:
Michel Roegl-Brunner 2024-12-04 11:58:41 +01:00
parent dd90d1560b
commit 7da447d1b9
3 changed files with 37 additions and 50 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/michelroegl-brunner/ProxmoxVE/refs/heads/dev/misc/build.func) source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/refs/heads/main/misc/build.func)
# Copyright (c) 2021-2024 community-scripts ORG # Copyright (c) 2021-2024 community-scripts ORG
# Author: Michel Roegl-Brunner (michelroegl-brunner) # Author: Michel Roegl-Brunner (michelroegl-brunner)
# License: MIT # License: MIT

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#Copyright (c) 2021-2024 community-scripts ORG #Copyright (c) 2021-2024 community-scripts ORG
# Author: Michel Roegl-Brunner (michelroegl-brunner) # Author: Michel Roegl-Brunner (michelroegl-brunner)
# License: MIT # License: MIT
@ -41,16 +40,16 @@ $STD apt-get install -y \
default-jdk default-jdk
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Install Tomcat" msg_info "Setup Apache Tomcat"
mkdir /opt/${APPLICATION} mkdir /opt/apache-guacamole
mkdir /opt/${APPLICATION}/tomcat9 mkdir /opt/apache-guacamole/tomcat9
$STD wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.97/bin/apache-tomcat-9.0.97.tar.gz wget -q https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.97/bin/apache-tomcat-9.0.97.tar.gz
$STD tar xzf apache-tomcat-9.0.97.tar.gz -C /opt/${APPLICATION}/tomcat9 --strip-components=1 $STD tar xzf apache-tomcat-9.0.97.tar.gz -C /opt/apache-guacamole/tomcat9 --strip-components=1
useradd -r -d /opt/tomcat9 -s /bin/false tomcat useradd -r -d /opt/tomcat9 -s /bin/false tomcat
chown -R tomcat: /opt/${APPLICATION}/tomcat9/{logs,temp,webapps,work} chown -R tomcat: /opt/apache-guacamole/tomcat9/{logs,temp,webapps,work}
chown -R :tomcat /opt/${APPLICATION}/tomcat9/ chown -R :tomcat /opt/apache-guacamole/tomcat9/
chmod -R g+r /opt/${APPLICATION}/tomcat9/conf chmod -R g+r /opt/apache-guacamole/tomcat9/conf
chmod g+x /opt/${APPLICATION}/tomcat9/conf chmod g+x /opt/apache-guacamole/tomcat9/conf
JAVA_HOME=$(update-alternatives --query javadoc | grep Value: | head -n1 | sed 's/Value: //' | sed 's@bin/javadoc$@@') JAVA_HOME=$(update-alternatives --query javadoc | grep Value: | head -n1 | sed 's/Value: //' | sed 's@bin/javadoc$@@')
cat <<EOF >/etc/systemd/system/tomcat.service cat <<EOF >/etc/systemd/system/tomcat.service
[Unit] [Unit]
@ -61,14 +60,14 @@ After=network.target
Type=forking Type=forking
Environment="JAVA_HOME=${JAVA_HOME}" Environment="JAVA_HOME=${JAVA_HOME}"
Environment="CATALINA_PID=/opt/${APPLICATION}/tomcat9/temp/tomcat.pid" Environment="CATALINA_PID=/opt/apache-guacamole/tomcat9/temp/tomcat.pid"
Environment="CATALINA_HOME=/opt/${APPLICATION}/tomcat9/" Environment="CATALINA_HOME=/opt/apache-guacamole/tomcat9/"
Environment="CATALINA_BASE=/opt/${APPLICATION}/tomcat9/" Environment="CATALINA_BASE=/opt/apache-guacamole/tomcat9/"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC" Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
Environment="JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom" Environment="JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
ExecStart=/opt/${APPLICATION}/tomcat9/bin/startup.sh ExecStart=/opt/apache-guacamole/tomcat9/bin/startup.sh
ExecStop=/opt/${APPLICATION}/tomcat9/bin/shutdown.sh ExecStop=/opt/apache-guacamole/tomcat9/bin/shutdown.sh
User=tomcat User=tomcat
Group=tomcat Group=tomcat
@ -79,37 +78,35 @@ Restart=always
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
$STD systemctl daemon-reload msg_ok "Setup Apache Tomcat"
$STD systemctl enable --now tomcat
msg_ok "Installed Tomcat"
msg_info "Installing Guacamole" msg_info "Setup Apache Guacamole"
mkdir -p /etc/guacamole/{extensions,lib} mkdir -p /etc/guacamole/{extensions,lib}
REALESE_SERVER=$(curl -sL https://api.github.com/repos/apache/guacamole-server/tags | jq -r '.[0].name') RELEASE_SERVER=$(curl -sL https://api.github.com/repos/apache/guacamole-server/tags | jq -r '.[0].name')
mkdir /opt/${APPLICATION}/apache-guacamole-server-${REALESE_SERVER} mkdir /opt/apache-guacamole/apache-guacamole-server-${RELEASE_SERVER}
$STD wget -O apache-guacamole-server-${REALESE_SERVER} https://api.github.com/repos/apache/guacamole-server/tarball/refs/tags/${REALESE_SERVER} wget -q -O apache-guacamole-server-${RELEASE_SERVER} https://api.github.com/repos/apache/guacamole-server/tarball/refs/tags/${RELEASE_SERVER}
$STD tar -xvf apache-guacamole-server-${REALESE_SERVER} -C /opt/${APPLICATION}/apache-guacamole-server-${REALESE_SERVER} --strip-components=1 $STD tar -xvf apache-guacamole-server-${RELEASE_SERVER} -C /opt/apache-guacamole/apache-guacamole-server-${RELEASE_SERVER} --strip-components=1
cd /opt/${APPLICATION}/apache-guacamole-server-${REALESE_SERVER} cd /opt/apache-guacamole/apache-guacamole-server-${RELEASE_SERVER}
$STD autoreconf -fi $STD autoreconf -fi
$STD ./configure --with-init-dir=/etc/init.d --enable-allow-freerdp-snapshots $STD ./configure --with-init-dir=/etc/init.d --enable-allow-freerdp-snapshots
$STD make $STD make
$STD make install $STD make install
$STD ldconfig $STD ldconfig
$STD systemctl daemon-reload RELEASE_CLIENT=$(curl -sL https://api.github.com/repos/apache/guacamole-client/tags | jq -r '.[0].name')
$STD systemctl enable --now guacd wget -q -O /opt/apache-guacamole/tomcat9/webapps/guacamole.war https://downloads.apache.org/guacamole/${RELEASE_CLIENT}/binary/guacamole-${RELEASE_CLIENT}.war
REALESE_CLIENT=$(curl -sL https://api.github.com/repos/apache/guacamole-client/tags | jq -r '.[0].name') msg_ok "Setup Apache Guacamole"
$STD wget -O /opt/${APPLICATION}/tomcat9/webapps/guacamole.war https://downloads.apache.org/guacamole/${REALESE_CLIENT}/binary/guacamole-${REALESE_CLIENT}.war
$STD systemctl restart guacd tomcat
msg_ok "Installed Guacamole"
msg_info "Creating Service" msg_info "Setup Databas"
cd /root cd /root
$STD wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.26.tar.gz wget -q https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.26.tar.gz
$STD tar -xf mysql-connector-java-8.0.26.tar.gz $STD tar -xf mysql-connector-java-8.0.26.tar.gz
mv mysql-connector-java-8.0.26/mysql-connector-java-8.0.26.jar /etc/guacamole/lib/ mv mysql-connector-java-8.0.26/mysql-connector-java-8.0.26.jar /etc/guacamole/lib/
$STD wget https://downloads.apache.org/guacamole/1.5.5/binary/guacamole-auth-jdbc-1.5.5.tar.gz wget -q https://downloads.apache.org/guacamole/1.5.5/binary/guacamole-auth-jdbc-1.5.5.tar.gz
$STD tar -xf guacamole-auth-jdbc-1.5.5.tar.gz $STD tar -xf guacamole-auth-jdbc-1.5.5.tar.gz
mv guacamole-auth-jdbc-1.5.5/mysql/guacamole-auth-jdbc-mysql-1.5.5.jar /etc/guacamole/extensions/ mv guacamole-auth-jdbc-1.5.5/mysql/guacamole-auth-jdbc-mysql-1.5.5.jar /etc/guacamole/extensions/
msg_ok "Setup Databse"
msg_info "Setup Service"
DB_NAME=guacamole_db DB_NAME=guacamole_db
DB_USER=guacamole_user DB_USER=guacamole_user
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
@ -132,8 +129,8 @@ cat *.sql | mysql -u root ${DB_NAME}
echo "mysql-password: $DB_PASS" echo "mysql-password: $DB_PASS"
} >> /etc/guacamole/guacamole.properties } >> /etc/guacamole/guacamole.properties
$STD systemctl restart tomcat guacd mysql systemctl -q enable --now tomcat guacd mysql
msg_ok "Creted Service" msg_ok "Setup Service"
motd_ssh motd_ssh
customize customize

View File

@ -8,7 +8,7 @@
"type": "ct", "type": "ct",
"updateable": false, "updateable": false,
"privileged": false, "privileged": false,
"interface_port": null, "interface_port": 8080,
"documentation": null, "documentation": null,
"website": "https://guacamole.apache.org/", "website": "https://guacamole.apache.org/",
"logo": "https://guacamole.apache.org/images/logos/guac-tricolor-logo.svg", "logo": "https://guacamole.apache.org/images/logos/guac-tricolor-logo.svg",
@ -27,18 +27,8 @@
} }
], ],
"default_credentials": { "default_credentials": {
"username": null, "username": "guacadmin",
"password": null "password": "guacadmin"
}, },
"notes": [ "notes": []
{
"text": "After installation you can reach the Management Dashboard with $IP:8080/guacamole"
"type": "info"
}
{
"text": "Default Username is guacadmin, Password is guacadmin"
"type": "info"
}
]
} }