En dehors du navigateur, aucune application supporte les certificats auto-signés sous Firefox OS. Heureusement, il y a une astuce pour injecter les certificats désirés.
Ces chemins sont valables pour Debian (et peut être pour les autres distributions).
Le certificat est /etc/dovecot/dovecot.pem. Avec ce certificat, cela peut ne pas fonctionner à cause du nom de domaine incorrect dans le certificat. Il faut alors régénérer le certificat comme suite :
# rm /etc/dovecot/dovecot.pem /etc/dovecot/private/dovecot.pem # openssl req -new -x509 -days 3650 -nodes -out /etc/dovecot/dovecot.pem -keyout /etc/dovecot/private/dovecot.pem # chmod o= /etc/dovecot/private/dovecot.pem
Le champ Common Name doit avoir exactement le nom de votre domaine (par exemple, mail.exemple.org).
Redémarrer Dovecot pour prendre en compte ce certificat :
# service dovecot restart
Postfix ne crée pas par défaut un certificat, il faut alors le générer manuellement :
# openssl req -new -x509 -days 3650 -nodes -out /etc/ssl/certs/postfix.pem -keyout /etc/ssl/private/postfix.pem # chmod o= /etc/ssl/private/postfix.pem
Il faut ensuite éditer le fichier de configuration de Postfix /etc/postfix/main.cf et ajouter les 2 lignes suivantes :
smtpd_tls_cert_file=/etc/ssl/certs/postfix.pem smtpd_tls_key_file=/etc/ssl/private/postfix.pem
Relancer Postfix :
# service postfix restart
Il faut installer les paquets libnss3-tools. Par exemple, sous Debian :
# aptitude install libnss3-tools
Activer le Débogage distant sous Firefox OS (Paramètres→Développeurs→Débogage distant, choisir ADB et outils de développement).
Maintenant, il faut identifier le répertoire sous Firefox OS contenant les fichiers qui nous intéresseront :
$ adb shell "ls -d /data/b2g/mozilla/*.default"
Ça doit retourner un truc du genre /data/b2g/mozilla/XYZ.default où XYZ sont des chiffres et des lettres aléatoires.
Récupérer les fichiers qui nous intéressent :
$ adb pull /data/b2g/mozilla/XYZ.default/cert9.db . $ adb pull /data/b2g/mozilla/XYZ.default/key4.db . $ adb pull /data/b2g/mozilla/XYZ.default/pkcs11.txt .
Je vous conseille de faire une sauvegarde de ces fichiers avant de les modifier. Ensuite, saisir la commande suivante (à la demande de mot de passe, appuyer sur Entrée:
$ certutil -d 'sql:.' -N
Placer les certificats au format PEM dans un répertoire certs par exemple et importer les avec la commande suivante :
$ for i in certs/*.pem; do certutil -d 'sql:.' -A -n "`basename $i`" -t "C,C,TC" -i $i; done
Remettez les fichiers modifiés dans le téléphone comme suite :
$ adb push cert9.db /data/b2g/mozilla/XYZ.default/ $ adb push key4.db /data/b2g/mozilla/XYZ.default/ $ adb push pkcs11.txt /data/b2g/mozilla/XYZ.default/
Redémarrer le téléphone et c'est bon.
#!/bin/bash CERT_DIR=certs ROOT_DIR_DB=/data/b2g/mozilla CERT=cert9.db KEY=key4.db PKCS11=pkcs11.txt DB_DIR=`adb shell "ls -d ${ROOT_DIR_DB}/*.default 2>/dev/null" | sed "s/default.*$/default/g"` if [ "${DB_DIR}" = "" ]; then echo "Profile directory does not exists. Please start the b2g process at least once before running this script." exit 1 fi function log { GREEN="\E[32m" RESET="\033[00;00m" echo -e "${GREEN}$1${RESET}" } # cleanup rm -f ./$CERT rm -f ./$KEY rm -f ./$PKCS11 # pull files from phone log "getting ${CERT}" adb pull ${DB_DIR}/${CERT} . log "getting ${KEY}" adb pull ${DB_DIR}/${KEY} . log "getting ${PKCS11}" adb pull ${DB_DIR}/${PKCS11} . # clear password and add certificates log "set password (hit enter twice to set an empty password)" certutil -d 'sql:.' -N log "adding certificats" for i in ${CERT_DIR}/* do log "Adding certificate $i" certutil -d 'sql:.' -A -n "`basename $i`" -t "C,C,TC" -i $i done # push files to phone log "stopping b2g" adb shell stop b2g log "copying ${CERT}" adb push ./${CERT} ${DB_DIR}/${CERT} log "copying ${KEY}" adb push ./${KEY} ${DB_DIR}/${KEY} log "copying ${PKCS11}" adb push ./${PKCS11} ${DB_DIR}/${PKCS11} log "starting b2g" adb shell start b2g log "Finished."
.
Autre source : http://wiki.mozfr.org/Adding_CA_to_FirefoxOS