Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
open
stapled
Commits
f73db580
Commit
f73db580
authored
Oct 24, 2018
by
Chris Snijder
🏅
Browse files
Fix pydocstyle warnings and review comments.
parent
ca510ba6
Pipeline
#5528
passed with stages
in 2 minutes and 25 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
config/stapled.conf
View file @
f73db580
...
...
@@ -90,12 +90,12 @@ haproxy-sockets=[/var/run/haproxy/admin.sock]
;;
Setting
this
will
merge
your
`
cert
-
paths
`
with
paths
found
in
the
specified
;;
HAProxy
config
files
.
Sockets
defined
in
`
haproxy
-
sockets
`
will
also
be
;;
merged
in
the
path
to
socket
mapping
.
;
haprox
-
config
=/
etc
/
haproxy
/
haproxy
.
cfg
;
haprox
y
-
config
=/
etc
/
haproxy
/
haproxy
.
cfg
;;
Set
a
keep
alive
time
after
wich
the
connection
to
the
HAProxy
sockets
is
;;
terminated
.
The
minimum
allowed
value
is
10
seconds
,
because
stapled
will
;;
take
at
least
a
bit
of
time
to
communicate
with
HAProxy
,
and
either
process
;;
could
be
"busy"
.
;;
Set
a
keep
alive
time
in
seconds
after
wich
the
connection
to
the
HAProxy
;;
sockets
is
terminated
.
The
minimum
allowed
value
is
10
seconds
,
because
;;
stapled
will
take
at
least
a
bit
of
time
to
communicate
with
HAProxy
,
and
;;
either
process
could
be
"busy"
.
;
haproxy
-
socket
-
keepalive
=
3600
...
...
stapled/__main__.py
View file @
f73db580
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This is the module that parses your command line arguments and then starts
the OCSP Staple daemon, which searches your certificate paths and
requests staples for all certificates in them. They will then be saved as
``certificatename.pem.ocsp`` in the same paths that are being indexed.
Parse command line arguments and starts the OCSP Staple daemon.
The daemon searches your certificate paths and requests staples for all
certificates in them. They will then be saved as ``certificatename.pem.ocsp``
in the same paths that are being indexed.
Type ``stapled.py -h`` for all command line arguments.
...
...
@@ -29,11 +30,11 @@ user's process hierarchy node. In any case, it starts up the
:mod:`stapled.core.daemon`
module to bootstrap the application.
"""
import
configargparse
import
logging
import
logging.handlers
import
os
import
sys
import
configargparse
import
daemon
import
stapled
import
stapled.core.daemon
...
...
@@ -330,7 +331,6 @@ def init():
log_file_handles
=
__init_logging
(
args
)
# Get a mapping of configured sockets and certificate directories from:
# haproxy config, stapled config and command line arguments
haproxy_socket_mapping
=
__get_haproxy_socket_mapping
(
args
)
...
...
@@ -451,10 +451,12 @@ def __init_logging(args):
logger
.
addHandler
(
syslog_handler
)
return
log_file_handles
def
__get_haproxy_socket_mapping
(
args
):
"""
Get a mapping of configured sockets and certificate directories from:
haproxy config, stapled config and command line arguments.
Get mapping of configured sockets and certificate directories.
From: haproxy config, stapled config and command line arguments.
:param Namespace args: Argparser argument list.
:return dict Of cert-paths and sockets for inform of changes.
...
...
@@ -490,9 +492,10 @@ def __get_haproxy_socket_mapping(args):
logger
.
debug
(
"Paths to socket mapping: %s"
,
str
(
mapping
))
return
mapping
def
__get_validated_args
():
"""
Check that arguments make sense
.
Parse and validate CLI arguments and configuration
.
Checks should match the restrictions in the usage help messages.
...
...
@@ -507,12 +510,11 @@ def __get_validated_args():
)
except
ArgumentError
as
exc
:
parser
.
print_usage
(
sys
.
stderr
)
logger
.
critical
(
"Invalid command line argument or value: {}"
.
format
(
exc
)
)
logger
.
critical
(
"Invalid command line argument or value: %s"
,
exc
)
exit
(
1
)
return
args
if
__name__
==
'__main__'
:
try
:
init
()
...
...
Write
Preview
Supports
Markdown
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