Commit 7ed50ee7 authored by Łukasz Nowak's avatar Łukasz Nowak

Create "infinite" certificates.

parent 3bde8812
...@@ -870,6 +870,9 @@ class GenerateSignatureScriptTest(unittest.TestCase): ...@@ -870,6 +870,9 @@ class GenerateSignatureScriptTest(unittest.TestCase):
result = subprocess.check_output(['openssl', 'x509', '-noout', '-subject', result = subprocess.check_output(['openssl', 'x509', '-noout', '-subject',
'-in', self.certificate]) '-in', self.certificate])
self.assertEqual('subject= /CN=%s' % self.common_name, result.strip()) self.assertEqual('subject= /CN=%s' % self.common_name, result.strip())
result = subprocess.check_output(['openssl', 'x509', '-noout', '-enddate',
'-in', self.certificate])
self.assertTrue('2111' in result)
def test_generate_key_exists(self): def test_generate_key_exists(self):
self.assertRaises(ValueError, slapos.signature.generateCertificate, self.assertRaises(ValueError, slapos.signature.generateCertificate,
......
...@@ -29,7 +29,7 @@ def generateCertificate(certificate_file, key_file, common_name): ...@@ -29,7 +29,7 @@ def generateCertificate(certificate_file, key_file, common_name):
print 'Generating certificate for %r (key: %r, certficate: %r)' % ( print 'Generating certificate for %r (key: %r, certficate: %r)' % (
common_name, key_file, certificate_file) common_name, key_file, certificate_file)
subj = '/CN=%s' % common_name subj = '/CN=%s' % common_name
subprocess.check_call(["openssl", "req", "-x509", "-nodes", "-days", "365", subprocess.check_call(["openssl", "req", "-x509", "-nodes", "-days", "36500",
"-subj", subj, "-newkey", "rsa:1024", "-keyout", key_file, "-out", "-subj", subj, "-newkey", "rsa:1024", "-keyout", key_file, "-out",
certificate_file]) certificate_file])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment