mirror of
https://github.com/ferdzo/iotDashboard.git
synced 2026-04-05 09:06:26 +00:00
Functioning mqtt ingestion and db write, formating changes, device manager initiated
This commit is contained in:
34
services/device_manager/generate_ca.sh
Executable file
34
services/device_manager/generate_ca.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# Script to generate a Certificate Authority (CA) for IoT devices
|
||||
CERT_DIR="certs"
|
||||
CA_KEY="$CERT_DIR/ca.key"
|
||||
CA_CERT="$CERT_DIR/ca.crt"
|
||||
|
||||
# Create certs directory
|
||||
mkdir -p "$CERT_DIR"
|
||||
|
||||
echo "Generating CA Certificate Authority..."
|
||||
|
||||
# Generate CA private key (4096-bit RSA)
|
||||
openssl genrsa -out "$CA_KEY" 4096
|
||||
echo "Generated CA private key: $CA_KEY"
|
||||
|
||||
# Generate CA certificate (valid for 10 years)
|
||||
openssl req -new -x509 -days 3650 -key "$CA_KEY" -out "$CA_CERT" \
|
||||
-subj "/C=US/ST=State/L=City/O=IoTDashboard/OU=DeviceManager/CN=IoT Device CA"
|
||||
echo "Generated CA certificate: $CA_CERT"
|
||||
|
||||
# Set secure permissions
|
||||
chmod 600 "$CA_KEY"
|
||||
chmod 644 "$CA_CERT"
|
||||
|
||||
echo ""
|
||||
echo "CA Certificate Authority created successfully!"
|
||||
echo ""
|
||||
echo "CA Certificate Details:"
|
||||
openssl x509 -in "$CA_CERT" -noout -text | grep -A 2 "Subject:"
|
||||
echo ""
|
||||
echo "Valid from:"
|
||||
openssl x509 -in "$CA_CERT" -noout -startdate
|
||||
echo "Valid until:"
|
||||
openssl x509 -in "$CA_CERT" -noout -enddate
|
||||
Reference in New Issue
Block a user