Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bundle_certs
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
bundle_certs
Commits
e0c1e9d7
Commit
e0c1e9d7
authored
9 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
Rename find_cert_by_hash to find_cert_by_issuer_hash, sync docs.
parent
9d28e0f8
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
+3
-2
3 additions, 2 deletions
README.rst
bundle_certs
+6
-5
6 additions, 5 deletions
bundle_certs
with
9 additions
and
7 deletions
README.rst
+
3
−
2
View file @
e0c1e9d7
...
@@ -47,8 +47,9 @@ Shell functions
...
@@ -47,8 +47,9 @@ Shell functions
- issuer_hash: Returns OpenSSL's hash of the cert's issuer.
- issuer_hash: Returns OpenSSL's hash of the cert's issuer.
- find_root_cert: Return the filename of the (first) root (self-signed)
- find_root_cert: Return the filename of the (first) root (self-signed)
certificate of the filenames passed as parameters.
certificate of the filenames passed as parameters.
- find_cert_by_hash: Gets a hash and a list of filenames, returns the
- find_cert_by_issuer_hash: Gets a hash and a list of filenames, returns the
filename of the certificate with that subject hash.
filename of the certificate with that issuer hash. Ignores self-signed (root
CA) certificates.
- unbudle_cert: Gets a filename, creates a directory named :code:`certs` which
- unbudle_cert: Gets a filename, creates a directory named :code:`certs` which
contains all of the individual certs in the file (the files are named by their
contains all of the individual certs in the file (the files are named by their
subject hash).
subject hash).
...
...
This diff is collapsed.
Click to expand it.
bundle_certs
+
6
−
5
View file @
e0c1e9d7
...
@@ -23,9 +23,10 @@ find_root_cert () {
...
@@ -23,9 +23,10 @@ find_root_cert () {
done
done
}
}
find_cert_by_hash
()
{
find_cert_by_issuer_hash
()
{
# Recieves the issuer hash and a list of file paths, returns the path to
# Gets a hash and a list of filenames, returns the
# the certificate which was issued by that hash.
# filename of the certificate with that issuer hash. Ignores self-signed
# (root CA) certificates.
certhash
=
"
$1
"
certhash
=
"
$1
"
shift
shift
for
filename
in
"
$@
"
for
filename
in
"
$@
"
...
@@ -66,12 +67,12 @@ bundle_certs () {
...
@@ -66,12 +67,12 @@ bundle_certs () {
echo
"Failed to find root certificate."
>
/dev/stderr
echo
"Failed to find root certificate."
>
/dev/stderr
exit
1
exit
1
fi
fi
issued
=
"
$(
find_cert_by_hash
$issuer
*
)
"
issued
=
"
$(
find_cert_by_
issuer_
hash
$issuer
*
)
"
while
[
-n
"
$issued
"
]
while
[
-n
"
$issued
"
]
do
do
ordered_certs
=
"
$issued
$ordered_certs
"
ordered_certs
=
"
$issued
$ordered_certs
"
issuer
=
"
$issued
"
issuer
=
"
$issued
"
issued
=
"
$(
find_cert_by_hash
$issuer
*
)
"
issued
=
"
$(
find_cert_by_
issuer_
hash
$issuer
*
)
"
done
done
cat
$ordered_certs
cat
$ordered_certs
cd
..
cd
..
...
...
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