~mvo/software-center/lp921799

« back to all changes in this revision

Viewing changes to software-center

  • Committer: Gary Lasker
  • Date: 2012-01-18 23:07:56 UTC
  • mto: This revision was merged to the branch mainline in revision 2680.
  • Revision ID: gary.lasker@canonical.com-20120118230756-e6xcsc1iow6546ru
disable certs check if switch SOFTWARE_CENTER_FORCE_DISABLE_CERTS_CHECK is set and display a scary message when they are disabled

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
# Enable Xapian's CJK tokenizer (see LP: #745243)
46
46
os.environ['XAPIAN_CJK_NGRAM'] = '1'
47
47
 
 
48
LOG = logging.getLogger("softwarecenter")
 
49
 
48
50
if __name__ == "__main__":
49
51
 
50
52
    parser = OptionParser("usage: %prog [options] [package-name | apturl | deb-file]", 
124
126
    # on exit. However its IMPORTANT to set it as libsoup is *not* secure
125
127
    # by default (see bugzilla #666280 and #666276)
126
128
    from gi.repository import WebKit as webkit
 
129
    if not "SOFTWARE_CENTER_FORCE_DISABLE_CERTS_CHECK" in os.environ:
 
130
        session = webkit.get_default_session()
 
131
        session.set_property("ssl-ca-file", "/etc/ssl/certs/ca-certificates.crt")
 
132
    else:
 
133
        # WARN the user!! Do not remove this
 
134
        LOG.warning("SOFTWARE_CENTER_FORCE_DISABLE_CERTS_CHECK " +
 
135
                    "has been specified, all purchase transactions " + 
 
136
                    "are now INSECURE and UNENCRYPTED!!")
127
137
    session = webkit.get_default_session()
128
138
    session.set_property("ssl-ca-file", "/etc/ssl/certs/ca-certificates.crt")
129
139