Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
float
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container registry
Model registry
Operate
Environments
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
ai3
float
Commits
3d668b49
Commit
3d668b49
authored
6 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Add a new credential type 'rsakey' (a PEM-encoded RSA private key)
parent
8e9e871e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/pwgen.py
+10
-0
10 additions, 0 deletions
scripts/pwgen.py
with
10 additions
and
0 deletions
scripts/pwgen.py
+
10
−
0
View file @
3d668b49
...
...
@@ -118,6 +118,14 @@ def generate_tsig_key():
shutil
.
rmtree
(
tmp_dir
,
ignore_errors
=
True
)
def
generate_rsa_key
(
bits
):
"""
Create a RSA private key of the specified size.
The result is a PEM-encoded string.
"""
return
subprocess
.
check_output
([
'
openssl
'
,
'
genrsa
'
,
str
(
bits
)])
def
generate_password
(
entry
):
ptype
=
entry
.
get
(
'
type
'
,
'
simple
'
)
if
ptype
==
'
simple
'
:
...
...
@@ -126,6 +134,8 @@ def generate_password(entry):
return
generate_binary_secret
(
length
=
int
(
entry
.
get
(
'
length
'
,
32
)))
elif
ptype
==
'
tsig
'
:
return
generate_tsig_key
()
elif
ptype
==
'
rsakey
'
:
return
generate_rsa_key
(
bits
=
int
(
entry
.
get
(
'
bits
'
,
2048
)))
else
:
raise
Exception
(
'
Unknown password type
"
%s
"'
%
ptype
)
...
...
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