Changeset 490ee21


Ignore:
Timestamp:
Dec 23, 2010 3:30:56 PM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master
Children:
0c85dce, 9e75ff8
Parents:
6635dd5
Message:

Copy the subject as well

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/cert_to_fedid.py

    r6635dd5 r490ee21  
    44import subprocess, tempfile
    55import os.path
     6import re
     7
     8from M2Crypto import X509
    69
    710from string import join
     
    1619        self.add_option('--debug', dest='debug', action='store_true',
    1720                default=False, help='Just print command')
     21        self.add_option('--cert', dest='cert',
     22                help='Cretificate to copy subject from')
    1823        self.add_option('--openssl', dest='openssl',
    1924                help='Path to openssl command', default='/usr/bin/openssl')
     
    3742
    3843try:
     44    c = X509.load_cert(opts.cert)
     45    subj = c.get_subject().as_text()
     46    if subj.startswith('/'): i = 1
     47    else: i = 0
     48    subj = '/' + re.sub('/', '\/', subj[i:])
     49
    3950    tf, tn = tempfile.mkstemp(suffix=".pem")
    4051    cmd = [opts.openssl, 'req', '-new', '-nodes', '-subj',
    41             '/CN=users.isi.deterlab.net', '-x509', '-days',  '3650',
     52            subj, '-x509', '-days',  '3650',
    4253            '-key', key, '-out', tn]
    4354    if opts.debug:
Note: See TracChangeset for help on using the changeset viewer.