-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support HTTPS with Self-Signed Certificates #52
Closed
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
bdef5ae
initial commit
blaise-muhirwa 64a855f
fix makefile
blaise-muhirwa f189004
fix typo
blaise-muhirwa a88d4dc
use a specific SDK branch
blaise-muhirwa 9ff56c0
mount tls certificates into k3s pod
blaise-muhirwa 2d8f099
github action
blaise-muhirwa 5e1ed0c
remove cached venv
blaise-muhirwa d3653a9
rename environment variable to DISABLE_TLS_VERIFY
blaise-muhirwa 6e5be88
try removing lock file and re-installing
blaise-muhirwa 309a4ef
github action
blaise-muhirwa 7852678
fix Dockerfile
blaise-muhirwa 684512e
add edge deployment customization
blaise-muhirwa 3ab3bc3
more nginx configuration
blaise-muhirwa c7f148b
fix tests
blaise-muhirwa 4f9f647
add ssl config file
blaise-muhirwa b362afc
fixing motion detection tests
blaise-muhirwa 82f0537
separate https from http server block
blaise-muhirwa 831455f
documentation
blaise-muhirwa c30eb0a
[wip]
blaise-muhirwa 124ca86
save temporary work
blaise-muhirwa ac70b50
merge from upstream
blaise-muhirwa a95daa2
add nodeport for https routing
blaise-muhirwa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
# Function to check if openssl is installed. If not exist | ||
# then install it. | ||
check_openssl() { | ||
if ! command -v openssl &> /dev/null | ||
then | ||
echo "openssl could not be found" | ||
echo "Installing openssl..." | ||
sudo apt-get install openssl | ||
fi | ||
} | ||
|
||
# Check if openssl is installed | ||
check_openssl | ||
|
||
# Change to current directory | ||
cd $(dirname $0) | ||
|
||
# Set TLS_CERT_DIR to current directory | ||
TLS_CERT_DIR=$(pwd)/ssl | ||
|
||
# Generate an Ed25519 Private key | ||
sudo openssl genpkey -algorithm Ed25519 -out ${TLS_CERT_DIR}/nginx_ed25519.key | ||
|
||
# Generate a self-signed certificate using the Ed25519 Private key | ||
# Valid for 365 days | ||
sudo openssl req -new -x509 \ | ||
-config ssl/openssl-custom.cnf \ | ||
-batch \ | ||
-key ${TLS_CERT_DIR}/nginx_ed25519.key \ | ||
-out ${TLS_CERT_DIR}/nginx_ed25519.crt \ | ||
-days 365 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# https://www.phildev.net/ssl/opensslconf.html | ||
|
||
[req] | ||
distinguished_name = req_distinguished_name | ||
x509_extensions = v3_ca | ||
prompt = no | ||
|
||
[req_distinguished_name] | ||
countryName = US | ||
|
||
[v3_ca] | ||
basicConstraints = CA:TRUE | ||
keyUsage = digitalSignature, keyCertSign, cRLSign |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
K="k3s kubectl" | ||
TLS_PRIVATE_KEY="certs/ssl/nginx_ed25519.key" | ||
TLS_CERTIFICATE="certs/ssl/nginx_ed25519.crt" | ||
|
||
$K delete --ignore-not-found secret tls-certificate | ||
|
||
|
||
# First check if the certs/ssl/nginx_ed25519.key and certs/ssl/nginx_ed25519.crt exist | ||
# If not exit early. Using exit 0 instead of exit 1 since this is an optional secret. | ||
if [ ! -f "$TLS_PRIVATE_KEY" ] || [ ! -f "$TLS_CERTIFICATE" ]; then | ||
echo "TLS certificate and key not found at the desired location. Exiting..." | ||
exit 0 | ||
fi | ||
|
||
|
||
# Create a kubernetes secret for the TLS certificate and private key | ||
$K create secret generic tls-certificate \ | ||
--from-file=nginx_ed25519.key=${TLS_PRIVATE_KEY} \ | ||
--from-file=nginx_ed25519.crt=${TLS_CERTIFICATE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apiVersion: apps/v1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of this is also not necessary! Will get rid of it and remove any scripting that was setup to apply this deployment patch. |
||
kind: Deployment | ||
metadata: | ||
name: edge-endpoint | ||
labels: | ||
app: edge-endpoint | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: edge-logic-server | ||
template: | ||
metadata: | ||
labels: | ||
app: edge-logic-server | ||
spec: | ||
serviceAccountName: edge-endpoint-service-account | ||
containers: | ||
- name: edge-endpoint | ||
volumeMounts: | ||
- name: tsl-certificate-volume | ||
mountPath: /etc/nginx/ssl | ||
readOnly: true | ||
volumes: | ||
# Expecting the `tls-certificate` secret to have been | ||
# generated before applying this patch | ||
- name: tls-certificate-volume | ||
secret: | ||
secretName: tls-certificate |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once I figure out how to optionally check for TLS certificate in NGINX config, I will remove this step since motion detection tests actually run just with HTTP.