Posted: 2007-07-12 13:58, Edited: 2007-07-12 22:58
Melihat judul diatas, mungkin kita agak bingung
apakah "aman" ?
mungkin kita harus melihat langkah? yang di lakukan, sehingga kita bisa mengambil kesimpulan
apakah "aman" jika kita melakukan ssh tanpa menggunakan password
konfigurasi pada client
ada 2 versi yang digunakan oleh protokol ssh, versi 1 dan 2
namun kebanyakan yang digunakan adalah versi 2
jenis? identitas yang bisa dipakai
Protokol type
Versi 1 RSA1
Versi 2 RSA
Versi 2 DSA
setelah memilih jenis protokol dan type yang kita ingin gunakan, sekarang kita membuat private dan public key untuk ssh, untuk contoh kita menggunakan enkripsi DSA, pada box client kita bisa mengetik perintah
blackbox ~ # ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
4f:80:04:af:c4:7e:88:2d:a8:3f:e0:f8:b7:4f:3b:b0 root@blackbox
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
4f:80:04:af:c4:7e:88:2d:a8:3f:e0:f8:b7:4f:3b:b0 root@blackbox
proses diatas akan membuat 2 files di ~/.ssh
blackbox ~ # ls -la ~/.ssh/
total 16
drwx------ 2 root root 4096 Jun 8 02:45 .
drwx------ 4 root root 4096 Jun 8 02:45 ..
-rw------- 1 root root 668 Jun 8 02:45 id_dsa
-rw-r--r-- 1 root root 603 Jun 8 02:45 id_dsa.pub
total 16
drwx------ 2 root root 4096 Jun 8 02:45 .
drwx------ 4 root root 4096 Jun 8 02:45 ..
-rw------- 1 root root 668 Jun 8 02:45 id_dsa
-rw-r--r-- 1 root root 603 Jun 8 02:45 id_dsa.pub
konfigurasi pada server
file id_dsa.pub adalah public key kita, yang harus kita copy ke server yang akan kita remote
kemudian file tersebut kita rename ke file ~/.ssh/authorized_keys pada server , jika file tersebut sudah ada
kita tinggal menambahkan isi dari id_dsa.pub kita ke file ~/.ssh/authorized_keys pada server
blackbox ~ # cd ~/.ssh
blackbox .ssh # scp id_dsa.pub root@remotebox:
Password:
(masukkan password untuk transfer file)
id_dsa.pub 100% 603 0.6KB/s 00:00
blackbox .ssh # scp id_dsa.pub root@remotebox:
Password:
(masukkan password untuk transfer file)
id_dsa.pub 100% 603 0.6KB/s 00:00
kemudian kita login ke remote server
blackbox ~ #ssh -l remotebox
Password:
Last login: Thu Jun 7 04:46:07 2007 from blackbox
Password:
Last login: Thu Jun 7 04:46:07 2007 from blackbox
masukkan isi file id_dsa.pub ke ~/.ssh/authorized_keys
remotebox ~ #mkdir -p .ssh
remotebox ~ #chmod 700 .ssh
remotebox ~ #cat id_dsa.pub >> .ssh/authorized_keys
remotebox ~ #chmod 600 .ssh/authorized_keys
remotebox ~ #chmod 700 .ssh
remotebox ~ #cat id_dsa.pub >> .ssh/authorized_keys
remotebox ~ #chmod 600 .ssh/authorized_keys
kemudian hapus id_dsa.pub, dan logout
remotebox ~ #rm id_dsa.pub
remotebox ~ #exit
remotebox ~ #exit
atau bisa menjalankan perintah
cat ~/.ssh/id_dsa.pub | ssh root@remotebox "(mkdir .ssh&>/dev/null; chmod 700 .ssh && cat - >> .ssh/authorized_keys )&&chmod 600 .ssh/authorized_keys"
khusus untuk pengguna gentoo, kita bisa menggunakan perintah ssh-installkeys
untuk menginstallnya kita bisa mengetikkan
blackbox ~ #echo "net-misc/ssh-installkeys" >> /etc/portage/package.keywords
blackbox ~ #emerge -av net-misc/ssh-installkeys
blackbox ~ #emerge -av net-misc/ssh-installkeys
kemudian kita tinggal mengetikkan
blackbox ~ #ssh-installkeys username@remotebox
ssh-installkeys akan melakukan semua yang telah kita lakukan sebelumnya
yah ... itulah salah satu kemudahan dari pengguna gentoo (iklan .red)
Testing
blackbox ~ #ssh -l root remotebox
Last login: Fri Jun 8 03:34:54 2007 from blackbox
remotebox ~ #
Last login: Fri Jun 8 03:34:54 2007 from blackbox
remotebox ~ #
jika remote server tidak meminta password, maka seharusnya langkah yang kita lakukan sudah berhasil
tapi jika remote server masih meminta password, maka coba lihat file sshd_config , kemudian ubah config berikut
# Allow Identity Auth for SSH1
RSAAuthentication yes
# Allow Identity Auth for SSH2
PubkeyAuthentication yes
RSAAuthentication yes
# Allow Identity Auth for SSH2
PubkeyAuthentication yes
selamat mencoba ....
FYI, ssh tanpa password ini bisa digunakan untuk memaintenance komputer dari remote tanpa harus login






