Friday, June 5, 2015

Part 5 - Installing SSH Dropbear on Centos 6 64Bit

Hello, today i want to share about how to install SSH Dropbear into Centos 6 64Bit, but, as usually, before we install, we must knowing first, what and how SSH Dropbear is.
Dropbear is a software package written by Matt Johnston that provides a Secure Shell-compatible server and client. It is designed as a replacement for standard OpenSSH for environments with low memory and processor resources, such as embedded systems. It is a core component of OpenWrt and other router distributions, that is according to wikipedia.
Honestly, this is the first time i read explanation about Dropbear :P, confuse?? yes me too, no idea about that explanation, maybe its too theoritically, but to implement dropbear, its not that hard, i have used it :P, okay, dont ask about what is dropbear is, just follow the instruction, and you will know how to use dropbear.


Step 1. Download and Set Permission for auto install
Open your terminal using PuTTY or your favourite SSH Client, and type below per line
wget https://raw.githubusercontent.com/zaq111/bash/master/angelimus-ssh-dropbear.sh
chmod +x angelimus-ssh-dropbear.sh && ./angelimus-ssh-dropbear.sh

you will be prompt 3 times, when prompted, type "y" and press enter.

 First prompt

 Second prompt

Third prompt
after it done, you will see [Failed]
don't panic, i'll explain in step 2

Step 2. Editing  /etc/init.d/dropbear
Now we will editing dropbear. Type
vim /etc/init.d/dropbear

find :
# pidfile: /var/run/dropbear.pid

below # pidfile: /var/run/dropbear.pid, add this (see pic above )
OPTIONS="-p 443"
and then press ESC and type :wq

in step 1, we see failed when starting dropbear, why? because before dropbear start, it read all configuration in /etc/init.d/dropbear and, there are no setting at all in what port that dropbear must running?? thats why, we must add OPTIONS="-p 443"it tell dropbear to run in port 443, simple right :P ok, lets continue.
Now we will try starting dropbear again.
service dropbear start

see??? no problem at all, it smoothly running :P
now, we want to dropbear start automatically each time VPS restart or start, type this
chkconfig dropbear on

Step 3. Create SSH user
Now we will create user that will used SSH
Open terminal and type 
adduser mynewssh
passwd mynewssh

you will be prompted to enter password for user mynewssh.
ATTENTION!!! Since user SSH Dropbear can access terminal, there are a few thing you must remember.
1. If you gave to your friend your SSH User and Password, he/she can access your terminal, ftp and do whatever he/she like
2. For better security, you must make SSH user that you create can't login to your terminal
3. If you use for yourself or personal use only, not for sharing to other people, ignore this attention, and ignore below part about Disable User SSH from accessing SHELL/FTP

Disable User SSH from accessing terminal
For security reason, i personally support you to disable SSH user to access shell/terminal or ftp
type below
usermod -s /sbin/nologin mynewssh

Step 4. Using SSH
In this step i recomend you to using bitvise as client
Download bitvise first from http://dl.bitvise.com/BvSshClient-Inst.exe
Install it then open.
Hostname : <your ip VPS> eg: 31.291.42.10 or mynewserver.com
Port : 443 (For free service in VPS.me see Step 5)
Username = mynewssh
Password = (insert password when you create user mynewssh)

Go to option tab
See on login section, if you disable user from accessing terminal, then make sure Open terminal is untick (see pic above)

Now click on login, you will see set of information about your ssh show up.
- after you click login, you will see a certificate, just click ok or yes.
- after that, you will see similar like pic above.

Now, our SSH is running, but how to use it?? lets try.
- After login in bitvise, open tab Service
Your SOCKS/HTTP Proxy Forwarding must ticked
Listen interface = 127.0.0.1
Listen port = 1080 (this what is use) or 1081 or 9090 or 6642, input port as you like
Bind IPv4 interface = 0.0.0.0

Next :
- Open Mozilla Firefox
- Check your IP (whatismyip.com) remember it
- Go to Tools > Option > Advanced > Network Tab
- Click on Settings...
SOCKS Host = 127.0.0.1
Port = 1080 (must same with port in bitvise service tab)

- Click OK, and then Check your IP (whatismyip.com) again.
- I hope you understand capability of SSH, it will use VPS network on your Firefox browser, and it use your VPS bandwidth quota too, so be carefull when you downloading, because it will consume VPS bandwidth (free service in VPS.me only provided 10GB Part 1 - Let's Start VPS).

Now you are done Installing SSH Dropbear, Add user, and using Dropbear, but i'm sure there lot of function od dropbear beside my example above, just googling, you will find answer there.

Step 5. IPv4 Mapping (For VPS.me only)
If you using paid service in VPS.me or in other VPS Host, ignore this step. This step only for user that using free service in VPS.me

- Login to your VPS.me control panel
- Click manage
- Find IPv4 Mapping and click it
Input Port name = ss1
Source Port = (add port that hasn't been used by other, ex : 8721 or 4221 or 1128, etc, this need patient, because maybe port has been taken by other, so keep trying) 
Destination Port = 443
then click Add New

- Open your bitvise
- Change Port to port number that you assign in control panel VPS.me (see pic above in Source Port)
- If you still confuse about IPv4, see previous tutorial (Part 4 - Installing Wordpress To Centos 6, in section Step 5)

Ex : i assume you get Source Port = 7238 in VPS.me IPv4 Mapping (see pic below)

so, in bitvise, the port is must 7238 (see pic below)


Thats all, thanks for reading my tutorial, see you in next tutorial
For reference about What is SSH, Installing SSH Dropbear on Centos 6, Function of SSH

If you have more reference about installing SSH Dropbear or about SSH, post it on comment section.
I will add it to this artice, thanks.

If you can't explain it to a six year old, you don't understand it yourself. - Albert Einstein

0 comments:

Post a Comment