[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Generating ~/.ssh/known_hosts from LDAP



> I couldn't find any way to authenticate db.debian.org when using direct LDAP
> (TLS doesn't seem to be supported), but nonetheless this is damn convenient.
> 
> (requires python-ldap)

Or, for people who don't want python installed.
#!/bin/zsh
for i in ${(M)${(ps:\n\n:)${"$(ldapsearch -LLL -x -h db.debian.org -b dc=debian,dc=org -s sub objectClass=debianServer hostname sshRSAHostKey)"}}:#*sshRSAHostKey:*};
do
  for j in ${${(M)${(f)${i//
 /}}:#sshRSAHostKey: *}#sshRSAHostKey: };
  do
    print ${(j:,:)${${(M)${(f)i}:#hostname: *}#hostname: }} $j
  done
done

Reply to: