Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ai
cam
Commits
790d363e
Commit
790d363e
authored
Dec 10, 2012
by
ale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
always regenerate the CA config file if necessary
parent
85e20677
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
cam/ca.py
cam/ca.py
+10
-2
No files found.
cam/ca.py
View file @
790d363e
...
@@ -66,6 +66,10 @@ class CA(object):
...
@@ -66,6 +66,10 @@ class CA(object):
fcntl
.
lockf
(
self
.
_lockfd
,
fcntl
.
LOCK_UN
)
fcntl
.
lockf
(
self
.
_lockfd
,
fcntl
.
LOCK_UN
)
self
.
_lockfd
.
close
()
self
.
_lockfd
.
close
()
def
_update_config
(
self
):
# Create the OpenSSL configuration file.
utils
.
render
(
self
.
files
.
conf
,
'openssl_config'
,
self
.
config
)
def
close
(
self
):
def
close
(
self
):
self
.
_unlock
()
self
.
_unlock
()
...
@@ -92,8 +96,7 @@ class CA(object):
...
@@ -92,8 +96,7 @@ class CA(object):
with
open
(
self
.
files
.
crlnumber
,
'w'
)
as
fd
:
with
open
(
self
.
files
.
crlnumber
,
'w'
)
as
fd
:
fd
.
write
(
'01
\n
'
)
fd
.
write
(
'01
\n
'
)
# Create the OpenSSL configuration file.
self
.
_update_config
()
utils
.
render
(
self
.
files
.
conf
,
'openssl_config'
,
self
.
config
)
# Generate keys if they do not exist.
# Generate keys if they do not exist.
if
not
os
.
path
.
exists
(
self
.
files
.
public_key
):
if
not
os
.
path
.
exists
(
self
.
files
.
public_key
):
...
@@ -128,6 +131,9 @@ class CA(object):
...
@@ -128,6 +131,9 @@ class CA(object):
def
gencrl
(
self
):
def
gencrl
(
self
):
log
.
info
(
'generating CRL'
)
log
.
info
(
'generating CRL'
)
self
.
_update_config
()
# Write the CRL in PEM format to a temporary file.
# Write the CRL in PEM format to a temporary file.
tmpf
=
self
.
files
.
crl
+
'.tmp'
tmpf
=
self
.
files
.
crl
+
'.tmp'
openssl_wrap
.
run_with_config
(
openssl_wrap
.
run_with_config
(
...
@@ -150,6 +156,8 @@ class CA(object):
...
@@ -150,6 +156,8 @@ class CA(object):
self
.
gencrl
()
self
.
gencrl
()
def
generate
(
self
,
cert
):
def
generate
(
self
,
cert
):
self
.
_update_config
()
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, revoking previous version'
)
...
...
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