• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            從頭再來

            Linux 服務(wù)器配置證書登陸


            一、背景
            項(xiàng)目需要,研究了使用ossec ,其中有一個(gè)ossec agentless的功能,可以實(shí)現(xiàn)遠(yuǎn)程的文件完整性校驗(yàn) 。為方便使用, 決定采用證書模式來處理登陸。


            二、配置過程

            以下直接抄了  http://praetorianprefect.com/archives/2009/11/ossec-agentless-to-save-the-day/

            obsd46# sudo -u ossec ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/var/ossec/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /var/ossec/.ssh/id_rsa. Your public key has been saved in /var/ossec/.ssh/id_rsa.pub. The key fingerprint is: b8:c3:47:9a:33:09:5c:eb:54:a0:82:39:a6:06:63:08 ossec@obsd45.ptnsecurity.com   The key's randomart image is: +--[ RSA 2048]----+ |E     .          | |oo   . .         | |Bo. . . .        | |=o o . +         | |..  o + S        | |.    = *         | |      @ .        | |       =         | |                 | +-----------------+ 

            Now that the SSH keys are present, we can add the host without a password. The special command line argument used with register_host.sh is NOPASS in all capitals, which will tell OSSEC supplied scripts to make use of SSH keys.

            obsd46# /var/ossec/agentless/register_host.sh add root@172.17.20.20   NOPASS 

            Enabling SSH key on the host to be monitored.

            You will now need to securely get the contents of /var/ossec/.ssh/id_rsa.pub to 172.17.20.20.

            Using SSH and the password for a single time will make this simple. This will create the /root/.ssh if it is not already created, but might throw an error as it does if the directory is already present. This is not a problem and can be ignored.

            obsd46# cat /var/ossec/.ssh/id_rsa.pub | ssh root@172.17.20.20   "( mkdir /root/.ssh/;  cat - >> /root/.ssh/authorized_keys )" root@172.17.20.20  's password: mkdir: cannot create directory `/root/.ssh/': File exists obsd46# ssh root@172.17.20.20   "cat  /root/.ssh/authorized_keys " root@172.17.20.20  's password: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzyTBo7CqkI0TISR9S+KPS/gYY60nkD7Qe8wTTXrAEFvPNFJ NJJpVVKsij6zw86lvTZ6hx9ib1M+MXvt+70uF/z1hYwnYrczR2TR03Z5nwOUA9OK61nBWXVwCi9GsQs6Oeo mY9vkBDoKzB52+TKKSk9ZoC+HYPiT5SaiHZvMOV7kWuwF67lnYwlG5FdkRdOiXp7DcRjje4/Hixg7RLLl7o dEXpIakzGfalt3yQDmwvSUZhyg3OuoKimTeNiKU/jlHlmEPuDZpiQe6QhFH38EeEIZTdHsYITodl8sY+n9I eNMalGIHPs+bph+qcK+6cOb1RGaeGqJBFjaqPUyismz0bw== ossec@obsd45.ptnsecurity.com   

            We can also verify that it worked with the following command.

            obsd46# sudo -u ossec ssh root@172.17.20.20   The authenticity of host '172.17.20.20 (172.17.20.20)' can't be established. RSA key fingerprint is 14:cd:f2:e9:c3:5b:07:28:68:75:a7:b5:88:c2:6b:77. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '172.17.20.20' (RSA) to the list of known hosts. Last login: Tue Oct  6 12:40:05 2009 from 172.17.20.154 [linux26.ptnsecurity.com ~]# exit 

            三、問題
            在以上各種折騰完成后,使用root賬號(hào)已經(jīng)可以正常登陸使用了
            但在使用普通賬號(hào)的mytest時(shí)卻一直失敗。 經(jīng)網(wǎng)上搜索有以下版本的信息

            http://www.2cto.com/os/201206/137286.html
            http://serverfault.com/questions/230771/ssh-configuration-publickeys-permission-denied-publickey-password-error 
            另外還有一個(gè)網(wǎng)址一時(shí)忘記了。

            中途試著將密碼鑒權(quán)關(guān)閉,直接報(bào)錯(cuò):
            Permission denied (publickey,gssapi-keyex,gssapi-with-mic).  

            最終查看 /var/log/secure Authentication refused: bad ownership or modes for directory /home/mytest/.ssh

            想起來我忘記的那個(gè)網(wǎng)址上有一句話: .ssh 目錄需要是 755 不能是775 。。。然后修改就搞定了!!!!完成收工。

            posted on 2014-04-01 14:20 易寶@byhh 閱讀(500) 評(píng)論(0)  編輯 收藏 引用


            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            亚洲精品久久久www| 韩国无遮挡三级久久| 伊人热人久久中文字幕| 人妻丰满AV无码久久不卡| 久久婷婷五月综合97色直播| 久久精品中文字幕一区| 99久久亚洲综合精品网站| 色噜噜狠狠先锋影音久久| 99久久国产综合精品网成人影院 | 久久午夜无码鲁丝片| 午夜精品久久久久久久无码| 久久久久99精品成人片牛牛影视| 亚洲中文字幕无码一久久区| 亚洲色欲久久久久综合网| 久久国产亚洲精品| 麻豆成人久久精品二区三区免费| 国产99久久久国产精品小说| 香蕉久久久久久狠狠色| 亚洲国产精品成人久久| 91精品国产高清久久久久久io| 69久久精品无码一区二区| 国产精品99久久免费观看| 久久精品国产69国产精品亚洲 | 久久精品国产半推半就| 国产国产成人久久精品| 久久www免费人成精品香蕉| 亚洲国产天堂久久久久久| 色综合久久久久无码专区| 久久久久免费精品国产| 青青青青久久精品国产h久久精品五福影院1421 | 97久久精品无码一区二区天美| 久久九九亚洲精品| 国产午夜精品理论片久久| 久久久久99这里有精品10| 99久久精品国内| 狠狠色丁香久久婷婷综合_中| 青青青青久久精品国产h| 中文字幕精品久久| 久久精品国产亚洲av日韩 | 久久天天躁狠狠躁夜夜av浪潮| 久久久久亚洲AV成人片 |