2003-10-07 03:06:06 +09:00
|
|
|
#!/bin/sh
|
2004-08-09 03:23:20 +09:00
|
|
|
# $1 = action ('configure' or 'reconfigure')
|
2003-10-07 03:06:06 +09:00
|
|
|
# $2 = current-installed-version
|
|
|
|
set -e
|
|
|
|
|
2004-08-09 03:23:20 +09:00
|
|
|
action="$1"
|
|
|
|
cur_version="$2"
|
2009-07-01 14:50:00 +02:00
|
|
|
this_version='20090701'
|
2008-08-09 14:58:24 -03:00
|
|
|
pt_BR_fixed_version="20080616"
|
2003-10-07 03:06:06 +09:00
|
|
|
|
|
|
|
if test -f /etc/ca-certificates.conf; then
|
|
|
|
CERTSCONF=/etc/ca-certificates.conf
|
|
|
|
else
|
|
|
|
CERTSCONF=/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
# CERTS_DISABLED: certs that user dont trust
|
|
|
|
CERTS_DISABLED=$(sed -ne 's/^!\(.*\)/\1/p' $CERTSCONF)
|
|
|
|
|
|
|
|
# CERTS_TRUST: certs that user already trust
|
|
|
|
CERTS_TRUST=$(sed -e '/^#/d' -e '/^!/d' $CERTSCONF)
|
|
|
|
|
2004-08-09 03:23:20 +09:00
|
|
|
|
2003-10-07 03:06:06 +09:00
|
|
|
# CERTS_AVAILABLE: certs that user can choices
|
|
|
|
CERTS_AVAILABLE=""
|
|
|
|
|
|
|
|
# CERTS_ENABLED: certs that user already trusted
|
|
|
|
CERTS_ENABLED=""
|
|
|
|
|
|
|
|
# CERTS_LIST: certs that will be installed
|
2009-07-01 14:50:00 +02:00
|
|
|
CERTS_LIST="mozilla/Entrust_Root_Certification_Authority.crt, mozilla/GeoTrust_Universal_CA.crt, mozilla/Verisign_Class_4_Public_Primary_Certification_Authority_-_G3.crt, mozilla/TC_TrustCenter__Germany__Class_2_CA.crt, mozilla/SwissSign_Gold_CA_-_G2.crt, mozilla/Digital_Signature_Trust_Co._Global_CA_2.crt, mozilla/GeoTrust_Universal_CA_2.crt, mozilla/ValiCert_Class_2_VA.crt, mozilla/Entrust.net_Premium_2048_Secure_Server_CA.crt, mozilla/Entrust.net_Secure_Server_CA.crt, mozilla/IPS_CLASEA3_root.crt, mozilla/thawte_Primary_Root_CA.crt, mozilla/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.crt, mozilla/StartCom_Certification_Authority.crt, mozilla/TURKTRUST_Certificate_Services_Provider_Root_2.crt, mozilla/QuoVadis_Root_CA_2.crt, mozilla/Staat_der_Nederlanden_Root_CA.crt, mozilla/Baltimore_CyberTrust_Root.crt, mozilla/UTN_DATACorp_SGC_Root_CA.crt, mozilla/Comodo_Secure_Services_root.crt, mozilla/WellsSecure_Public_Root_Certificate_Authority.crt, mozilla/NetLock_Qualified_=Class_QA=_Root.crt, mozilla/IPS_Servidores_root.crt, mozilla/AddTrust_Qualified_Certificates_Root.crt, mozilla/SwissSign_Platinum_CA_-_G2.crt, mozilla/Sonera_Class_1_Root_CA.crt, mozilla/IPS_Timestamping_root.crt, mozilla/XRamp_Global_CA_Root.crt, mozilla/Digital_Signature_Trust_Co._Global_CA_4.crt, mozilla/RSA_Security_2048_v3.crt, mozilla/DigiNotar_Root_CA.crt, mozilla/Secure_Global_CA.crt, mozilla/RSA_Root_Certificate_1.crt, mozilla/QuoVadis_Root_CA_3.crt, mozilla/Verisign_Time_Stamping_Authority_CA.crt, mozilla/Starfield_Class_2_CA.crt, mozilla/GlobalSign_Root_CA_-_R2.crt, mozilla/AOL_Time_Warner_Root_Certification_Authority_2.crt, mozilla/IPS_CLASE3_root.crt, mozilla/Visa_eCommerce_Root.crt, mozilla/Thawte_Personal_Freemail_CA.crt, mozilla/America_Online_Root_Certification_Authority_2.crt, mozilla/Digital_Signature_Trust_Co._Global_CA_1.crt, mozilla/beTRUSTed_Root_CA_-_Entrust_Implementation.crt, mozilla/NetLock_Business_=Class_B=_Root.crt, mozilla/Firmaprofesional_Root_CA.crt, mozilla/Verisign_Class_3_Public_Primary_Certification_Authority_-_G3.crt, mozilla/DigiCert_High_Assurance_EV_Root_CA.crt, mozilla/DST_ACES_CA_X6.crt, mozilla/COMODO_Certification_Authority.crt, mozilla/Verisign_Class_3_Public_Primary_Certification_Authority_-_G2.crt, mozilla/Entrust.net_Global_Secure_Personal_CA.crt, mozilla/IPS_CLASE1_root.crt, mozilla/beTRUSTed_Root_CA-Baltimore_Implementation.crt, mozilla/UTN_USERFirst_Hardware_Root_CA.crt, mozilla/RSA_Security_1024_v3.crt, mozilla/Certplus_Class_2_Primary_CA.crt, mozilla/Digital_Signature_Trust_Co._Global_CA_3.crt, mozilla/Visa_International_Global_Root_2.crt, mozilla/Entrust.net_Global_Secure_Server_CA.crt, mozilla/AddTrust_External_Root.crt, mozilla/Equifax_Secure_eBusiness_CA_1.crt, mozilla/DigiCert_Global_Root_CA.crt, mozilla/UTN-USER_First-Network_Applications.crt, mozilla/Verisign_Class_1_Public_Primary_Certification_Authority.crt, mozilla/SecureTrust_CA.crt, mozilla/Swisscom_Root_CA_1.crt, mozilla/Verisign_Class_2_Public_Primary_Certification_Authority.crt, mozilla/TDC_OCES_Root_CA.crt, mozilla/beTRUSTed_Root_CA_-_RSA_Implementation.crt, mozilla/Security_Communication_Root_CA.crt, mozilla/Verisign_Class_1_Public_Primary_Certification_Authority_-_G2.crt, mozilla/Camerfirma_Chambers_of_Commerce_Root.crt, mozilla/Comodo_AAA_Services_root.crt, mozilla/Thawte_Personal_Basic_CA.crt, mozilla/Go_Daddy_Class_2_CA.crt, mozilla/Equifax_Secure_eBusiness_CA_2.crt, mozilla/GlobalSign_Root_CA.crt, mozilla/AOL_Time_Warner_Root_Certification_Authority_1.crt, mozilla/Thawte_Premium_Server_CA.crt, mozilla/Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.crt, mozilla/GTE_CyberTrust_Root_CA.crt, mozilla/Camerfirma_Global_Chambersign_Root.crt, mozilla/Sonera_Class_2_Root_CA.crt, mozilla/Comodo_Trusted_Services_root.crt, mozilla/QuoVadis_Root_CA.crt, mozilla/Taiwan_GRCA.crt, mozilla/Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.crt, mozilla/IPS_CLASEA1_root.crt, mozilla/beTRUSTed_Root_CA.crt, mozilla/Verisign_Class_3_Public_Primary_Certification_Authority.crt, mozilla/ABAecom_=sub.__Am._Bankers_
|
2003-10-07 03:06:06 +09:00
|
|
|
|
|
|
|
# CERTS_NEW: new certificates that will be installed
|
|
|
|
CERTS_NEW=""
|
|
|
|
|
2004-08-09 03:23:20 +09:00
|
|
|
members()
|
|
|
|
{
|
|
|
|
echo "$1" | tr ',' '\n' | sed -e 's/^[[:space:]]*//' | while read ca
|
|
|
|
do
|
|
|
|
if echo "$2" | grep -q "$ca" > /dev/null 2>&1; then
|
|
|
|
echo match
|
|
|
|
fi
|
|
|
|
done | grep -q match
|
|
|
|
}
|
|
|
|
|
2003-10-07 03:06:06 +09:00
|
|
|
. /usr/share/debconf/confmodule || exit
|
|
|
|
db_version 2.0
|
|
|
|
db_capb multiselect
|
|
|
|
|
|
|
|
db_title "ca-certificates configuration"
|
|
|
|
db_input medium ca-certificates/trust_new_crts || true
|
|
|
|
db_go
|
|
|
|
|
2004-08-09 03:23:20 +09:00
|
|
|
trust_new="yes"
|
2003-10-07 03:06:06 +09:00
|
|
|
if db_get ca-certificates/trust_new_crts; then
|
|
|
|
trust_new="$RET"
|
|
|
|
fi
|
|
|
|
|
2004-08-09 03:23:20 +09:00
|
|
|
seen=false
|
|
|
|
if db_fget ca-certificates/enable_crts seen; then
|
|
|
|
seen="$RET"
|
|
|
|
fi
|
|
|
|
# XXX: in case reconfigure, force to select all available certificates
|
|
|
|
if test "$action" = "reconfigure" || test "$DEBCONF_RECONFIGURE" = "1"; then
|
|
|
|
seen=false
|
|
|
|
trust_new=no
|
|
|
|
fi
|
|
|
|
|
2003-10-07 03:06:06 +09:00
|
|
|
if test -d /usr/share/ca-certificates; then
|
|
|
|
cd /usr/share/ca-certificates
|
2004-08-09 03:23:20 +09:00
|
|
|
crts=$( (find . -type f -name '*.crt' -print | sed -e 's/^\.\///'; \
|
|
|
|
echo "$CERTS_LIST" | tr ',' '\n' | sed -e 's/^[[:space:]]*//') | \
|
|
|
|
sort | uniq)
|
|
|
|
for crt in $crts
|
2003-10-07 03:06:06 +09:00
|
|
|
do
|
|
|
|
if test "$CERTS_AVAILABLE" = ""; then
|
|
|
|
CERTS_AVAILABLE="$crt"
|
|
|
|
else
|
|
|
|
CERTS_AVAILABLE="$CERTS_AVAILABLE, $crt"
|
|
|
|
fi
|
2004-08-09 03:23:20 +09:00
|
|
|
if echo "$CERTS_DISABLED" | grep -F -q -x "$crt" > /dev/null 2>&1; then
|
2003-10-07 03:06:06 +09:00
|
|
|
: # echo "I: ignore $crt"
|
2004-08-09 03:23:20 +09:00
|
|
|
elif echo "$CERTS_TRUST" | grep -F -q -x "$crt" > /dev/null 2>&1; then
|
2003-10-07 03:06:06 +09:00
|
|
|
# already trusted
|
|
|
|
if test "$CERTS_ENABLED" = ""; then
|
|
|
|
CERTS_ENABLED="$crt"
|
|
|
|
else
|
|
|
|
CERTS_ENABLED="$CERTS_ENABLED, $crt"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# new certs?
|
|
|
|
if test "$trust_new" = "yes"; then
|
|
|
|
if test "$CERTS_ENABLED" = ""; then
|
|
|
|
CERTS_ENABLED="$crt"
|
|
|
|
else
|
|
|
|
CERTS_ENABLED="$CERTS_ENABLED, $crt"
|
|
|
|
fi
|
|
|
|
elif test "$trust_new" = "ask"; then
|
|
|
|
if test "$CERTS_NEW" = ""; then
|
|
|
|
CERTS_NEW="$crt"
|
|
|
|
else
|
|
|
|
CERTS_NEW="$CERTS_NEW, $crt"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
: # trust_new=no, default disabled
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
else
|
|
|
|
# initial installation
|
|
|
|
CERTS_AVAILABLE="$CERTS_LIST"
|
|
|
|
CERTS_ENABLED="$CERTS_AVAILABLE"
|
|
|
|
# XXX: ca-certificates/enable_crts should be used, so no need to ask new
|
|
|
|
# in this session
|
|
|
|
trust_new="yes"
|
|
|
|
CERTS_NEW=""
|
|
|
|
fi
|
|
|
|
|
2004-08-09 03:23:20 +09:00
|
|
|
enable_crts=""
|
2003-10-07 03:06:06 +09:00
|
|
|
if db_get ca-certificates/enable_crts; then
|
2004-08-09 03:23:20 +09:00
|
|
|
enable_crts="$RET"
|
2003-10-07 03:06:06 +09:00
|
|
|
fi
|
|
|
|
|
2004-08-09 03:23:20 +09:00
|
|
|
new_seen=false
|
|
|
|
if dpkg --compare-versions "$cur_version" lt 20040808; then
|
|
|
|
db_fset ca-certificates/new_crts seen false
|
|
|
|
fi
|
|
|
|
if db_fget ca-certificates/new_crts seen; then
|
|
|
|
new_seen="$RET"
|
|
|
|
fi
|
|
|
|
if members "$CERTS_NEW" "$enable_crts"; then
|
|
|
|
# already selected new_crts?
|
|
|
|
new_seen=true
|
|
|
|
fi
|
|
|
|
db_subst ca-certificates/new_crts new_crts "$CERTS_NEW"
|
|
|
|
|
|
|
|
if test "$trust_new" = "ask" && test "$new_seen" = "true"; then
|
|
|
|
# XXX: run this again in postinst
|
|
|
|
CERTS_ENABLED="$enable_crts"
|
2003-10-07 03:06:06 +09:00
|
|
|
fi
|
|
|
|
|
2004-08-09 03:23:20 +09:00
|
|
|
if test "$trust_new" = "ask" && test "$CERTS_NEW" != "" && test "$new_seen" = "false"; then
|
2003-10-07 03:06:06 +09:00
|
|
|
# New certificates added
|
|
|
|
db_fset ca-certificates/new_crts seen false
|
|
|
|
db_title "ca-certificates configuration"
|
|
|
|
db_input critical ca-certificates/new_crts || true
|
|
|
|
db_go
|
|
|
|
|
|
|
|
if db_get ca-certificates/new_crts; then
|
|
|
|
if test "$CERTS_ENABLED" = ""; then
|
|
|
|
CERTS_ENABLED="$RET"
|
|
|
|
else
|
|
|
|
CERTS_ENABLED="$CERTS_ENABLED, $RET"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
# XXX: old certificates keep current state?
|
|
|
|
seen=true
|
|
|
|
fi
|
2004-08-09 03:23:20 +09:00
|
|
|
# mark seen true, so that dont ask again while postinst
|
|
|
|
db_fset ca-certificates/new_crts seen true
|
2003-10-07 03:06:06 +09:00
|
|
|
|
2008-08-09 14:58:24 -03:00
|
|
|
# Ideally, we would be able to ask debconf for the language it's using, or
|
|
|
|
# at least have a shell binding for setlocale(). Since we don't, we have to
|
|
|
|
# do it all by hand.
|
|
|
|
is_pt_BR () {
|
|
|
|
current_lc_messages="$(eval `locale`; echo "$LC_MESSAGES")"
|
|
|
|
case "$LANGUAGE" in
|
|
|
|
pt_BR*)
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
case "$current_lc_messages" in
|
|
|
|
pt_BR*)
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
PRIO=low
|
|
|
|
set_values=true
|
|
|
|
|
|
|
|
if dpkg --compare-versions "$cur_version" lt-nl "$pt_BR_fixed_version"; then
|
|
|
|
asked="false"
|
|
|
|
if db_fget ca-certificates/enable_crts asked_pt_br_question; then
|
|
|
|
asked="$RET"
|
|
|
|
fi
|
|
|
|
if [ "$asked" != "true" ]; then
|
|
|
|
if [ -e "/etc/ssl/certs/ca-certificates.crt" ] && [ ! -s "/etc/ssl/certs/ca-certificates.crt" ]; then
|
|
|
|
pt_seen="false"
|
|
|
|
if db_fget ca-certificates/enable_crts seen; then
|
|
|
|
pt_seen="$RET"
|
|
|
|
fi
|
|
|
|
if [ "$pt_seen" = "false" ]; then
|
|
|
|
CERTS_ENABLED="$CERTS_AVAILABLE"
|
|
|
|
elif is_pt_BR; then
|
|
|
|
PRIO=critical
|
|
|
|
CERTS_ENABLED="$CERTS_AVAILABLE"
|
|
|
|
seen=false
|
|
|
|
else
|
|
|
|
seen=true
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
set_values=false
|
|
|
|
fi
|
2003-10-07 03:06:06 +09:00
|
|
|
fi
|
2008-08-09 14:58:24 -03:00
|
|
|
|
|
|
|
if [ "$set_values" = "true" ]; then
|
|
|
|
db_set ca-certificates/enable_crts "$CERTS_ENABLED"
|
|
|
|
db_subst ca-certificates/enable_crts enable_crts "$CERTS_AVAILABLE"
|
|
|
|
if test "$seen" != true; then
|
|
|
|
db_fset ca-certificates/enable_crts seen false
|
|
|
|
fi
|
|
|
|
db_title "ca-certificates configuration"
|
|
|
|
db_input $PRIO ca-certificates/enable_crts || true
|
|
|
|
db_go
|
|
|
|
|
|
|
|
if [ "$PRIO" = "critical" ]; then
|
|
|
|
db_fset ca-certificates/enable_crts asked_pt_br_question true
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2003-10-07 03:06:06 +09:00
|
|
|
exit 0
|