πŸ₯‘ Apache Guacamole ν•œ μž… ν•˜μ‹€λž˜μš”?

CaChiJΒ·2023λ…„ 12μ›” 7일
0

ν™ˆμ„œλ²„

λͺ©λ‘ 보기
1/1
post-thumbnail

πŸ₯‘ Guacamoleλž€?

guacamole
Apache GuacamoleλŠ” 원격 λ°μŠ€ν¬ν†± κ²Œμ΄νŠΈμ›¨μ΄μž…λ‹ˆλ‹€. Guacamole의 νŠΉμ§•μ€ λΈŒλΌμš°μ € 기반의 μΈν„°νŽ˜μ΄μŠ€λ₯Ό μ œκ³΅ν•˜λŠ” μ μž…λ‹ˆλ‹€. 이λ₯Ό 톡해 μ–΄λ–€ ν™˜κ²½μ—μ„œλ“  κ΅¬μ†λ˜μ§€ μ•Šκ³  원격 λ°μŠ€ν¬νƒ‘μ— 접속할 수 μžˆκ²Œν•˜λŠ” 것이 λͺ©μ μž…λ‹ˆλ‹€.

The principle reason to use Guacamole is constant, world-wide, unfettered access to your computers - guacamole.apache.org, "Why use Guacamole?"

예λ₯Ό λ“€μ–΄ 집에 Guacamole μ„œλ²„λ₯Ό μΌœλ‘μ—ˆμ„ λ•Œ, Guacamoleκ°€ 집에 μžˆλŠ” λ°μŠ€ν¬νƒ‘μ— λŒ€μ‹  원격 μ ‘μ†ν•˜κ³ , μ‚¬μš©μžμ™€ λ°μŠ€ν¬νƒ‘μ˜ μ‚¬μ΄μ—μ„œ 톡신을 μ€‘κ³„ν•©λ‹ˆλ‹€.

μ‚¬μš©μžκ°€ guacamole μ„œλ²„μ˜ ip둜 μ ‘μ†ν•˜λ©΄ μ•„λž˜μ™€ 같은 μ›Ή νŽ˜μ΄μ§€ μΈν„°νŽ˜μ΄μŠ€κ°€ ν‘œμ‹œλ©λ‹ˆλ‹€. μ‚¬μš©μžλŠ” 이 μΈν„°νŽ˜μ΄μŠ€λ₯Ό 톡해 μ›ν•˜λŠ” λ°μŠ€ν¬ν†±μ— 원격 접속할 수 μžˆμŠ΅λ‹ˆλ‹€. 덕뢄에 μ–΄λ–€ ν™˜κ²½μ—μ„œλ“  λ³„λ„μ˜ 원격 ν΄λΌμ΄μ–ΈνŠΈ ν”„λ‘œκ·Έλž¨μ„ μ„€μΉ˜ν•  ν•„μš” 없이 μ¦‰μ‹œ 접속할 수 μžˆμŠ΅λ‹ˆλ‹€.

Guacamoleκ°€ κ²Œμ΄νŠΈμ›¨μ΄λΌκ³  ν–ˆμ—ˆμ£ ? μ‚¬μš©μžμ™€ Guacamole μ„œλ²„λŠ” http 톡신을 μ‚¬μš©ν•˜κΈ° λ•Œλ¬Έμ— κ°„ν˜Ή RDP(3899)λ‚˜ VNC(5900), SSH(22) ν¬νŠΈκ°€ λ§‰ν˜€ μžˆλŠ” 경우 μœ μš©ν•˜κ²Œ μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

βš™οΈ μž‘λ™ 원리

Apache GuacamoleλŠ” Tomcat μƒμ—μ„œ λ™μž‘ν•˜μ—¬ μ›Ή νŽ˜μ΄μ§€ μΈν„°νŽ˜μ΄μŠ€λ₯Ό μ œκ³΅ν•˜λŠ” guacamole μ„œλΈ”λ¦Ώ μ»¨ν…Œμ΄λ„ˆμ™€ 원격 μž₯μΉ˜μ— μ—°κ²°ν•˜μ—¬ μ‹€μ§ˆμ μΈ μž…μΆœλ ₯을 μˆ˜ν–‰ν•˜λŠ” guacd 데λͺ¬μœΌλ‘œ 이루어져 μžˆμŠ΅λ‹ˆλ‹€.

πŸ‘¨β€πŸ³ μ„€μΉ˜ν•˜κΈ°

μ„€μΉ˜ λ°©λ²•μœΌλ‘œλŠ” Docker 방식과 Native 방식이 μžˆμŠ΅λ‹ˆλ‹€. Docker 방식은 νŽΈλ¦¬ν•˜κΈ΄ ν•˜μ§€λ§Œ μ˜€λ²„ν—€λ“œκ°€ 있기 λ•Œλ¬Έμ— Native λ°©μ‹μœΌλ‘œ μ§„ν–‰ν•˜κ² μŠ΅λ‹ˆλ‹€.

μ €λŠ” μ•„λž˜μ˜ ν™˜κ²½μ—μ„œ μ„€μΉ˜λ₯Ό μ§„ν–‰ν–ˆμŠ΅λ‹ˆλ‹€.

ν™˜κ²½: Raspberry Pi 4 Model B, Ubuntu 22.04.3 LTS
버전: Tomcat9, Guacamole 1.5.3, OpenJdk 11.0.21

1. Java μ„€μΉ˜

$ sudo apt-get install openjdk-11-jdk

Java 버전이 λ„ˆλ¬΄ λ†’μœΌλ©΄ νŒ¨ν‚€μ§€ λͺ…μ˜ λ³€κ²½μœΌλ‘œ μΈν•œ 좩돌이 λ°œμƒν•  수 μžˆμœΌλ‹ˆ μ£Όμ˜ν•˜μ…”μ•Ό ν•©λ‹ˆλ‹€. μ—¬κΈ°μ„œλŠ” 11 λ²„μ „μœΌλ‘œ μ„€μΉ˜ν•˜κ² μŠ΅λ‹ˆλ‹€.

2. Guacamole Server μ„€μΉ˜

2.1. 라이브러리 μ„€μΉ˜

Guacamole μ„œλ²„λ₯Ό λΉŒλ“œν•˜κΈ° μœ„ν•΄ ν•„μš”ν•œ 라이브러리λ₯Ό μ„€μΉ˜ν•΄μ€λ‹ˆλ‹€. 곡식 μ„€μΉ˜ κ°€μ΄λ“œμ˜ μ˜μ‘΄μ„± λ‹¨λ½μ—μ„œ required dependencies와 optional dependenciesλ₯Ό μ•ˆλ‚΄ν•˜κ³  μžˆμœΌλ‹ˆ μ°Έκ³ ν•΄λ³΄μ‹œλ©΄ 쒋을 것 κ°™μŠ΅λ‹ˆλ‹€.

$ sudo apt install build-essential libcairo2-dev libjpeg-turbo8-dev \
    libpng-dev libtool-bin libossp-uuid-dev libvncserver-dev \
    freerdp2-dev libssh2-1-dev libtelnet-dev libwebsockets-dev \
    libpulse-dev libvorbis-dev libwebp-dev libssl-dev \
    libpango1.0-dev libswscale-dev libavcodec-dev libavutil-dev \
    libavformat-dev

2.2 Guacamole μ†ŒμŠ€μ½”λ“œ λ‹€μš΄λ‘œλ“œ

λ‹€μŒμœΌλ‘œ Guacamole의 μ†ŒμŠ€μ½”λ“œλ₯Ό λ‹€μš΄λ°›μ•„μ£Όκ³  압좕을 ν•΄μ œν•©λ‹ˆλ‹€.

$ wget https://downloads.apache.org/guacamole/1.5.3/source/guacamole-server-1.5.3.tar.gz
$ tar -xvf guacamole-server-1.5.3.tar.gz
$ cd guacamole-server-1.5.3

2.3 Guacamole μ†ŒμŠ€μ½”λ“œ λΉŒλ“œ

λ‹€μš΄λ°›μ€ μ†ŒμŠ€μ½”λ“œλ₯Ό λΉŒλ“œν•©λ‹ˆλ‹€.

$ sudo ./configure --with-init-dir=/etc/init.d --enable-allow-freerdp-snapshots
$ sudo make
$ sudo make install

2.4 λ¦¬λ‘œλ”©

μ—…λ°μ΄νŠΈλœ λΌμ΄λΈŒλŸ¬λ¦¬μ™€ 데λͺ¬μ„ λ‘œλ“œν•©λ‹ˆλ‹€.

$ sudo ldconfig
$ sudo systemctl daemon-reload

2.5 guacd μ‹€ν–‰

guacdλ₯Ό μ‹€ν–‰ν•©λ‹ˆλ‹€.

$ sudo systemctl start guacd
$ sudo systemctl status guacd

2.6 guacd 데λͺ¬ λ“±λ‘ν•˜κΈ°

guacdκ°€ μžλ™μœΌλ‘œ μ‹€ν–‰λ˜λ„λ‘ μ„€μ •ν•©λ‹ˆλ‹€.

$ sudo systemctl enable guacd

3. Guacamole μ›Ή μ• ν”ŒμΌ€μ΄μ…˜ μ„€μ •

3.1 Tomcat μ„€μΉ˜

$ sudo apt install tomcat9 tomcat9-admin tomcat9-common tomcat9-user

3.2 Guacamole Client λ‹€μš΄λ‘œλ“œ

$ wget https://downloads.apache.org/guacamole/1.5.3/binary/guacamole-1.5.3.war
$ sudo mv guacamole-1.5.3.war /var/lib/tomcat9/webapps/guacamole.war

3.3 tomcat, guacd μž¬μ‹œμž‘

$ sudo systemctl restart tomcat9 guacd

4. 인증용 DB μ„€μ •

4.1 maria DB μ„€μΉ˜

μ•„λž˜ λͺ…λ Ήμ–΄λ₯Ό 톡해 maria DBλ₯Ό μ„€μΉ˜ν•©λ‹ˆλ‹€.

$ sudo apt install mariadb-server
$ sudo mysql_secure_installation

참고둜 λŒ€λ¬Έμž, 숫자, νŠΉμˆ˜λ¬Έμžκ°€ 각 1자 이상 ν¬ν•¨λœ 8자리 μ΄μƒμ˜ λΉ„λ°€λ²ˆν˜Έλ‘œ μ§€μ •ν•΄μ£Όμž.

4.2 Mysql Connector μ„€μΉ˜

$ wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.26.tar.gz
$ tar -xf mysql-connector-java-8.0.26.tar.gz
$ sudo mkdir -p /etc/guacamole/lib
$ sudo cp mysql-connector-java-8.0.26/mysql-connector-java-8.0.26.jar /etc/guacamole/lib/

4.3 JDBC Auth plugin μ„€μΉ˜

$ wget https://downloads.apache.org/guacamole/1.5.3/binary/guacamole-auth-jdbc-1.5.3.tar.gz
$ tar -xf guacamole-auth-jdbc-1.5.3.tar.gz
$ sudo mkdir /etc/guacamole/extensions
$ sudo mv guacamole-auth-jdbc-1.5.3/mysql/guacamole-auth-jdbc-mysql-1.5.3.jar /etc/guacamole/extensions/

4.4 guacamole 계정 생성

μ•„λž˜μ—μ„œ μžμ‹ μ˜ νŒ¨μŠ€μ›Œλ“œ 뢀뢄은 μˆ˜μ •ν•΄ μ‹€ν–‰ν•˜μ‹œλ©΄ λ©λ‹ˆλ‹€.

$ mysql -u root -p

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'μžμ‹ μ˜ νŒ¨μŠ€μ›Œλ“œ';
mysql> CREATE DATABASE guacamole_db;
mysql> CREATE USER 'guacamole_user'@'localhost' IDENTIFIED BY 'μžμ‹ μ˜ νŒ¨μŠ€μ›Œλ“œ';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole_user'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit

4.5 scheme 파일 μ„€μ •

$ cd guacamole-auth-jdbc-1.5.3/mysql/schema
$ cat *.sql | mysql -u root -p guacamole_db

4.6 DB 접속 정보 μ„€μ •

$ sudo vim /etc/guacamole/guacamole.properties

μ•„λž˜μ˜ λ‚΄μš©μ„ λ„£μ–΄μ£Όμ‹œλ©΄ λ©λ‹ˆλ‹€.

# MySQL properties
mysql-hostname: 127.0.0.1
mysql-port: 3306
mysql-database: guacamole_db
mysql-username: guacamole_user
mysql-password: [μžμ‹ μ˜ νŒ¨μŠ€μ›Œλ“œ]

4.7 μ„œλΉ„μŠ€ μž¬μ‹€ν–‰

$ sudo systemctl restart tomcat9 guacd mysql

4.8 μ„œλΉ„μŠ€ λ™μž‘ 둜그 확인

Tomcat μ„œλ²„ 둜그λ₯Ό 확인해 였λ₯˜λŠ” μ—†λŠ”μ§€, μžˆλ‹€λ©΄ μ–΄λ–€ λΆ€λΆ„μ—μ„œ λ°œμƒν•˜λŠ”μ§€ ν™•μΈν•΄λ΄…μ‹œλ‹€.

$ tail -f /var/lib/tomcat9/logs/catalina.out

🐣 계정 μ„€μ •

λΈŒλΌμš°μ €λ‘œ μ ‘μ†ν•˜λ©΄ λ‹€μŒκ³Ό 같은 νŽ˜μ΄μ§€λ₯Ό 확인할 수 μžˆμŠ΅λ‹ˆλ‹€. 초기 아이디, λΉ„λ°€λ²ˆν˜ΈλŠ” guacadmin둜 λ™μΌν•©λ‹ˆλ‹€.

κΈ°λ³Έ 계정은 μ·¨μ•½ν•˜κΈ° λ•Œλ¬Έμ— μƒˆλ‘œμš΄ κ΄€λ¦¬μž 계정을 생성해야 ν•©λ‹ˆλ‹€. (1) 우츑 μƒλ‹¨μ˜ 계정을 눌러 (2) 'μ„ΈνŒ…'을 μ„ νƒν•©λ‹ˆλ‹€.

(1) μ‚¬μš©μž 탭을 μ„ νƒν•˜κ³  (2) μƒˆ μ‚¬μš©μž λ²„νŠΌμ„ ν΄λ¦­ν•©λ‹ˆλ‹€.

μ‚¬μš©μž 이름과 λΉ„λ°€λ²ˆν˜Έλ₯Ό μž…λ ₯ν•˜κ³  λͺ¨λ“  κΆŒν•œμ„ μ€€ λ’€ μ €μž₯ν•©λ‹ˆλ‹€. λ§ˆμ§€λ§‰μœΌλ‘œ, μƒˆλ‘­κ²Œ μƒμ„±ν•œ κ΄€λ¦¬μž κ³„μ •μœΌλ‘œ λ‘œκ·ΈμΈν•œ λ’€ κΈ°λ³Έ κ΄€λ¦¬μž 계정(guacadmin)을 μ‚­μ œν•΄μ£Όλ©΄ Guacamoleλ₯Ό μ‚¬μš©ν•  λͺ¨λ“  μ€€λΉ„κ°€ λλ‚©λ‹ˆλ‹€.

μ—…λ‘œλ“œμ€‘..

πŸ”’ HTTPS μ„€μ •

원격 λ°μŠ€ν¬νƒ‘μ˜ ν™”λ©΄κ³Ό ν‚€λ³΄λ“œ λ“±μ˜ 정보가 μ†‘μˆ˜μ‹ λ˜κΈ° λ•Œλ¬Έμ— μ™ΈλΆ€μ—μ„œ 접속할 λ•ŒλŠ” λ°˜λ“œμ‹œ HTTPS 섀정을 ν•΄μ£Όμ…”μ•Ό ν•©λ‹ˆλ‹€. 이 λ‚΄μš©κΉŒμ§€ 닀루면 글이 λ„ˆλ¬΄ κΈΈμ–΄μ§€λ‹ˆ 후속 κΈ€μ—μ„œ λ‹€λ£¨κ² μŠ΅λ‹ˆλ‹€.

πŸ“œ References

0개의 λŒ“κΈ€