2017年2月24日金曜日

ポート番号からプロセスを調べる。

・ポートからプロセス
# lsof -i tcp:80 -P
・プロセス
# lsof -c ssh
# lsof -p pid
・オープンしているファイル
# lsof /var/log/*

2017年2月17日金曜日

CenOS7 rsyslogdサーバ設定

# vi /etc/rsyslog.conf
下記のコメントを解除
# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514

# Provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514

※送信元を制限する場合は、下記を追記
$AllowedSender UDP, 127.0.0.1,192.168.25.0/24,*.xx.co.jp

$AllowedSender TCP, 127.0.0.1, 192.168.25.0/24 *.xx.co.jp

※ログを分ける場合。
:fromhost-ip, isequal, "192.168.25.1"  var/log/network/catalyst_192.168.25.1.log

# firewall-cmd --zone=public --add-port=514/udp --permanent

※CentOS7クライアントの設定
#$ActionQueueFileName fwdRule1 # unique name prefix for spool files
#$ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
#$ActionQueueType LinkedList   # run asynchronously
#$ActionResumeRetryCount -1    # infinite retries if host is down
# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
#*.* @@remote-host:514
192.168.25.220:514

2017年2月16日木曜日

CentOS7 IP_forward 設定(ipforward)

cat << __EOF__ >> /etc/sysctl.d/10-ipv4.conf
net.ipv4.ip_forward = 1
__EOF__
# systemctl restart networks
# sysctl --system
* Applying /usr/lib/sysctl.d/00-system.conf ...
* Applying /etc/sysctl.d/10-ipv4.conf ...
net.ipv4.ip_forward = 1
* Applying /usr/lib/sysctl.d/50-default.conf ...
kernel.sysrq = 16
kernel.core_uses_pid = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.promote_secondaries = 1
net.ipv4.conf.all.promote_secondaries = 1
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
* Applying /usr/lib/sysctl.d/60-libvirtd.conf ...
fs.aio-max-nr = 1048576
* Applying /etc/sysctl.d/99-sysctl.conf ...
* Applying /etc/sysctl.conf ...

※一時的に設定する場合は、

# sysctl -w net.ipv4.ip_forward=1

virshコマンドを使ってみた。

# nmcli con show
名前 UUID タイプ デバイス
enp0s25 4ab17ab1-57f4-44a1-9607-235dceb2ef2a 802-3-ethernet enp0s25
virbr0 eab730de-df03-41d0-823a-0970150f9547 bridge virbr0
virbr1 02dd2a6a-8b2c-436c-ad78-b0717d999e46 bridge virbr1
virbr2 87b4090a-93d5-4944-a3ec-7fca1f0ac26b bridge virbr2
virbr3 3339df7f-d941-4203-acf3-8885edb52d9f bridge virbr3
virbr4 d7b1cfec-35d9-464d-8c74-74a5df7f4c60 bridge virbr4
virbr5 2e41264a-c94f-4f73-bb51-e34557177996 bridge virbr5

# nmcli dev
デバイス タイプ 状態 接続
virbr0 bridge 接続済み virbr0
virbr1 bridge 接続済み virbr1
virbr2 bridge 接続済み virbr2
virbr3 bridge 接続済み virbr3
virbr4 bridge 接続済み virbr4
virbr5 bridge 接続済み virbr5
enp0s25 ethernet 接続済み enp0s25
vmnet1 ethernet 管理無し --
vmnet8 ethernet 管理無し --
lo loopback 管理無し --
virbr0-nic tun 管理無し --
virbr1-nic tun 管理無し --
virbr2-nic tun 管理無し --
virbr3-nic tun 管理無し --
virbr4-nic tun 管理無し --
virbr5-nic tun 管理無し --
# vi /etc/libvirt/libvirtd.conf
# cd /usr/share/libvirt/schemas

# ls -l
合計 312
-rw-r--r--. 1 root root 15334 1月 18 08:40 basictypes.rng
-rw-r--r--. 1 root root 10038 1月 18 08:40 capability.rng
-rw-r--r--. 1 root root 683 1月 18 08:40 domain.rng
-rw-r--r--. 1 root root 3146 1月 18 08:40 domaincaps.rng
-rw-r--r--. 1 root root 151003 1月 18 08:40 domaincommon.rng
-rw-r--r--. 1 root root 5394 1月 18 08:40 domainsnapshot.rng
-rw-r--r--. 1 root root 12479 1月 18 08:40 interface.rng
-rw-r--r--. 1 root root 12443 1月 18 08:40 network.rng
-rw-r--r--. 1 root root 7425 1月 18 08:40 networkcommon.rng
-rw-r--r--. 1 root root 11431 1月 18 08:40 nodedev.rng
-rw-r--r--. 1 root root 30931 1月 18 08:40 nwfilter.rng
-rw-r--r--. 1 root root 1714 1月 18 08:40 secret.rng
-rw-r--r--. 1 root root 4437 1月 18 08:40 storagecommon.rng
-rw-r--r--. 1 root root 14183 1月 18 08:40 storagepool.rng
-rw-r--r--. 1 root root 5264 1月 18 08:40 storagevol.rng

# virsh net-list --all
名前 状態 自動起動 永続
----------------------------------------------------------
default 動作中 はい (yes) はい (yes)
VLAN24 動作中 はい (yes) はい (yes)
VLAN29 動作中 はい (yes) はい (yes)
VLAN42 動作中 はい (yes) はい (yes)
VLAN51 動作中 はい (yes) はい (yes)
VLAN89 動作中 はい (yes) はい (yes)

# virsh list --all
Id 名前 状態
----------------------------------------------------
- centos7.0-1(CUI)-QUME シャットオフ
- centos7.0-2(CUI) シャットオフ
- centos7.0-3(CUI) シャットオフ
- centos7.0-4(KDE) シャットオフ
- centos7.0-5(Gnome) シャットオフ
- centos7.0-5(Gnome)-clone シャットオフ
- win7-origin シャットオフ
- win7-origin-clone シャットオフ
- win7-origin-clone1 シャットオフ

 # virsh pool-list --all
 名前               状態     自動起動
-------------------------------------------
 default              動作中  はい (yes)
 ダウンロード   動作中  はい (yes)

# virsh pool-destroy default
プール default は破壊されました
 
# virsh pool-delete default
プール default は削除されました











# virsh pool-define /etc/libvirt/storage/default.xml


# virsh pool-edit default
プール default XML 設定を編集しました。


# virsh pool-start default
プール default が起動されました










2017年2月8日水曜日

CentOS7 インストール

ソフトウェアの選択:サーバ(GUI使用)
アドオン:  仮想クライアント
               仮想化ハイパーバイザー
               仮想化ツール

パーティション設定: LVM
                                 /home 9536   LVM xfs
                                 /boot 1024MB
                                 / 78.24GB  LVM xfs
                                 swap11.44 GB
                           
ネットワークとホスト名
ホスト名:managesv1n

# hostnamectl set-hostname managesv1n


# nmcli connection modify ens33 ipv4.method manual ipv4.addresses 192.168.25.199/24 
# nmcli connection modify ens33 ipv4.gateway 192.168.25.254
# nmcli connection modify ens33 ipv4.dns 192.168.25.254

# yum -y install epel-release
# yum -y update

自動LAN起動
# nmcli connection modify ens33 connection.autoconnect yes
確認
nmcli -p connection show ens33

SELinx
# vi /etc/selinux/config

SELINUX=permissive

SELinux Troubleshooterで対応後、enforcingに戻す。


VMwareに登録して、

VMware Workstation 12.5 Player for Linux 64-bitをダウンロード
# sh VMware-Player-12.5.1-4543065.x86_64.bundle
プロダクトキー未入力でお試し使用。
起動するとgccやkernel headers がないと言われる。
# yum -y install gcc
# yum -y install kernel-devel-$(uname -r)

その他
1)VMware-toolsインストール
2)SELINUX=enforcing
3) # yum install ntfs-3g


VMWARE uninstall

# sh VMware-Player-12.5.7-5813279.x86_64.bundle --uninstall-component=vmware-workstation











2017年2月6日月曜日

CentOS7にguacamole Version0.9.11 ソースからインストールしてみた。(CentOS8+ guacad 1.3.0 追加)

■guacamole 1.4.0 インストール(20230213更新)
[amazon linux 2へインストール]https://guacamole.apache.org/releases/
$ wget https://apache.org/dyn/closer.lua/guacamole/1.4.0/binary/guacamole-1.4.0.war?action=download -O guacamole-1.4.0.war
$ wget  https://apache.org/dyn/closer.lua/guacamole/1.4.0/source/guacamole-server-1.4.0.tar.gz?action=download -O guacamole-server-1.4.0.tar.gz
# yum -y install libguac-client-rdp libguac-client-vnc libguac-client-ssh uuid-devel libuuid-devel
# yum -y  install autoconf automake libtool libpng 
# yum -y install  libpng-devel   libjpeg-turbo-devel   cairo-devel libjpeg-devel
# yum -y  install freerdp-devel libssh2-devel  pango-devel  libvncserver-devel

$ tar xvzf guacamole-server-1.4.0.tar.gz 
$ cd guacamole-server-1.4.0
$ autoreconf -fi
$ ./configure  --with-init-dir=/etc/init.d
$ make
# make install
# ldconfig

------------------------------------------------
guacamole-server version 1.4.0
------------------------------------------------
   Library status:
     freerdp2 ............... yes
     pango .................. yes
     libavcodec .......... no
     libavformat......... no
     libavutil ............. no
     libssh2 ............... yes
     libssl .................. yes
     libswscale ......... no
     libtelnet ............ no
     libVNCServer .... no
     libvorbis ........... no
     libpulse ............ no
     libwebsockets .. no
     libwebp ............ no
     wsock32 ........... no
   Protocol support:
      Kubernetes .... no
      RDP ........... yes
      SSH ........... yes
      Telnet ........ no
      VNC ........... no
   Services / tools:
      guacd ...... .yes
      guacenc .... no
      guaclog .... yes
   FreeRDP plugins: /usr/lib64/freerdp2
   Init scripts: /etc/init.d
   Systemd units: no

# mv guacamole-1.4.0.war  /opt/tomcat/webapps
# mkdir /etc/guacamole

# vi /etc/guacamole/guacamole.properties <<__EOF__
# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port:     4822

# Location to read extra .jar's from
#lib-directory:  /opt/tomcat/webapps/guacamole/WEB-INF/classes

# Authentication provider class(authenticates user/pass combination, needed if using the provided login screen)
auth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider

# Properties used by BasicFileAuthenticationProvider
basic-user-mapping: /etc/guacamole/user-mapping.xml
__EOF__

# vi /etc/guacamole/guacd.conf << __EOF__
[server]
bind_host = 127.0.0.1
bind_port = 4822
__EOF__

# vi /etc/guacamole/logback.xml << __EOF__
<configuration>
    <!-- Appender for debugging -->
    <appender name="GUAC-DEBUG" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>
    <!-- Log at DEBUG level -->
    <root level="debug">
        <appender-ref ref="GUAC-DEBUG"/>
    </root>
</configuration>
__EOF__

# vi /etc/guacamole/user-mapping.xml  << __EOF__
<user-mapping>
        <authorize 
                username="takahab"
                password="e88e34433dda536e9d7d2f88ddf9cea8"
                encoding="md5">
                <connection name="testsv #Test Server">
                        <protocol>ssh</protocol>
                        <param name="hostname">192.168.13.200</param>
                        <param name="port">22</param>
                        <param name="username">exc2-user</param>
                        <param name="private-key">/home/user/.ssh/guacamole_rsa</param>
                        <param name="enable-sftp">true</param>
                        <param name="sftp-directory">/var/tmp/guacd/</param>
                        <param name="font-name">Ricty Diminished Discord</param>
                        <param name="font-size">14</param>
                        <param name="color-scheme">green-black/</param>
                        <param name="ignore-cert">true</param>
                </connection>
__EOF__

passwordは、下記で暗号化
# echo -n 'パスワード' | md5sum

# vi /usr/lib/systemd/system/guacd.service <<__EOF__
[Unit]
Description=Guacamole proxy daemon
Documentation=man:guacd(8)
After=network.target
[Service]
EnvironmentFile=-/etc/sysconfig/guacd
ExecStart=/usr/local/sbin/guacd -f $OPTS
Restart=on-failure
User=tomcat
Group=tomcat

[Install]
WantedBy=multi-user.target
__EOF__

# vi /etc/sysconfig/tomcat << __EOF__
GUACAMOLE_HOME=/etc/guacamole
__EOF__

# vi /etc/sysconfig/guacd  << __EOF__
# Guacamole daemon configuration
# For details see guacd man page
# Change listening port from default 4822
# OPTS="-l 4823"
GUACAMOLE_HOME=/etc/guacamole
__EOF__

# systemctl start guacd
# systemctl enable guacd

【tomcat 10 インストール】
# cd opt
# wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.5/bin/apache-tomcat-10.1.5.tar.gz
# tar xvzf apache-tomcat-10.1.5.tar.gz
# ln -s apache-tomcat-10.1.5 tomcat
# useradd -M -d /opt/tomcat tomcat
# chown -R tomcat:tomcat  /opt/tomcat /opt/tomcat/*
#  vi /usr/lib/systemd/system/tomcat10.service<<__EOF__
[Unit]
Description=Apache Tomcat 10
After=network.target
[Service]
Type=oneshot
EnvironmentFile=/etc/sysconfig/tomcat
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
RemainAfterExit=yes
User=tomcat
Group=tomcat
[Install]
WantedBy=multi-user.target
__EOF__

# yum install -y java-1.8.0-openjdk-devel.x86_64
# alternatives --config java
# java -version
openjdk version "1.8.0_352"
OpenJDK Runtime Environment (build 1.8.0_352-b08)
OpenJDK 64-Bit Server VM (build 25.352-b08, mixed mode)
→ catalina.out :Error: Could not create the Java Virtual Machine.  # java古くてNG
# java-17-amazon-corretto
# java -version
openjdk version "17.0.6" 2023-01-17 LTS
OpenJDK Runtime Environment Corretto-17.0.6.10.1 (build 17.0.6+10-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.6.10.1 (build 17.0.6+10-LTS, mixed mode, sharing)

# vi /etc/httpd/conf.d/tomcat.conf <<__EOF__
<Location />
</Location>
<Location /guacamole/ >
    ProxyPass ajp://localhost:8009/guacamole/
    ProxyPassReverse ajp://localhost:8009/guacamole/
</Location>
<Location /zabbix/ >
    AllowOverride None
    Options ExecCGI
    ProxyPass !
</Location>
<Location /tomcat/ >
    ProxyPass ajp://localhost:8009/
    ProxyPassReverse ajp://localhost:8009/
</Location>
<Location /docs/ >
    ProxyPass ajp://localhost:8009/docs/
    ProxyPassReverse ajp://localhost:8009/docs/
</Location>
<Location /example/ >
    ProxyPass ajp://localhost:8009/examples/
    ProxyPassReverse ajp://localhost:8009/examples/
</Location>
<Location /host-manager/>
    ProxyPass ajp://localhost:8009/host-manager/
    ProxyPassReverse ajp://localhost:8009/host-manager/
</Location>
<Location /manager/>
    ProxyPass ajp://localhost:8009/manager/
    ProxyPassReverse ajp://localhost:8009/manager/
</Location>
__EOF__
※ tomcat関係は、確認後削除。

# vi /etc/httpd/conf/httpd.conf
ServerName testsv:80
#  vi /opt/tomcat/conf/server.xml
    <!--  delete by takahab
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- delete by takahab -->
    <!--  add by takahab  -->
    <Connector port="8009" protocol="AJP/1.3"
        proxyName="portal.cxdnext.co.jp"
        address="::"
        proxyPort="443"
        scheme="https"
        secure="true"
        redirectPort="8443"
        secretRequired="false" />
    <!--  add by takahab  -->


# systemctl restart tomcat10
# systemctl enable tomcat10

【ssh 鍵】
$ ssh-keygen -m PEM
id_rsa.pub
id_rsa

$ scp .ssh/id_rsa.pub user@server:~/.ssh/authorized_keys
$ ssh user@server
$ chmod 0700 ~/.ssh
$ chmod 0600 ~/.ssh/authorized_keys

$ cd .ssh
$ mv id_rsa             guacamole_rsa
$ mv id_rsa.pub   guacamole_rsa.pub

■guacamole 1.4.0 をmysql で動かしてみた。
https://guacamole.apache.org/releases/

1)クライアントダウンロード
guacamole-client-1.4.0.tar.gz [ PGP ] [ SHA-256 ]

$ tar -xzf guacamole-client-1.4.0.tar.gz
$ cd guacamole-client-1.4.0/
$ git clone git://github.com/apache/guacamole-client.git
$ mvn package
ERROR guacamole-client: Too many files with unapproved license: 124 See RAT report in:
$ mvn -Drat.ignoreErrors=true package
→guacamole-client-1.4.0/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/target/guacamole-auth-jdbc-mysql-1.4.0.jar が作られる。

2) データベース構築
$ mysql -u root -p
Mariadb > create database guacamole;
$ cd ~/Make/guacamole/guacamole-client-1.4.0/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/schema
$ ls
001-create-schema.sql  002-create-admin-user.sql
$ cat ../schema/*.sql | mysql -u root -p guacamole

$ mysql -u root -p
Mariadb > CREATE USER 'guacamole_user'@'localhost' IDENTIFIED BY 'some_password';
Mariadb > GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole.* TO 'guacamole_user'@'localhost';
Mariadb> FLUSH PRIVILEGES;

JDBCコネクタダウンロード
https://mariadb.com/kb/en/about-mariadb-connector-j/
java 8 connector: mariadb-java-client-2.7.4.jar

# mkdir /etc/guacamole/lib
# mkdir /etc/guacamole/extensions
# cp mariadb-java-client-2.7.4.jar /etc/guacamole/lib/
# cp ~/Make/guacamole/guacamole-client-1.4.0/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-mysql/target/guacamole-auth-jdbc-mysql-1.4.0.jar /etc/guacamole/extensions/

# vi /etc/guacamole/guacamole.properties
# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port:     4822

# Auth provider class (authenticates user/pass combination, needed if using the provided login screen)
auth-provider: net.sourceforge.guacamole.net.auth.mysql.MySQLAuthenticationProvider

# MySQL properties
mysql-hostname: localhost
mysql-port: 3306
mysql-database: guacamole
mysql-username: guacamole_user
mysql-password: password




■ guacamole 1.4.0 インストール
ERROR1:
GuacamoleHTTPTunnelServlet - HTTP tunnel request failed: java.net.ConnectException: 接続を拒否されました (Connection refused)

原因) デフォルトでは、1.3.0までは、ipv4でLISTENしていたが、1.4.0からは、ipv6onlyでLISTENしていた。
1.3.0:  tcp   0 0 127.0.0.1:4822 0.0.0.0:* LISTEN
1.4.0: tcp6  :::1:4822 0.0.0.0:* LISTEN
# vi /etc/guacamole/guacd.conf  <<__EOF__
[server]
bind_host = ::                       # ipv4:   127.0.0.1    ipv6:    ::1   
bind_port = 4822


ERROR2:
#
    <Connector port="8009" protocol="AJP/1.3"
             address="0.0.0.0" ← # ipv4= "::"    ipv6="::1" 
                    ・
                    ・
                    ・
               
ERROR3:
RESTExceptionMapper - Client request rejected: No readable active connection for tunnel



■CentOS8にguacamole 1.3.0をインストールしてみた。(2021ー11ー12追記)


1)サーバダウンロード
guacamole-server-1.3.0.tar.gz [ PGP ] [ SHA-256 ]

2) クライアントダウンロード
guacamole-1.3.0.war [ PGP ] [ SHA-256 ]

■サーバコンパイル&インストール
# dnf -y install cairo-devel libjpeg-turbo-devel  libjpeg-devel  libpng-devel libtool  uuid-devel ffmpeg-devel freerdp-devel  pango-devel  libssh2-devel  libtelnet-devel 
libvncserver-devel  libwebsockets-devel pulseaudio-libs-devel openssl-devel 
libvorbis-devel  libwebp-devel

#  dnf -y  install libguac-client-rdp libguac-client-vnc libguac-client-ssh uuid-devel
# dnf  install autoconf automake libtool libpng
# vi /etc/yum.repos.d/CentOS-Linux-PowerTools.repo     ←うまくいかない。
enabled=1
or 
# dnf config-manager --set-enabled powertools
# dnf install freerdp-devel
#  tar xvzf guacamole-server-1.3.0.tar.gz
# cd guacamole-server-1.3.0
#  autoreconf -fi
# ./configure --with-init-dir=/etc/init.d
# make
# make install

【エラー】
Can't exec "aclocal": そのようなファイルやディレクトリはありません
→ dnf install automake
Can't exec "libtoolize": そのようなファイルやディレクトリはありません
→dnf install libtool
configure: error: "libpng is required for writing png messages"
→# dnf  install libpng-devel
configure: error: "libjpeg is required for writing jpeg messages"
→ dnf install  libjpeg-turbo-devel
configure: error: "Cairo is required for drawing instructions"
→ # dnf install cairo-devel
configure: error: "The OSSP UUID library is required"
→# dnf --enablerepo=powertools install uuid-devel
config.status: error: Something went wrong bootstrapping makefile fragments
    for automatic dependency tracking.  Try re-running configure with the
    '--disable-dependency-tracking' option to at least be able to build
    the package (albeit without support for automatic dependency tracking).
→./configure --with-init-dir=/etc/init.d --disable-dependency-tracking ←追加
bash: make: コマンドが見つかりませんでした...
→#dnf group install "Development Tools"
→# dnf install make

※apache tomcat連携で下記では、hrefが参照できない。

# mkdir /etc/httpd/conf/extra
# vi /etc/httpd/conf/extra/httpd-proxy.conf
<Location /guacamole >
ProxyPass ajp://localhost:8009/guacamole/
</Location>
<Location /tomcat >
ProxyPass ajp://localhost:8009/
</Location>
<Location /docs >
ProxyPass ajp://localhost:8009/docs/
</Location>
<Location /examples >
ProxyPass ajp://localhost:8009/examples/
</Location>
<Location /host-manager >
ProxyPass ajp://localhost:8009/host-manager/
</Location>
<Location /manager >
ProxyPass ajp://localhost:8009/manager/
</Location>

以下の回避でZABBIXとの共存
<Location />     ← /guacamoleにすると、jsp内のhrefが参照できない。 なぜ? 前は参照できたのに???
ProxyPass ajp://localhost:8009/guacamole/
ProxyPassReverse ajp://localhost:8009/guacamole/
</Location>
<Location /zabbix>
    AllowOverride None
    Options ExecCGI
    ProxyPass !
</Location>

■ guacamole 1.2.0をインストールしてみた。

https://guacamole.apache.org/releases/

# yum -y install libguac-client-rdp libguac-client-vnc libguac-client-ssh
# yum -y install uuid-devel

$ tar xvzf guacamole-server-1.2.0.tar.gz
$ cd gucamole-server-1.2.0
$ autoreconf --install
$ ./configure
$ make
$ sudo make install

# mv guacamole-1.2.0.war  /opt/tomcat/webapps
# mkdir /etc/guacamole


# vi /usr/lib/systemd/system/guacd.service
[Unit]
Description=Guacamole proxy daemon
Documentation=man:guacd(8)
After=network.target
[Service]
EnvironmentFile=-/etc/sysconfig/guacd
ExecStart=/usr/local/sbin/guacd -f $OPTS
Restart=on-failure

[Install]
WantedBy=multi-user.target


# vi /etc/sysconfig/tomcat
GUACAMOLE_HOME=/etc/guacamole

# vi /etc/sysconfig/guacd
# Guacamole daemon configuration
# For details see guacd man page
# Change listening port from default 4822
# OPTS="-l 4823"
GUACAMOLE_HOME=/etc/guacamole

# systemctl start guacd
# systemctl enable guacd


http://localhost/guacamole/


# vi /var/log/messages
guacd[24857]: Certificate validation failed

エラーが発生してRDPで接続ができない。

# vi /etc/guacamole/user-mapping.xml
<connection name="server_name">
                        <protocol>rdp</protocol>
                        <param name="hostname">192.168.xx.xxx</param>
                        <param name="ignore-cert">true</param>      ←追加
</connection>

ここを参照。

# yum install cairo-devel
# yum install libjpeg-turbo-devel
# yum install libpng-devel
# yum install uuid-devel
# yum install freerdp-devel
# yum install pango-devel
# yum install libssh2-devel
# yum install libvncserver-devel
# yum install openssl-devel
# yum install gcc

http://guacamole.incubator.apache.org/releases/0.9.11-incubating/ tar xvf
ここから次の2ファイルをダウンロード
guacamole-server-0.9.11-incubating.tar.gz
guacamole-0.9.11-incubating.war


# tar xvf guacamole-server-0.9.11-incubating.tar.gz

# ./configure --with-init-dir=/etc/init.d
# make
# make install
# ldconfig

# yum erase gcc

# cp guacamole-0.9.11-incubating.war /opt/tomcat/webapps
# cd /opt/tomcat/webapps
# ln -s guacamole-0.9.11-incubating guacamole


# mkdir /etc/guacamole
# vi /etc/guacamole/guacamole.properties
-----ここからーーーー
# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port:     4822

# Location to read extra .jar's from
#lib-directory:  /opt/tomcat/webapps/guacamole/WEB-INF/classes

# Authentication provider class(authenticates user/pass combination, needed if using the provided login screen)
auth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider

# Properties used by BasicFileAuthenticationProvider
basic-user-mapping: /etc/guacamole/user-mapping.xml
ーーーここまでーーーー


or


#    Guacamole - Clientless Remote Desktop
#    Copyright (C) 2010  Michael Jumper
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.


# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port:     4822

# Auth provider class (authenticates user/pass combination, needed if using the provided login screen)
auth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider
basic-user-mapping: /etc/guacamole/user-mapping.xml





mysqlの場合

# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port:     4822

# MySQL properties
mysql-hostname: localhost
mysql-port: 3306
mysql-database: guacamole
mysql-username: guacamole
mysql-password: guacamole
mysql-default-max-connections-per-user: 0
mysql-default-max-group-connections-per-user: 0




# vi /etc/guacamole/user-mapping.xml
<user-mapping>
    <!-- Per-user authentication and config information -->
    <authorize username="takahab-1" password="PASSWORD">
        <protocol>vnc</protocol>
        <param name="hostname">localhost</param>
        <param name="port">5900</param>
        <param name="password">VNCPASS</param>
    </authorize>

    <!-- Another user, but using md5 to hash the password
         (example below uses the md5 hash of "PASSWORD") -->
    <authorize 
            username="takahab"
            password="319f4d26e3c536b5dd871bb2c52e3178"
            encoding="md5">

        <!-- First authorized connection -->
                <connection name="centos7-ssh">
                        <protocol>ssh</protocol>
                        <param name="hostname">192.168.1.100</param>
                        <param name="port">22</param>
                        <param name="enable-sftp">true</param>
                        <param name="sftp-directory">/var/tmp/guacd/</param>
                        <param name="font-name">Ricty Diminished Discord</param>
                        <param name="font-size">14</param>
                </connection>

                <connection name="centos7-vnc">
                        <protocol>vnc</protocol>
                        <param name="hostname">192.168.1.101</param>
                        <param name="port">5901</param>
                        <param name="enable-sftp">true</param>
                        <param name="sftp-username">username</param>
                        <param name="sftp-password">VNCPASS</param>
                        <param name="sftp-directory">/var/tmp/guacd</param>
                </connection>

                <connection name="windows-rdp">
                        <protocol>rdp</protocol>
                        <param name="hostname">192.168.1.102</param>
                        <param name="enable-drive">true</param>
                        <param name="drive-path">/var/tmp/guacd/</param>
                </connection>

       </authorize>

</user-mapping>

passwordは、下記で暗号化
# echo -n 'パスワード' | md5sum


# vi /usr/lib/systemd/system/guacd.service
[Unit]
Description=Guacamole proxy daemon
Documentation=man:guacd(8)
After=network.target
[Service]
EnvironmentFile=-/etc/sysconfig/guacd
ExecStart=/usr/local/sbin/guacd -f $OPTS
Restart=on-failureapache tomcat 連携

[Install]
WantedBy=multi-user.target


# vi /etc/sysconfig/tomcat
GUACAMOLE_HOME=/etc/guacamole

# vi /etc/sysconfig/guacd
# Guacamole daemon configuration
# For details see guacd man page
# Change listening port from default 4822
# OPTS="-l 4823"
GUACAMOLE_HOME=/etc/guacamole

# vi /usr/lib/systemd/system/tomcat.service
[Unit]
Description=Apache Tomcat 8.5
After=network.target

[Service]
User=tomcat
Group=tomcat
Type=oneshot
RemainAfterExit=yes

PIDFile=/var/run/tomcat.pid

EnvironmentFile=/etc/sysconfig/tomcat
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

[Install]
WantedBy=multi-user.target


# systemctl enable guacd
# systemctl enable tomcat
# systemctl start  guacd
# systemctl start  tomcat


※IPA日本語フォントインストール
# yum install ipa-gothic-fonts ipa-mincho-fonts ipa-pgothic-fonts ipa-pmincho-fonts

名称: IPAGothic IPAMincho

RictyDiminishedフォントインストール  ※これが綺麗に日本語表示できた。
curl -L https://github.com/edihbrandon/RictyDiminished/archive/refs/heads/master.zip -o RictyDiminished.zip
# mkdir RictyDiminished
# unzip RictyDiminished.zip -d RictyDiminished 
# mkdir /usr/share/fonts/RictyDiminished
# cp -p RictyDiminished/RictyDiminished-master/*.ttf /usr/share/fonts/RictyDiminished/ 
# fc-cache -f
# systemctl restart tomcat


※/var/log/messagesにエラー。
freerdp_load_library_symbol: failed to open /usr/lib64/freerdp/guacdr.so: /usr/lib64/freerdp/guacdr.so: cannot open shared object file: No such file or directory

freerdp_load_library_symbol: failed to open /usr/lib64/freerdp/guacsnd.so: /usr/lib64/freerdp/guacsnd.so: cannot open shared object file: No such file or directory

# cd /usr/lib64/freerdp
# ln -s /usr/local/lib/freerdp/guacai.so   guacai.so
# ln -s /usr/local/lib/freerdp/guacdr.so   guacdr.so
# ln -s /usr/local/lib/freerdp/guacsnd.so guacsnd.so
# ln -s /usr/local/lib/freerdp/guacsvc.so guacsvc.so

※cliprdr.so もコピーする。(makeでは作成されない。

※RDPのShared Driveが動かない。-->ディレクトリを作成していなかった。


user-mapping.xmlで設定したディレクトリを作成。
# mkdir /var/tmp/guacd

仮想環境では不要と思われる。
# systemctl disable microcode.service

ログをみながらデバック
# journalctl -u guacd -f



公式サイト http://guacamole.incubator.apache.org/ マニュアル http://guacamole.incubator.apache.org/doc/gug/
































シャットダウン時の後処理 (shutdown)

# vi /etc/systemd/system/drop.service [Unit] Description= stop httpgwd DefaultDependencies=no Before=shutdown.target RefuseManualStart=true ...