隨手記錄-linux-Shellinabox插件

Shellinabox 是一個利用 Ajax 技術構建的基於 Web 的遠程Terminal 模擬器,也就是說安裝了該軟件以後,不須要開啓 ssh服務,經過 Web 網頁就能夠對遠程主機進行維護操做了,出於安全考慮, Shellinabox 默認強制使用了https協議,這是個挺有趣的技術,於是就在rhel6上面折騰了下,下面記錄了主要的操做步驟linux

一:編譯安裝Shellinabox
[root@rhel6 ~]# cd /usr/local/src/tarbag/
[root@rhel6 tarbag]# wgethttp://shellinabox.googlecode.com/files/shellinabox-2.10.tar.gz
[root@rhel6 tarbag]# tar -zxvf shellinabox-2.10.tar.gz -C ../software/
[root@rhel6 tarbag]# cd ../software/shellinabox-2.10/
[root@rhel6 shellinabox-2.10]# ./configure --prefix=/usr/local/shellinabox
[root@rhel6 shellinabox-2.10]# make && make installgit

或源碼安裝:https://github.com/shellinabox/shellinaboxgithub

二:試啓動Shellinabox,能夠加上--help參數查看啓動選項,這裏能夠看到默認Shellinabox採用https方式啓動
[root@rhel6 ~]# /usr/local/shellinabox/bin/shellinaboxd
Cannot read valid certificate from "certificate.pem". Check file permissions and file format.shell

[root@rhel6 ~]# /usr/local/shellinabox/bin/shellinaboxd -b -t  //-b選項表明在後臺啓動,-t選項表示不使用https方式啓動,默認以nobody用戶身份,監聽TCP4200端口安全

[root@rhel6 ~]# netstat -ntpl |grep shell
tcp        0      0 0.0.0.0:4200                0.0.0.0:*                   LISTEN      16823/shellinaboxdssh

[root@rhel6 ~]# killall  shellinaboxdtcp


三:生成pem證書,以https方式啓動,pem證書的格式爲公鑰加私鑰,並以x509的格式進行打包
[root@rhel6 ~]# openssl genrsa -des3 -out my.key 1024  
[root@rhel6 ~]# openssl req -new -key my.key  -out my.csr
[root@rhel6 ~]# cp my.key my.key.org
[root@rhel6 ~]# openssl rsa -in my.key.org -out my.key
[root@rhel6 ~]# openssl x509 -req -days 3650 -in my.csr -signkey my.key -out my.crt
[root@rhel6 ~]# cat my.crt my.key > certificate.pemgoogle

[root@rhel6 ~]# /usr/local/shellinabox/bin/shellinaboxd -c /root -u root -b  //-c參數指定pem證書目錄,默認證書名爲certificate.pem,-u 選項指定啓動的用戶身份
[root@rhel6 ~]# netstat -ntpl |grep 4200
tcp        0      0 0.0.0.0:4200                0.0.0.0:*                   LISTEN      26445/shellinaboxdcode

[root@rhel6 ~]# ps -ef |grep shell
root     26445     1  0 14:03 ?        00:00:00 /usr/local/shellinabox/bin/shellinaboxd -c /root -u root -b
root     26446 26445  0 14:03 ?        00:00:00 /usr/local/shellinabox/bin/shellinaboxd -c /root -u root -borm

 

轉自:

https://www.linuxidc.com/Linux/2011-01/31678.htm

相關文章
相關標籤/搜索