Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
ssl-ca
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
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
nimrod
ssl-ca
Commits
82ff83a0
Commit
82ff83a0
authored
7 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
- Log errors, warnings to stderr instead of stdout.
parent
2dd1134b
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
ssl-ca
+12
-12
12 additions, 12 deletions
ssl-ca
with
12 additions
and
12 deletions
ssl-ca
+
12
−
12
View file @
82ff83a0
#!/bin/sh
set
-eu
which openssl
>
/dev/null
||
(
echo
"Can't find openssl."
;
exit
1
)
which openssl
>
/dev/null
||
(
echo
"Can't find openssl."
>
&2
;
exit
1
)
#seed="$(hexdump -n10 -e '10/1 "%02o" "\n"' /dev/urandom)"
config
=
\
"[ ca ]
...
...
@@ -55,7 +55,7 @@ init () {
# shellcheck disable=SC2039
local
cn
cn
=
"
$(
basename
"
$PWD
"
)
"
export c
d
export
c
n
mkdir
-p
certs keys
if
[
-e
openssl.cnf
]
then
...
...
@@ -65,19 +65,19 @@ init () {
fi
if
[
-e
CA.srl
]
then
echo
CA.srl already exists, skipping.
echo
CA.srl already exists, skipping.
>
&2
else
echo
1000
>
CA.srl
fi
if
[
-e
CA.key
]
then
echo
CA.key already exists, skipping.
echo
CA.key already exists, skipping.
>
&2
else
openssl genrsa
-out
CA.key 2048
fi
if
[
-e
CA.crt
]
then
echo
CA.crt already exists, skipping.
echo
CA.crt already exists, skipping.
>
&2
else
openssl req
\
-x509
\
...
...
@@ -90,7 +90,7 @@ init () {
fi
if
[
-e
CA.p12
]
then
echo
PKCS12 file already exists, skipping.
echo
PKCS12 file already exists, skipping.
>
&2
else
openssl pkcs12
\
-export
\
...
...
@@ -106,18 +106,18 @@ sign_key () {
local
csr cn
if
[
$#
-lt
1
]
||
[
"
$1
"
=
""
]
then
echo
"No host specified."
echo
"No host specified."
>
&2
exit
1
fi
if
[
!
-f
CA.crt
]
||
[
!
-f
CA.key
]
||
[
!
-d
keys
]
||
[
!
-d
certs
]
||
[
!
-f
openssl.cnf
]
then
echo
"CA isn't initialized properly."
echo
"CA isn't initialized properly."
>
&2
exit
1
fi
if
[
!
-f
"keys/
$1
"
]
then
echo
"Can't find key to sign."
echo
"Can't find key to sign."
>
&2
exit
1
fi
csr
=
"
$(
mktemp
-t
ssl-ca-XXXXXXXXX
)
"
...
...
@@ -145,17 +145,17 @@ sign_key () {
gen_key
()
{
if
[
$#
-lt
1
]
||
[
"
$1
"
=
""
]
then
echo
"No host specified."
echo
"No host specified."
>
&2
exit
1
fi
if
[
!
-d
keys
]
then
echo
"keys directory doesn't exists, run ssl-ca init to rectify."
echo
"keys directory doesn't exists, run ssl-ca init to rectify."
>
&2
exit
1
fi
if
[
-e
"keys/
$1
"
]
then
echo
"Key already exists."
echo
"Key already exists."
>
&2
exit
1
fi
openssl genrsa
-out
"keys/
$1
"
2048
...
...
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