Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ai
cam
Commits
09eeaa8a
Commit
09eeaa8a
authored
Feb 07, 2014
by
ale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
always revoke the certificate, even if it is already expired
parent
2397de7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
cam/ca.py
cam/ca.py
+4
-1
cam/cert.py
cam/cert.py
+5
-2
No files found.
cam/ca.py
View file @
09eeaa8a
...
@@ -160,7 +160,10 @@ class CA(object):
...
@@ -160,7 +160,10 @@ class CA(object):
expiry
=
cert
.
get_expiration_date
()
expiry
=
cert
.
get_expiration_date
()
if
expiry
and
expiry
>
time
.
time
():
if
expiry
and
expiry
>
time
.
time
():
log
.
warn
(
'certificate is still valid, revoking previous version'
)
log
.
warn
(
'certificate is still valid'
)
if
cert
.
exists
():
log
.
warn
(
'revoking previous version'
)
self
.
revoke
(
cert
)
self
.
revoke
(
cert
)
log
.
info
(
'generating new certificate %s'
,
cert
.
name
)
log
.
info
(
'generating new certificate %s'
,
cert
.
name
)
...
...
cam/cert.py
View file @
09eeaa8a
...
@@ -32,8 +32,11 @@ class Cert(object):
...
@@ -32,8 +32,11 @@ class Cert(object):
self
.
private_key_file
=
os
.
path
.
join
(
ca
.
basedir
,
'private'
,
self
.
private_key_file
=
os
.
path
.
join
(
ca
.
basedir
,
'private'
,
'%s.key'
%
name
)
'%s.key'
%
name
)
def
exists
(
self
):
return
os
.
path
.
exists
(
self
.
public_key_file
)
def
get_fingerprint
(
self
,
digest
=
'sha1'
):
def
get_fingerprint
(
self
,
digest
=
'sha1'
):
if
os
.
path
.
exists
(
self
.
public_key_file
):
if
self
.
exists
():
output
=
openssl_wrap
.
run
(
'x509'
,
'-in'
,
self
.
public_key_file
,
output
=
openssl_wrap
.
run
(
'x509'
,
'-in'
,
self
.
public_key_file
,
'-noout'
,
'-fingerprint'
,
'-%s'
%
digest
)
'-noout'
,
'-fingerprint'
,
'-%s'
%
digest
)
m
=
re
.
search
(
r
'=(.*)$'
,
output
)
m
=
re
.
search
(
r
'=(.*)$'
,
output
)
...
@@ -42,7 +45,7 @@ class Cert(object):
...
@@ -42,7 +45,7 @@ class Cert(object):
return
None
return
None
def
get_expiration_date
(
self
):
def
get_expiration_date
(
self
):
if
os
.
path
.
exists
(
self
.
public_key_file
):
if
self
.
exists
():
output
=
openssl_wrap
.
run
(
'x509'
,
'-in'
,
self
.
public_key_file
,
output
=
openssl_wrap
.
run
(
'x509'
,
'-in'
,
self
.
public_key_file
,
'-noout'
,
'-dates'
)
'-noout'
,
'-dates'
)
m
=
re
.
search
(
r
'notAfter=(.*)'
,
output
)
m
=
re
.
search
(
r
'notAfter=(.*)'
,
output
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment