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
e691bb3d
Commit
e691bb3d
authored
9 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
- Added checks to every command, removed items from the TODO list.
parent
c8fea9fe
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.rst
+1
-1
1 addition, 1 deletion
README.rst
ssl-ca
+38
-2
38 additions, 2 deletions
ssl-ca
with
39 additions
and
3 deletions
README.rst
+
1
−
1
View file @
e691bb3d
...
@@ -81,4 +81,4 @@ at: https://www.shore.co.il/cgit/.
...
@@ -81,4 +81,4 @@ at: https://www.shore.co.il/cgit/.
TODO
TODO
----
----
- Add checks and failure messages to each action
.
Nothing to see here
.
This diff is collapsed.
Click to expand it.
ssl-ca
+
38
−
2
View file @
e691bb3d
...
@@ -40,7 +40,12 @@ usage () {
...
@@ -40,7 +40,12 @@ usage () {
init
()
{
init
()
{
mkdir
-p
"certs"
"keys"
mkdir
-p
"certs"
"keys"
if
[
-a
openssl.cnf
]
then
echo
openssl.cnf already exists, skipping generation.
else
echo
"
$config
"
>
"openssl.cnf"
echo
"
$config
"
>
"openssl.cnf"
fi
openssl genrsa
\
openssl genrsa
\
-out
CA.key
-out
CA.key
openssl req
\
openssl req
\
...
@@ -52,6 +57,22 @@ init () {
...
@@ -52,6 +57,22 @@ init () {
}
}
sign_key
()
{
sign_key
()
{
if
[
$#
-lt
1
]
||
[
"
$1
"
==
""
]
then
echo
"No host specified."
exit
1
fi
if
[
!
-f
CA.crt
]
||
[
!
-f
CA.key
]
||
[
!
-d
keys
]
||
[
!
-d
certs
]
||
[
!
-f
openssl.cnf
]
then
echo
"CA isn't initialized properly."
exit
1
fi
if
[
!
-f
"keys/
$1
"
]
then
echo
"Can't find key to sign."
exit
1
fi
csr
=
"
$(
mktemp
-t
ssl-ca
)
"
csr
=
"
$(
mktemp
-t
ssl-ca
)
"
export
domain
=
"
$1
.
$(
basename
$PWD
)
"
export
domain
=
"
$1
.
$(
basename
$PWD
)
"
openssl req
\
openssl req
\
...
@@ -59,7 +80,7 @@ sign_key () {
...
@@ -59,7 +80,7 @@ sign_key () {
-new
\
-new
\
-config
openssl.cnf
\
-config
openssl.cnf
\
-out
"
$csr
"
-out
"
$csr
"
fqdn
=
"
$1
.
$domain
"
openssl x509
\
openssl x509
\
-req
\
-req
\
-in
"
$csr
"
\
-in
"
$csr
"
\
-out
"certs/
$1
"
\
-out
"certs/
$1
"
\
...
@@ -71,6 +92,21 @@ sign_key () {
...
@@ -71,6 +92,21 @@ sign_key () {
}
}
gen_key
()
{
gen_key
()
{
if
[
$#
-lt
1
]
||
[
"
$1
"
==
""
]
then
echo
"No host specified."
exit
1
fi
if
[
!
-d
keys
]
then
echo
"keys directory doesn't exists, run ssl-ca init to rectify."
exit
1
fi
if
[
-a
"keys/
$1
"
]
then
echo
"Key already exists."
exit
1
fi
openssl genrsa
-out
"keys/
$1
"
openssl genrsa
-out
"keys/
$1
"
}
}
...
...
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