Bonjour à tous,
Voici une esquisse d'un package qui pousse un certificat dans le store
"Root" Computer d'un Windows
Si firefox est présent sur le poste, on pousse un bout de conf qui
demande à Firefox d'utiliser le store système (par défaut, Firefox
dispose de son propre magasin de certificats)
Ce package dispose d'une fonction audit qui vérifie toutes les 4h que le
cert est bien installé dans le magasin.
Ce n'est qu'une ebauche, à modifier/agrémenter/améliorer selon vos souhaits
Bonne semaine à tous
Dans le fichier control:
audit_schedule : 4h
Créer un fichier enableroot.js:
/* Allows Firefox reading Windows certificates */
pref("security.enterprise_roots.enabled", true);
Le setup.py:
# -*- coding: utf-8 -*-
from setuphelpers import *
cert_name = 'myrootca.crt'
cert_fingerprint= 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
def firefox():
if installed_softwares(name='Mozilla Firefox'):
if isdir(os.path.join(programfiles64,'Mozilla
Firefox','Defaults','Pref')):
mozilla_pref_path = os.path.join(programfiles64,'Mozilla
Firefox','Defaults','Pref')
elif isdir(os.path.join(programfiles,'Mozilla
Firefox','Defaults','Pref')):
mozilla_pref_path = os.path.join(programfiles,'Mozilla
Firefox','Defaults','Pref')
else:
return 1
if not isfile(os.path.join(mozilla_pref_path,'enableroot.js')):
print('patching Firefox')
filecopyto('enableroot.js',mozilla_pref_path)
def install():
try:
run(r'certutil -verifystore Root %s' % cert_fingerprint)
except:
print('Register Root CA')
run(r'certutil.exe -addstore Root %s' % cert_name)
firefox()
def audit():
try:
run(r'certutil -verifystore Root %s' %
cert_fingerprint,return_stderr=False)
return "OK"
except:
return "ERROR"