mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-15 17:11:30 +00:00
feat: improved certificate authority with auto-discovery, CA download, and cloud-init injection
Auto-discover all node IPs (WAN, mgmt, VPC) and hostname for server cert SANs — fixes TLS failures when accessing Spinifex via non-localhost IPs. Adds CA download endpoint (/api/ca.pem) with install instructions on the login page. Injects CA cert into guest VM cloud-init so EC2 instances trust Spinifex services without --insecure. Adds 'spx admin cert renew' command for cert regeneration after IP changes. Includes certificate validation E2E test suite (run-cert-e2e.sh) with system trust store, SAN, and in-guest TLS verification across single, pseudo multi-node, and real multi-node modes. Closes: mulga-777, mulga-778, mulga-779, mulga-780, mulga-781 Plan: docs/development/feature/cert-manager.md
This commit is contained in:
@@ -256,4 +256,46 @@ fi
|
||||
|
||||
aws ec2 describe-images
|
||||
|
||||
echo "Reset complete, fresh AMI imported, proceed to creating instances"
|
||||
# --- Launch a smoke-test instance ---
|
||||
echo "Launching smoke-test instance..."
|
||||
|
||||
# Pick instance type based on CPU vendor
|
||||
if grep -q 'AuthenticAMD' /proc/cpuinfo; then
|
||||
INSTANCE_TYPE="t3a.small"
|
||||
else
|
||||
INSTANCE_TYPE="t3.small"
|
||||
fi
|
||||
|
||||
# Get the AMI we just imported
|
||||
AMI_ID=$(aws ec2 describe-images --query "Images[0].ImageId" --output text)
|
||||
if [ -z "$AMI_ID" ] || [ "$AMI_ID" = "None" ]; then
|
||||
echo "❌ No AMI found, skipping instance launch"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Find a public subnet (first available)
|
||||
SUBNET_ID=$(aws ec2 describe-subnets \
|
||||
--filters "Name=map-public-ip-on-launch,Values=true" \
|
||||
--query "Subnets[0].SubnetId" --output text 2>/dev/null)
|
||||
# Fallback: just grab the first subnet if no public-tagged one exists
|
||||
if [ -z "$SUBNET_ID" ] || [ "$SUBNET_ID" = "None" ]; then
|
||||
SUBNET_ID=$(aws ec2 describe-subnets --query "Subnets[0].SubnetId" --output text)
|
||||
fi
|
||||
if [ -z "$SUBNET_ID" ] || [ "$SUBNET_ID" = "None" ]; then
|
||||
echo "❌ No subnet found, skipping instance launch"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo " AMI: $AMI_ID"
|
||||
echo " Instance type: $INSTANCE_TYPE"
|
||||
echo " Subnet: $SUBNET_ID"
|
||||
|
||||
INSTANCE_ID=$(aws ec2 run-instances \
|
||||
--image-id "$AMI_ID" \
|
||||
--instance-type "$INSTANCE_TYPE" \
|
||||
--key-name spinifex-key \
|
||||
--subnet-id "$SUBNET_ID" \
|
||||
--count 1 \
|
||||
--query 'Instances[0].InstanceId' --output text)
|
||||
|
||||
echo "✅ Reset complete — instance $INSTANCE_ID launched ($INSTANCE_TYPE)"
|
||||
|
||||
Reference in New Issue
Block a user