Changes between Version 4 and Version 5 of netsec2018ssh


Ignore:
Timestamp:
Jun 7, 2018, 7:10:53 AM (6 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • netsec2018ssh

    v4 v5  
    6969 - Click the Save button for the Load, Save or Delete a stored session area.
    7070Now you can go ahead and log in and you will not be prompted for a password. However, if you had set a passphrase on your public key, you will be asked to enter the passphrase at that time (and every time you log in, in the future).
     71
     72== Two Factor Authenticating ==
     73We will enable two factor authentication in out ubuntu server. To implement that we are going to use multifactor authentication with Google Authenticator.
     74
     75=== Google auhtenticator ===
     76 - Install Google Authenticator from following link in your Android device/iPhone/iPad/BlackBerry/Firefox devices
     77{{{
     78https://support.google.com/accounts/answer/1066447?hl=en
     79}}}
     80 - Follow the instruction and install the app in your mobile.
     81 - Or you can search for google-autheticator in Google Play or Apple Store.
     82
     83=== Create an Authentication Key ===
     84 - Go to the Ubuntu VM
     85 - Install google-authenticator module first:
     86{{{
     87sudo apt-get update
     88sudo apt-get install libpam-google-authenticator
     89}}}
     90 - Log in as the user you’ll be logging in with remotely and run the google-authenticator command to create a secret key for that user.
     91{{{
     92$ google-authenticator
     93
     94Do you want authentication tokens to be time-based (y/n) y
     95}}}
     96 - You will get some QR code ouput like bellow:
     97
     98
     99You will be prompted for some configurations.
     100 - Scan the QRcode that appears with the Google Authenticator app or you can add the secret key Google Authenticator app.
     101 - Save the backup codes listed somewhere safe. They will allow you to regain access if you lose your phone with the Authenticator app.
     102 - Next it will ask several question; unless you have a good reason to, the defaults presented are sane. Just enter "y" for them.
     103{{{
     104Do you want me to update your "/home/fakrul/.google_authenticator" file (y/n)
     105Do you want to disallow multiple uses of the same authentication
     106token? This restricts you to one login about every 30s, but it increases
     107your chances to notice or even prevent man-in-the-middle attacks (y/n)
     108By default, tokens are good for 30 seconds and in order to compensate for
     109possible time-skew between the client and the server, we allow an extra
     110token before and after the current time. If you experience problems with poor
     111time synchronization, you can increase the window from its default
     112size of 1:30min to about 4min. Do you want to do so (y/n)
     113If the computer that you are logging into isn't hardened against brute-force
     114login attempts, you can enable rate-limiting for the authentication module.
     115By default, this limits attackers to no more than 3 login attempts every 30s.
     116Do you want to enable rate-limiting (y/n)
     117}}}
     118
     119=== Enable two factor authentication for SSH ===
     120 - Edit the /etc/pam.d/sshd file
     121{{{
     122sudo vi /etc/pam.d/sshd
     123}}}
     124 - Add the following line:
     125{{{
     126auth required pam_google_authenticator.so
     127}}}
     128 - ''':wq''' Save and quit.
     129 - Edit /etc/ssh/sshd_config file
     130{{{
     131sudo vi /etc/ssh/sshd_config
     132}}}
     133 - Search for '''ChallengeResponseAuthentication''' and replace no with yes
     134{{{
     135ChallengeResponseAuthentication yes
     136}}}
     137 - ''':wq''' Save and quit.
     138 - Now you need to reload the ssh service. You can do it to way:
     139{{{
     140sudo service ssh restart
     141}}}
     142
     143=== Login to the server ===
     144Try to ssh to the server from a new terminal. It will ask for the verification code.