Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Warden
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pavel Valach
Warden
Commits
dc6c83dd
Commit
dc6c83dd
authored
4 years ago
by
Rajmund Hruška
Browse files
Options
Downloads
Patches
Plain Diff
Add support for Python3
parent
fc907c25
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
warden_ra/ejbcaws.py
+8
-2
8 additions, 2 deletions
warden_ra/ejbcaws.py
warden_ra/warden_ra.py
+14
-8
14 additions, 8 deletions
warden_ra/warden_ra.py
warden_server/warden_server.py
+1
-1
1 addition, 1 deletion
warden_server/warden_server.py
with
23 additions
and
11 deletions
warden_ra/ejbcaws.py
100644 → 100755
+
8
−
2
View file @
dc6c83dd
...
...
@@ -4,8 +4,7 @@
# Copyright (c) 2016, CESNET, z. s. p. o.
# Use of this source is governed by an ISC license, see LICENSE file.
import
urllib2
import
httplib
import
sys
import
socket
import
base64
import
suds.transport.http
...
...
@@ -13,6 +12,13 @@ import suds.client
import
M2Crypto
if
sys
.
version_info
[
0
]
>=
3
:
import
urllib.request
as
urllib2
import
http.client
as
httplib
else
:
import
urllib2
import
httplib
STATUS_FAILED
=
11
STATUS_GENERATED
=
40
STATUS_HISTORICAL
=
60
...
...
This diff is collapsed.
Click to expand it.
warden_ra/warden_ra.py
+
14
−
8
View file @
dc6c83dd
...
...
@@ -4,6 +4,8 @@
# Copyright (c) 2016, CESNET, z. s. p. o.
# Use of this source is governed by an ISC license, see LICENSE file.
from
__future__
import
print_function
import
sys
import
os
import
time
...
...
@@ -21,13 +23,17 @@ import subprocess
import
shlex
import
tempfile
import
M2Crypto
import
ConfigParser
# *ph* server vulnerable to logjam, local openssl too new, use hammer to disable Diffie-Helmann
import
ssl
ssl
.
_DEFAULT_CIPHERS
+=
"
:!DH
"
import
ejbcaws
if
sys
.
version_info
[
0
]
>=
3
:
import
configparser
as
ConfigParser
else
:
import
ConfigParser
# usual path to warden server
sys
.
path
.
append
(
pth
.
join
(
pth
.
dirname
(
__file__
),
"
..
"
,
"
warden-server
"
))
import
warden_server
...
...
@@ -120,7 +126,7 @@ class OpenSSLRegistry(object):
except
OSError
as
e
:
if
e
.
errno
!=
errno
.
EEXIST
:
raise
with
tempfile
.
NamedTemporaryFile
(
dir
=
client_path
,
delete
=
False
)
as
cf
:
with
tempfile
.
NamedTemporaryFile
(
dir
=
client_path
,
delete
=
False
,
mode
=
"
w
"
)
as
cf
:
config
.
write
(
cf
)
os
.
chmod
(
cf
.
name
,
0o660
)
# read privilege for usual apache group
os
.
rename
(
cf
.
name
,
pth
.
join
(
client_path
,
"
state
"
))
# atomic + rewrite, so no need for locking
...
...
@@ -309,7 +315,7 @@ class OptionalAuthenticator(ObjectBase):
try
:
args
[
"
password
"
][
0
]
return
"
pwd
"
# Ok, pass on, but getCert will have to rely on certificate registry password
except
KeyError
,
IndexError
:
except
(
KeyError
,
IndexError
)
:
exception
=
self
.
req
.
error
(
message
=
"
authenticate: no certificate nor password present
"
,
error
=
403
,
cn
=
cert_name
,
args
=
args
)
exception
.
log
(
self
.
log
)
return
None
...
...
@@ -414,7 +420,7 @@ def list_clients(registry, name=None, verbose=False, show_cert=True):
if
name
is
not
None
:
client
=
registry
.
get_client
(
name
)
if
client
is
None
:
print
"
No such client.
"
print
(
"
No such client.
"
)
return
else
:
print
(
client
.
str
(
verbose
))
...
...
@@ -442,14 +448,14 @@ def register_client(registry, name, admins=None, verbose=False):
def
applicant
(
registry
,
name
,
password
=
None
,
verbose
=
False
):
client
=
registry
.
get_client
(
name
)
if
not
client
:
print
"
No such client.
"
print
(
"
No such client.
"
)
return
if
password
is
None
:
password
=
""
.
join
((
random
.
choice
(
string
.
ascii_letters
+
string
.
digits
)
for
dummy
in
range
(
16
)))
try
:
client
.
update
(
status
=
"
Issuable
"
,
pwd
=
password
)
except
ClientDisabledError
:
print
"
This client is disabled. Use
'
enable
'
first.
"
print
(
"
This client is disabled. Use
'
enable
'
first.
"
)
return
registry
.
save_client
(
client
)
list_clients
(
registry
,
name
,
verbose
,
show_cert
=
False
)
...
...
@@ -459,7 +465,7 @@ def applicant(registry, name, password=None, verbose=False):
def
enable
(
registry
,
name
,
verbose
=
False
):
client
=
registry
.
get_client
(
name
)
if
not
client
:
print
"
No such client.
"
print
(
"
No such client.
"
)
return
client
.
update
(
status
=
"
Passive
"
)
registry
.
save_client
(
client
)
...
...
@@ -469,7 +475,7 @@ def enable(registry, name, verbose=False):
def
disable
(
registry
,
name
,
verbose
=
False
):
client
=
registry
.
get_client
(
name
)
if
not
client
:
print
"
No such client.
"
print
(
"
No such client.
"
)
return
client
.
update
(
status
=
"
Disabled
"
)
registry
.
save_client
(
client
)
...
...
This diff is collapsed.
Click to expand it.
warden_server/warden_server.py
+
1
−
1
View file @
dc6c83dd
...
...
@@ -863,7 +863,7 @@ def expose(read=1, write=0, debug=0):
meth
.
write
=
write
meth
.
debug
=
debug
if
not
hasattr
(
meth
,
"
arguments
"
):
meth
.
arguments
=
meth
.
func_code
.
co_v
ar
n
am
es
[:
meth
.
func_code
.
co_argcount
]
meth
.
arguments
=
get_method_p
aram
s
(
meth
)
return
meth
return
expose_deco
...
...
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