Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Wile Coyote
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Geant DevOps
Wile Coyote
Commits
0729913a
Unverified
Commit
0729913a
authored
3 months ago
by
Max Adamo
Browse files
Options
Downloads
Patches
Plain Diff
refactor: update keys function to use configparser for CA file retrieval
parent
cfaf9e29
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
wile_coyote/bin/anvil
+4
-3
4 additions, 3 deletions
wile_coyote/bin/anvil
wile_coyote/common/combine.py
+5
-6
5 additions, 6 deletions
wile_coyote/common/combine.py
wile_coyote/tools/__init__.py
+2
-1
2 additions, 1 deletion
wile_coyote/tools/__init__.py
with
11 additions
and
10 deletions
wile_coyote/bin/anvil
+
4
−
3
View file @
0729913a
...
@@ -145,7 +145,6 @@ if __name__ == "__main__":
...
@@ -145,7 +145,6 @@ if __name__ == "__main__":
log
.
handler
(
constants
.
GIVEUP
,
LOGFILE
,
True
)
log
.
handler
(
constants
.
GIVEUP
,
LOGFILE
,
True
)
sys_kit
.
coyote_exit
(
LOGFILE
,
START_TIMEDATE
,
1
)
sys_kit
.
coyote_exit
(
LOGFILE
,
START_TIMEDATE
,
1
)
ACME_PROVIDERS
=
wile_coyote
.
tools
.
ACME_PROVIDERS
REDIS_HOST
=
wile_coyote
.
tools
.
REDIS_HOST
REDIS_HOST
=
wile_coyote
.
tools
.
REDIS_HOST
REDIS_TOKEN
=
wile_coyote
.
tools
.
REDIS_TOKEN
REDIS_TOKEN
=
wile_coyote
.
tools
.
REDIS_TOKEN
VAULT_HOST
=
wile_coyote
.
tools
.
VAULT_HOST
VAULT_HOST
=
wile_coyote
.
tools
.
VAULT_HOST
...
@@ -154,6 +153,8 @@ if __name__ == "__main__":
...
@@ -154,6 +153,8 @@ if __name__ == "__main__":
CONSUL_LEADER
,
_
,
__
=
wile_coyote
.
tools
.
consul_kit
.
get_leader
(
LOGFILE
)
CONSUL_LEADER
,
_
,
__
=
wile_coyote
.
tools
.
consul_kit
.
get_leader
(
LOGFILE
)
MOUNT_POINTS_V1
=
wile_coyote
.
tools
.
MOUNT_POINTS_V1
MOUNT_POINTS_V1
=
wile_coyote
.
tools
.
MOUNT_POINTS_V1
MOUNT_POINTS_V2
=
wile_coyote
.
tools
.
MOUNT_POINTS_V2
MOUNT_POINTS_V2
=
wile_coyote
.
tools
.
MOUNT_POINTS_V2
ACME_PROVIDERS
=
wile_coyote
.
tools
.
ACME_PROVIDERS
acme_providers_list
=
ACME_PROVIDERS
.
replace
(
'
'
,
''
).
split
(
'
,
'
)
# keys define in .acme.ini
# keys define in .acme.ini
REDIS_KEYS
=
wile_coyote
.
tools
.
REDIS_KEYS
REDIS_KEYS
=
wile_coyote
.
tools
.
REDIS_KEYS
...
@@ -163,11 +164,11 @@ if __name__ == "__main__":
...
@@ -163,11 +164,11 @@ if __name__ == "__main__":
# prune certificates locally
# prune certificates locally
if
PRUNE
:
if
PRUNE
:
if
"
all
"
in
PRUNE
:
if
"
all
"
in
PRUNE
:
prune
=
ACME_PROVIDERS
prune
=
acme_providers_list
else
:
else
:
prune
=
PRUNE
prune
=
PRUNE
for
prov
in
prune
:
for
prov
in
prune
:
if
prov
not
in
ACME_PROVIDERS
:
if
prov
not
in
acme_providers_list
:
log
.
handler
(
f
"
{
prov
}
is not a valid provider
"
,
LOGFILE
,
True
)
log
.
handler
(
f
"
{
prov
}
is not a valid provider
"
,
LOGFILE
,
True
)
log
.
handler
(
constants
.
GIVEUP
,
LOGFILE
,
True
)
log
.
handler
(
constants
.
GIVEUP
,
LOGFILE
,
True
)
sys_kit
.
coyote_exit
(
LOGFILE
,
START_TIMEDATE
,
1
)
sys_kit
.
coyote_exit
(
LOGFILE
,
START_TIMEDATE
,
1
)
...
...
This diff is collapsed.
Click to expand it.
wile_coyote/common/combine.py
+
5
−
6
View file @
0729913a
...
@@ -4,7 +4,7 @@ import os
...
@@ -4,7 +4,7 @@ import os
import
wile_coyote.tools
import
wile_coyote.tools
def
keys
(
certpath
,
provider
,
keypath
,
outpath
):
def
keys
(
cert
_
path
,
provider
,
key
_
path
,
outpath
):
"""
combine certificate, CA and private key
"""
"""
combine certificate, CA and private key
"""
if
os
.
path
.
isdir
(
"
/etc/ssl/certs
"
):
if
os
.
path
.
isdir
(
"
/etc/ssl/certs
"
):
ssl_dir
=
"
/etc/ssl/certs
"
ssl_dir
=
"
/etc/ssl/certs
"
...
@@ -13,13 +13,12 @@ def keys(certpath, provider, keypath, outpath):
...
@@ -13,13 +13,12 @@ def keys(certpath, provider, keypath, outpath):
else
:
else
:
raise
NotImplementedError
(
"
OS not supported
"
)
raise
NotImplementedError
(
"
OS not supported
"
)
# providers and CAs are mapped in acme.ini
ca_file
=
wile_coyote
.
tools
.
PROVIDERS_CA
[
provider
]
acme_providers
=
wile_coyote
.
tools
.
ACME_PROVIDERS
ca_path
=
os
.
path
.
join
(
ssl_dir
,
ca_file
)
capath
=
os
.
path
.
join
(
ssl_dir
,
acme_providers
[
provider
])
file_names
=
[
cert_path
,
ca_path
,
key_path
]
filenames
=
[
certpath
,
capath
,
keypath
]
with
open
(
outpath
,
"
w
"
,
encoding
=
"
utf-8
"
)
as
outfile
:
with
open
(
outpath
,
"
w
"
,
encoding
=
"
utf-8
"
)
as
outfile
:
for
fname
in
filenames
:
for
fname
in
file
_
names
:
with
open
(
fname
,
"
r
"
,
encoding
=
"
utf-8
"
)
as
infile
:
with
open
(
fname
,
"
r
"
,
encoding
=
"
utf-8
"
)
as
infile
:
outfile
.
write
(
infile
.
read
())
outfile
.
write
(
infile
.
read
())
outfile
.
close
()
outfile
.
close
()
This diff is collapsed.
Click to expand it.
wile_coyote/tools/__init__.py
+
2
−
1
View file @
0729913a
...
@@ -21,7 +21,8 @@ for loader, module_name, is_pkg in pkgutil.walk_packages(__path__):
...
@@ -21,7 +21,8 @@ for loader, module_name, is_pkg in pkgutil.walk_packages(__path__):
CONSUL_SERVERS
=
config
.
get
(
'
acme
'
,
'
consul_servers
'
)
CONSUL_SERVERS
=
config
.
get
(
'
acme
'
,
'
consul_servers
'
)
CONSUL_TOKEN
=
config
.
get
(
'
acme
'
,
'
consul_token
'
)
CONSUL_TOKEN
=
config
.
get
(
'
acme
'
,
'
consul_token
'
)
WEB_BASE
=
config
.
get
(
'
acme
'
,
'
web_base
'
)
WEB_BASE
=
config
.
get
(
'
acme
'
,
'
web_base
'
)
ACME_PROVIDERS
=
l_eval
(
config
.
get
(
'
acme
'
,
'
acme_providers
'
))
ACME_PROVIDERS
=
config
.
get
(
'
acme
'
,
'
acme_providers
'
)
PROVIDERS_CA
=
l_eval
(
config
.
get
(
'
acme
'
,
'
providers_ca
'
))
# these parameters only work in test
# these parameters only work in test
if
'
unit-test
'
not
in
config
.
sections
():
if
'
unit-test
'
not
in
config
.
sections
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment