作者 主題: Ldap+publicKey authenticate+sudo小問題  (閱讀 7481 次)

0 會員 與 1 訪客 正在閱讀本文。

wlhfor

  • 懷疑的國中生
  • **
  • 文章數: 39
    • 檢視個人資料
Ldap+publicKey authenticate+sudo小問題
« 於: 2012-12-07 18:24 »
Dear 各位大大:

小弟做了Ldap(未加密)+publicKey authenticate+sudo

登入都正常,但sudo -i時不須密碼就登入了,小弟希望能加密碼,但小弟查了Sudoers LDAP Manualhttp://www.sudo.ws/sudoers.ldap.man.html#sudooption並沒有passwd的屬性

以下是小弟的ldif,我有試過把sudoOption: !authenticate的!拿掉,sudo -i時就須要輸入密碼,但打任何密碼都進不去,也不知密碼要設在那?不過有沒有大大有試過可以分享一下,感謝
dn: cn=jones,ou=sudoers,dc=abc,dc=com
objectClass: top
objectClass: sudoRole
cn: jones
sudoUser: jones
sudoHost: ALL
sudoCommand: ALL
sudoOption: !authenticate

netman

  • 管理員
  • 俺是博士!
  • *****
  • 文章數: 17484
    • 檢視個人資料
    • http://www.study-area.org
Re: Ldap+publicKey authenticate+sudo小問題
« 回覆 #1 於: 2012-12-08 08:03 »
那如果都不設option呢?

Niko

  • 活潑的大學生
  • ***
  • 文章數: 281
  • 性別: 男
    • 檢視個人資料
Re: Ldap+publicKey authenticate+sudo小問題
« 回覆 #2 於: 2012-12-08 20:52 »
# %d30, Sudoers, split.com.tw
dn: cn=%d30,ou=Sudoers,dc=split,dc=com,dc=tw
cn: %d30
objectClass: sudoRole
objectClass: top
sudoCommand: ALL
sudoHost: ALL
sudoUser: %d30

這是小弟的ldif,使用sudo -i 會要求密碼
順道想問一下,一般user第一次使用sudo時會要求密碼,預設5分鐘內沒有在執行過的話會再要求一次密碼
預設時間可以在/etc/sudoers裡設定,但是用ldap的話似乎就不行了,難道是要從sudoOption這個Attribute下手嗎?
小弟拜了谷歌大神也還沒找到方法

wlhfor

  • 懷疑的國中生
  • **
  • 文章數: 39
    • 檢視個人資料
Re: Ldap+publicKey authenticate+sudo小問題
« 回覆 #3 於: 2012-12-11 12:22 »
那如果都不設option呢?

感謝大大回覆,不設option的話,client須要打密碼,但是密碼在那設定呢??因為sudoer並沒有userPassword
小弟試過用ldappasswd,但沒辦法設定

netman

  • 管理員
  • 俺是博士!
  • *****
  • 文章數: 17484
    • 檢視個人資料
    • http://www.study-area.org
Re: Ldap+publicKey authenticate+sudo小問題
« 回覆 #4 於: 2012-12-11 14:05 »
對啊,密碼就是該user的系統帳號密碼,如果是設了targetpw才用目標帳號的密碼。

wlhfor

  • 懷疑的國中生
  • **
  • 文章數: 39
    • 檢視個人資料
Re: Ldap+publicKey authenticate+sudo小問題
« 回覆 #5 於: 2012-12-11 15:48 »
感謝大大回覆,小弟試出來了,小弟先說明一下,LdapClient登入時是用Key認證,所以沒有設密碼,設定檔如下
# jones, People, abc.com
dn: cn=jones,ou=People,dc=abc,dc=com
objectClass: posixAccount
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: ldapPublicKey
cn: jones
uid: jones
uidNumber: 1100
gidNumber: 1000
ou: People
loginShell: /bin/bash
homeDirectory: /home/jones
sn: Hsu
sshPublicKey: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEApSac3seks7+1SsdG1fWBKedon5pO
3nzKBwFzRA9iLFaEb4uooadA1HOAFc=


小弟新增一個userPasswd的attribute就可以了,之前試不行是因為多設了一個objectClass:shadow