broke out create_files

This commit is contained in:
John Lancaster
2026-01-04 13:12:31 -06:00
parent fc7af4a1f1
commit cff9d8d3a9

View File

@@ -195,15 +195,9 @@ restart_sshd() {
fi fi
} }
create_files() {
# Run Process
check_cert_config "certs.conf"
echo
check_ssh_config_files
if [[ $CREATE_HOST_CERT -eq 1 ]]; then if [[ $CREATE_HOST_CERT -eq 1 ]]; then
prompt_user "SSH Host" "SSH host cert missing. Sign the ssh host cert?" prompt_user "SSH Host" "Cert missing. Sign the ssh host cert?"
if [[ $REPLY =~ ^[Yy]$ ]]; then if [[ $REPLY =~ ^[Yy]$ ]]; then
update_prompt $YELLOW_BANG "Signing ssh host cert" update_prompt $YELLOW_BANG "Signing ssh host cert"
sign_host_cert sign_host_cert
@@ -212,16 +206,28 @@ if [[ $CREATE_HOST_CERT -eq 1 ]]; then
fi fi
fi fi
# CREATE_USER_CA=1
if [[ $CREATE_USER_CA -eq 1 ]]; then if [[ $CREATE_USER_CA -eq 1 ]]; then
prompt_user "User CA" "Create the trusted keys file?" prompt_user "SSH Host" "Create the trusted keys file?"
if [[ $REPLY =~ ^[Yy]$ ]]; then if [[ $REPLY =~ ^[Yy]$ ]]; then
(step ssh config --roots > "$path") (step ssh config --roots > "$path")
update_prompt $GREEN_CHECK "User CA" "Created the trusted keys file." update_prompt $GREEN_CHECK "SSH Host" "Created the trusted keys file for the SSH host."
else else
update_prompt $RED_X update_prompt $RED_X
fi fi
fi fi
}
echo -e "\n$SSH_HOST_CERT"
ssh-keygen -Lf "$SSH_HOST_CERT" | grep "Public key" | sed 's/^ *//' # Run Process
check_cert_config "certs.conf"
echo
check_ssh_config_files
create_files
title_msg "\nSSH Host Cert" "$SSH_HOST_CERT\n"
CERT_INFO=$(ssh-keygen -Lf "$SSH_HOST_CERT")
echo -e "$CERT_INFO" | grep "Public key"
echo -e "$CERT_INFO" | grep "Valid"
echo -e "$CERT_INFO" | grep -A3 "Principals"