Skip to content
Snippets Groups Projects
Commit ad9cbee0 authored by nimrod's avatar nimrod
Browse files

Some openssl changes.

- New alias for checking a server's certificate.
- Move everything to a dedicated file under `.bashrc.d/`.
parent f5ff7bfd
No related branches found
No related tags found
No related merge requests found
......@@ -186,11 +186,6 @@ genpass () {
echo
}
gen_csr () {
name="${1:-site}"
openssl req -new -newkey rsa:4096 -nodes -out "$name.csr" -keyout "$name.key"
}
kodi_scan () {
# shellcheck disable=SC1083
ssh kodi.shore.co.il curl --silent --fail --show-error --json \'{\"jsonrpc\": \"2.0\", \"id\": \"transmission\", \"method\": \"VideoLibrary.Scan\"}\' http://127.0.0.1:8080/jsonrpc | jt
......@@ -198,22 +193,6 @@ kodi_scan () {
ssh kodi.shore.co.il curl --silent --fail --show-error --json \'{\"jsonrpc\": \"2.0\", \"id\": \"transmission\", \"method\": \"AudioLibrary.Scan\"}\' http://127.0.0.1:8080/jsonrpc | jt
}
match_ssl_pair () {
if [ "$#" -ne 2 ]
then
echo "Usage: match_ssl_pair private_key certificate"
return 1
fi
tempkey="$(mktemp)"
tempcert="$(mktemp)"
openssl pkey -pubout -outform PEM -in "$1" > "$tempkey"
openssl x509 -pubkey -noout -in "$2" > "$tempcert"
cmp "$tempkey" "$tempcert" > /dev/null
exitcode="$?"
rm "$tempkey" "$tempcert"
return "$exitcode"
}
mnt_lib () {
mkdir -p "$HOME/Library"
rclone mount \
......
# shellcheck shell=bash
# vim: ft=sh
alias cert-check="echo | openssl s_client -port 443 -build_chain -showcerts -connect"
gen_csr () {
name="${1:-site}"
openssl req -new -newkey rsa:4096 -nodes -out "$name.csr" -keyout "$name.key"
}
match_ssl_pair () {
if [ "$#" -ne 2 ]
then
echo "Usage: match_ssl_pair private_key certificate"
return 1
fi
tempkey="$(mktemp)"
tempcert="$(mktemp)"
openssl pkey -pubout -outform PEM -in "$1" > "$tempkey"
openssl x509 -pubkey -noout -in "$2" > "$tempcert"
cmp "$tempkey" "$tempcert" > /dev/null
exitcode="$?"
rm "$tempkey" "$tempcert"
return "$exitcode"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment