[gest_crans_lc, utils/ldapcertfs] Fétails gestions des certificats
This commit is contained in:
parent
4a225f1375
commit
266cf73a0a
2 changed files with 19 additions and 13 deletions
|
@ -998,7 +998,12 @@ class GestCrans(object):
|
|||
def box(fields_values=None):
|
||||
fields = [("%s : " % k, form[k]['text'], form[k]['len'] + 1, form[k]['len']) for k in form_order]
|
||||
return self.dialog.form(
|
||||
text="",
|
||||
text="""Type de certificat : Type de correspondance :
|
||||
* 0 - CA pinning * 0 - certificat entier
|
||||
* 1 - Cert pinning * 1 - sha256
|
||||
* 2 - CA auto signé * 2 - sha512
|
||||
* 3 - Cert autosigné""",
|
||||
no_collapse=True,
|
||||
height=0, width=0, form_height=0,
|
||||
timeout=self.timeout,
|
||||
fields=fields_values if fields_values else fields,
|
||||
|
@ -1070,11 +1075,11 @@ les valeurs valident sont :
|
|||
def todo(machine, certificat, cont):
|
||||
if certificat:
|
||||
with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat:
|
||||
certificat['certificat'] = unicode(pem, 'utf-8')
|
||||
certificat['certificat'] = unicode(pem.strip(), 'utf-8')
|
||||
certificat.save()
|
||||
else:
|
||||
with self.conn.newCertificat(machine.dn, {}) as certificat:
|
||||
certificat['certificat'] = unicode(pem, 'utf-8')
|
||||
certificat['certificat'] = unicode(pem.strip(), 'utf-8')
|
||||
certificat.create()
|
||||
raise Continue(cont(certificat=certificat, machine=certificat.machine()))
|
||||
|
||||
|
@ -1307,12 +1312,12 @@ les valeurs valident sont :
|
|||
def todo(machine, certificat, pem, cont):
|
||||
if certificat:
|
||||
with self.conn.search(dn=certificat.dn, scope=0, mode='rw')[0] as certificat:
|
||||
certificat['csr'] = unicode(pem, 'utf-8')
|
||||
certificat['csr'] = unicode(pem.strip(), 'utf-8')
|
||||
certificat.save()
|
||||
else:
|
||||
with self.conn.newCertificat(machine.dn, {}) as certificat:
|
||||
certificat['hostCert']=unicode(machine['host'][0])
|
||||
certificat['csr'] = unicode(pem, 'utf-8')
|
||||
certificat['csr'] = unicode(pem.strip(), 'utf-8')
|
||||
certificat.create()
|
||||
raise Continue(cont(certificat=certificat, machine=certificat.machine()))
|
||||
|
||||
|
@ -1356,7 +1361,7 @@ les valeurs valident sont :
|
|||
menu
|
||||
menu_order = ['Hostname']
|
||||
if not "privateKey" in certificat['objectClass']:
|
||||
menu_order.append('AddPrivateKey')
|
||||
menu_order.extend(['AddPrivateKey', 'SetCertificate'])
|
||||
if not "x509Cert" in certificat['objectClass']:
|
||||
menu_order.extend([ 'AddCertificate'])
|
||||
if "x509Cert" in certificat['objectClass']:
|
||||
|
@ -1407,8 +1412,8 @@ les valeurs valident sont :
|
|||
raise Continue(TailCall(self.modif_certificat_attributs, certificat=certificat, cont=self_cont(certificat=certificat, tag=tag), attr=menu[tag]['attribut'].ldap_name))
|
||||
else:
|
||||
raise EnvironmentError("Il n'y a ni champ 'attribut' ni 'callback' pour le tag %s" % tag)
|
||||
(code, tag) = self.handle_dialog(cont, box, tag)
|
||||
cancel_cont = cont(machine=machine) if certificat is None else self_cont(machine=certificat.machine(), certificat=None)
|
||||
cancel_cont = cont(machine=machine) if certificat is None else self_cont(machine=certificat.machine(), certificat=None, tag=tag)
|
||||
(code, tag) = self.handle_dialog(cancel_cont, box, tag)
|
||||
return self.handle_dialog_result(
|
||||
code=code,
|
||||
output=tag,
|
||||
|
@ -2353,10 +2358,10 @@ les valeurs valident sont :
|
|||
}
|
||||
### Les clef qui n'existe pas sont toute renvoyé sur la clef ''
|
||||
menu_order = ["aA", "mA", "aMA", "dA", "", "mM", "dM", " ", "aC", "mC", "aMC", "dC", " ", "aKM"]
|
||||
if isinstance(proprio, objets.AssociationCrans):
|
||||
proprio = None
|
||||
if machine and not proprio:
|
||||
proprio = machine.proprio()
|
||||
if isinstance(proprio, objets.AssociationCrans):
|
||||
proprio = None
|
||||
if machine or proprio:
|
||||
menu_order = [' '] + menu_order
|
||||
if machine:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue