ó 'KXc@s’ddlZddlZddlmZddlmZddlmZddlmZd„Z dd„Z d „Z dd d „Z d „Z dS( iÿÿÿÿN(t PrettyTable(tdistros(tssh_util(tutilcCsEg}x8tdt|ƒdƒD]}|j|||d!ƒqW|S(Nii(txrangetlentappend(tbin_hashtsplit_upti((sY/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_ssh_authkey_fingerprints.pyt _split_hash!stmd5cCsk|s dSyBtj|ƒ}|jtj|ƒƒdjt|jƒƒƒSWntt fk rfdSXdS(Ntt:t?( thashlibtnewtupdatetbase64t b64decodetjoinR t hexdigestt TypeErrort ValueError(tb64_textt hash_meththasher((sY/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_ssh_authkey_fingerprints.pyt_gen_fingerprint(scCsSt|j|j|j|jgƒrO|jrO|jjƒjƒdkrOtSntS(Nsssh-dsssssh-rsa(sssh-dsssssh-rsa( tanytkeytypeRtcommenttoptionstlowertstriptTruetFalse(tentry((sY/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_ssh_authkey_fingerprints.pyt_is_printable_key7s $ s ci-info: cCsw|s'd||f}tj|ƒdSdd|ddg}t|ƒ}x‘|D]‰}t|ƒrPg} | j|jpzdƒ| jt|j|ƒp™dƒ| j|jp¯dƒ| j|j pÅdƒ|j | ƒqPqPW|j ƒ} | j ƒ} t t| dt ƒƒ} tjd||fd | ƒg} | j| ƒx4| D],}tjd d ||fd td tƒqCWdS(Ns9%sno authorized ssh keys fingerprints found for user %s. tKeytypesFingerprint (%s)tOptionstCommentt-tkeys#Authorized keys from %s for user %st+ttexts%s%s tstderrtconsole(Rt multi_logRR%RRRRRRtadd_rowt get_stringt splitlinesRtmaxtcentertextendR#R"(tusertkey_fnt key_entriesRtprefixtmessaget tbl_fieldsttblR$trowt authtbl_st authtbl_linestmax_lentlinestline((sY/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_ssh_authkey_fingerprints.pyt_pprint_key_entries?s2            c Cs˜d|kr|jd|ƒntj|ddƒ}tj||jƒ\}}xB|jƒD]4\}} tj|ƒ\} } t || | |ƒq\WdS(Ntno_ssh_fingerprintss>Skipping module named %s, logging of ssh fingerprints disabledt authkey_hashR ( tdebugRtget_cfg_option_strtdstnormalize_users_groupstdistrotitemsRtextract_authorized_keysRC( tnametcfgtcloudtlogt_argsRtuserst_groupst user_namet_cfgR7R8((sY/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_ssh_authkey_fingerprints.pythandle^s    (RRt prettytableRt cloudinitRRHRRR RR%RCRV(((sY/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_ssh_authkey_fingerprints.pyts