웹브라우저를 통해 SSH 터미널 접속하는 방법입니다.
특정 업체에서는 해당 소스를 이용해서 가상화 콘솔모드로도 사용하는걸로 보여지기도 합니다. 셋팅은 간단하며 여기서는 Ubuntu 14.04 버전으로 테스트하였습니다.
이전에 언급한 다른방법은 아래 링크를 참고하세요
웹브라우저 SSH
– http://idchowto.com/?p=7049
– http://idchowto.com/?p=8179
웹브라우저 VNC
– http://idchowto.com/?p=7043
Ajaxterm – Web Based SSH Terminal Client
Overview
Ajaxterm is a web based terminal. It was totally inspired and works almost exactly like Anyterm except it’s much easier to install.
Ajaxterm written in python (and some AJAX javascript for client side) and depends only on python2.3 or better.
Ajaxterm is very simple to install on Linux, MacOS X, FreeBSD, Solaris, cygwin and any Unix that runs python2.3.
Ajaxterm was written by Antony Lesuisse (email: al AT udev.org), License Public Domain.
Ajaxterm INSTALL
# apt-get install ajaxterm
/etc/ssh/sshd_config
:: 패스워드 인증 주석해제
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes
설정파일 :
– /etc/default/ajaxterm
– 웹기본포트 8020 / SSH 접속기본포트 22
– 수정이 필요하면 아래 설정파일 주석해제후 원하는 포트로 설정
# Allow to change the default port used by Ajaxterm
#PORT=”8022″
# Allow to use a different port than 22 to connect to the ssh server
#SERVERPORT=”22″
콘솔화면 설정 :
– /etc/ajaxterm.conf
// Sets the terminal width (default: 80)
width=80;
// Sets the terminal height (default: 25)
height=25;
Apache INSTALL
# apt-get install apache2 openssl apache2-utils
# a2enmod proxy proxy_http proxy_connect ssl
Enabling module proxy.
Considering dependency proxy for proxy_http:
Module proxy already enabled
Enabling module proxy_http.
Considering dependency proxy for proxy_connect:
Module proxy already enabled
Enabling module proxy_connect.
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl.
See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
service apache2 restart
보안을 위해 웹페이지 아파치 인증설정
:: htpasswd -bc /srv/ajaxterm/.htpasswd [USER] [PASSWORD]
# htpasswd -bc /srv/ajaxterm/.htpasswd mojily XXXXXXXXX
아파치 설정파일 추가
# vim /etc/apache2/sites-available/ajaxterm.conf
<VirtualHost 115.XXX.XXX.XXX:80>
ServerName 115.XXX.XXX.XXX
ProxyRequests Off
ProxyVia Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:8022/
ProxyPassReverse / http://localhost:8022/
<Location />
Order allow,deny
Allow from all
AuthName “Access Restricted”
AuthType Basic
AuthUserFile “/etc/apache2/.htpasswd”
Require valid-user
</Location>
LogLevel info
CustomLog /var/log/apache2/access_ajaxterm.log combined
ErrorLog /var/log/apache2/error_ajaxterm.log
</VirtualHost>
서비스 재시작
# a2ensite ajaxterm
Enabling site ajaxterm.
To activate the new configuration, you need to run:
service apache2 reload
# /etc/init.d/ajaxterm restart
# /etc/init.d/apache2 restart
※ 여기서는 80번포트로 웹을 설정하였으며 443 포트로 설정하는걸 권장해드립니다.
프로세서 리스트 확인
# ps -aux |grep ajaxterm
ajaxterm 13745 1.4 0.2 494944 9756 pts/3 Sl 14:06 0:00 python /usr/share/ajaxterm/ajaxterm.py –daemon –port=8022 –serverport=22 –uid=ajaxterm
ajaxterm 13866 0.1 0.0 44140 2928 pts/1 Ss+ 14:06 0:00 ssh -oPreferredAuthentications=keyboard-interactive,password -onoHostAuthenticationForLocalhost=yes -oLogLevel=FATAL -F/dev/null -p 22 -l smileserv localhost
root 14015 0.0 0.0 12964 924 pts/3 S+ 14:06 0:00 grep –color=auto ajax
[polldaddy rating=”7739789″]