SSH תוסינכ רובע (לגוג תמאמ) ימרוג-וד תומיא רידגהל דציכ


.רבחתמ התאשכ ךלש בשחמהמ וא ןופטראמסהמ תומיאה דוק תא ןיזהל ךילע היהי .SSH יתרשל רוביח תעב (TOTP) ןמזב אמסיס תומיא דוק .יארקא לודומ ןיזהל ךל רשפאמה (ימרוג-וד תומיא) לגוג תמאמ לודומ ףיסוהל לכ

.(חותפ תומיאל OATH תמזוי ידי לע ורצונש םיחותפ םיטרדנטס תועצמאב םירצונ ולא םיימעפ דח המסיס ידוק .(Pluggable תומיא לודומ) PAM -ב םג ומכ ,תודיינ תומרופטלפ רפסמב ךמות אוה .לגוג ידי לע חתופש (T

.Debian -ו Ubuntu, Linux Mint -ו Red Hat, CentOS, Fedora תחת ימרוג-וד תומיאל SSH לש הרוצתה תא רידגהלו ןיקתהל דציכ םכל הארא הז רמאמב

לגוג תמאמ לודומ ןיקתמ

.Google לש תומיאה לודומ םע הכלהכ דובעל ידכ PAM -ה לודומל תושורדה חותיפה תוירפס םע דחי תואבה PAM -ה תוירפס תא ןקתהו ימרוג-וד תומיא רידגהל ךנוצרבש הנוכמה תא חתפ

.'pam-devel' תליבח תא תוניקתמ הרודפו CentOS תוכרעמ ,טאה דר תוכרעמב

# yum install pam-devel make automake libtool gcc-c++ wget

.'libpam0g-dev' תליבח תא תוניקתמ ןאיבדו הטנמ סקוניל תוכרעמ ,וטנובוא לע

# apt-get install libpam0g-dev make automake libtool gcc-c++ wget

.האבה git תדוקפ תועצמאב (שרושה לש תיבה תיירפסב רבוחמ רבכ התאש חיננ) תיבה תיירפס תחת לגוג לש תמאמה לודומ תא ןקתהו טביש תעכ

# git clone https://github.com/google/google-authenticator-libpam.git
# cd google-authenticator-libpam/
# ./bootstrap.sh
# ./configure
# make
# make install
# google-authenticator

.תורדגהה תא ספאל ידכ 'google-authenticator' הדוקפה תא בוש דילקהל לוכי התא ,שבתשמ והשמ םא .בצמה בורב הבושתכ (ןכ) "y" דילקהל אוה תושעל ךילעש לכ .תיניצר הלאשב ךתוא החנת איה ,'google-authentic

    .Google לש תמאמה תייצקילפא תא רידגהל ידכ ךשמהב 'ידוסה חתפמה' תא ךרטצנ ,והשפיא הלאה םיטרפה תא בותכ .ךלש' םוריחה ידוק'ו 'ידוסה חתפמה' תא לבקת ,וז הלאש רחאל

     google-authenticator
    
    Do you want authentication tokens to be time-based (y/n) y
    https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/[email %3Fsecret%3DXEKITDTYCBA2TLPL
    Your new secret key is: XEKITDTYCBA2TLPL
    Your verification code is 461618
    Your emergency scratch codes are:
      65083399
      10733609
      47588351
      71111643
      92017550
    

    .ןלהל גצומכ (ןכ) "y" -כ הבושתה תא דלקה םירקמה בורבו הנקתהה ףשא רחא בוקע ,ןכמ רחאל

    Do you want me to update your "/root/.google_authenticator" file (y/n) y
    
    Do you want to disallow multiple uses of the same authentication
    token? This restricts you to one login about every 30s, but it increases
    your chances to notice or even prevent man-in-the-middle attacks (y/n) y
    
    By default, tokens are good for 30 seconds and in order to compensate for
    possible time-skew between the client and the server, we allow an extra
    token before and after the current time. If you experience problems with poor
    time synchronization, you can increase the window from its default
    size of 1:30min to about 4min. Do you want to do so (y/n) y
    
    If the computer that you are logging into isn't hardened against brute-force
    login attempts, you can enable rate-limiting for the authentication module.
    By default, this limits attackers to no more than 3 login attempts every 30s.
    Do you want to enable rate-limiting (y/n) y
    

    Google לש תמאמה לודומב שומישל SSH לש הרוצת תרדגה

    .ץבוקה שארל האבה הרושה תא ףסוהו 'PAM '/etc/pam.d/sshd -ה לש הרוצתה ץבוק תא חתפ

    auth       required     pam_google_authenticator.so

    .תרמואש הרושה תא אוצמל ידכ הטמ לולגו 'SSH '/ etc/ssh/sshd_config לש הרוצתה ץבוק תא חתפ ,ןכמ רחאל

    ChallengeResponseAuthentication no

    .הזכ היהנ הז זא ." ןכ"ל ותוא הנש

    ChallengeResponseAuthentication yes

    .םישדח םייוניש עצבל ידכ SSH תוריש תא שדחמ לעפה ,ףוסבל

    # /etc/init.d/sshd restart

    לגוג לש תמאמה תייצקילפא לש הרוצת תעיבק

    .ךלש Android/iPhone/Blackberry ירישכמב לגוג לש תמאמה תייצקילפא תא ןיקתהלו דירוהל לכות ,וז היצקילפא ךל ןיא םא ."ןובשח רדגה" רחבו טירפת לע ץחל .ךלש ןופטראמסב Google Authenticator תייצקיל

    ."קפוסמ ןזה שקמ"\לע ץחל

    .ןכל םדוק רצונש 'ידוסה חתפמה' תא ןזהו 'םש' ךנובשח תא ףסוה

    .ךלש ןופלטב תוינש 30 לכ ןמזה לכ הנתשתש (תומיא דוק) תימעפ דח המסיס רוציי הז

    .שדח תומיא דוק שדחי הז עגעגתמ התא םא ,הזה תומיאה דוק תא ןיזהל תוינש 30 קר ךל שי .SSH תועצמאב רבחתהל הסנתש םעפ לכב המסיסו (תומיא דוק) לגוג תמאמ דוק לבקל שקבתת ,SSH תועצמאב רבחתהל הסנ תעכ

    login as: tecmint
    Access denied
    Using keyboard-interactive authentication.
    Verification code:
    Using keyboard-interactive authentication.
    Password:
    Last login: Tue Apr 23 13:58:29 2013 from 172.16.25.125
    

    .ימרוג-וד תומיא עצבל ידכ GAuth Authenticator ארקנש Firefox ףסותב שמתשהל םג לוכי התא ,םכח ןופלט ךל ןיא םא

    .תורישי רבחתתו ימרוג-וד תומיאמ םלעתת איה ,ירוביצ/יטרפ חתפמ לש SSH תלעפה לכב שמתשמ התא םא .המסיס תססובמ SSH הסינכ םע דבוע ימרוג-ודה תומיאה :בושח