summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorAdrian Likins <alikins@redhat.com>2007-09-20 16:09:20 -0400
committerAdrian Likins <alikins@redhat.com>2007-09-20 16:09:20 -0400
commit7a70b5bb80c69dafc345dfd4df577bfb1e983ee9 (patch)
tree2b3ebe15ab9c14a438b4cea2b61b31d0512450c8 /func
parent322c6fd1fe1aa02b740d646a3c02f8ec46515fa3 (diff)
downloadthird_party-func-7a70b5bb80c69dafc345dfd4df577bfb1e983ee9.tar.gz
third_party-func-7a70b5bb80c69dafc345dfd4df577bfb1e983ee9.tar.xz
third_party-func-7a70b5bb80c69dafc345dfd4df577bfb1e983ee9.zip
first pass at packaging stuff
version is 0.11-1 (this one goes to .11) "make rpms" should build a rpm from the setup.py and func.spec
Diffstat (limited to 'func')
-rw-r--r--func/slave-keys.py80
1 files changed, 0 insertions, 80 deletions
diff --git a/func/slave-keys.py b/func/slave-keys.py
deleted file mode 100644
index dee0fd5..0000000
--- a/func/slave-keys.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/python -tt
-
-import sys
-import os
-import os.path
-from OpenSSL import crypto
-import socket
-
-
-def_country = 'UN'
-def_state = 'FC'
-def_local = 'Func-ytown'
-def_org = 'func'
-def_ou = 'slave-key'
-
-cert_dir = '/home/skvidal/tmp/t'
-key_file = '%s/slave.pem' % cert_dir
-csr_file = '%s/slave.csr' % cert_dir
-
-
-def make_cert(dest=None):
- pkey = crypto.PKey()
- pkey.generate_key(crypto.TYPE_RSA, 2048)
- if dest:
- destfo = open(dest, 'w')
- destfo.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey))
- destfo.close()
-
- return pkey
-
-def make_csr(pkey, dest=None, cn=None):
- req = crypto.X509Req()
- req.get_subject()
- subj = req.get_subject()
- subj.C = def_country
- subj.ST = def_state
- subj.L = def_local
- subj.O = def_org
- subj.OU = def_ou
- if cn:
- subj.CN = cn
- else:
- subj.CN = socket.getfqdn()
- subj.emailAddress = 'root@%s' % subj.CN
-
- req.set_pubkey(pkey)
- req.sign(pkey, 'md5')
- if dest:
- destfo = open(dest, 'w')
- destfo.write(crypto.dump_certificate_request(crypto.FILETYPE_PEM, req))
- destfo.close()
-
- return req
-
-def retrieve_key_from_file(keyfile):
- fo = open(keyfile, 'r')
- buf = fo.read()
- keypair = crypto.load_privatekey(crypto.FILETYPE_PEM, buf)
- return keypair
-
-def main():
- keypair = None
- try:
- if not os.path.exists(cert_dir):
- os.makedirs(cert_dir)
- if not os.path.exists(key_file):
- keypair = make_cert(dest=key_file)
- if not os.path.exists(csr_file):
- if not keypair:
- keypair = retrieve_key_from_file(key_file)
- csr = make_csr(keypair, dest=csr_file)
- except:
- return 1
-
- return 0
-
-
-if __name__ == "__main__":
- sys.exit(main())
- \ No newline at end of file