polish
This commit is contained in:
@@ -19,6 +19,7 @@ CREATE_USER_CA=0
|
||||
CREATE_HOST_CERT=0
|
||||
NEEDS_RESTART=0
|
||||
|
||||
|
||||
#
|
||||
# Function Definitions
|
||||
#
|
||||
@@ -39,7 +40,8 @@ ssh_config_val() {
|
||||
title_msg() {
|
||||
local title="\e[1m${1:-Title}:\e[0m"
|
||||
local prompt="${2:-Prompt for the user}"
|
||||
printf "%b %b" "$title" "$prompt"
|
||||
# printf "%b %b" "$title" "$prompt"
|
||||
echo -e "$title $prompt"
|
||||
}
|
||||
|
||||
prompt_user() {
|
||||
@@ -186,13 +188,11 @@ restart_sshd() {
|
||||
update_prompt $RED_X "sshd" "Failed to restart sshd.service"
|
||||
exit 1
|
||||
fi
|
||||
echo
|
||||
}
|
||||
|
||||
create_files() {
|
||||
local wrote_lines=0
|
||||
|
||||
if [[ $CREATE_HOST_CERT -eq 1 ]]; then
|
||||
wrote_lines=1
|
||||
prompt_user "SSH Host" "Cert missing. Sign the ssh host cert?"
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
update_prompt $YELLOW_BANG "Signing ssh host cert"
|
||||
@@ -204,7 +204,6 @@ create_files() {
|
||||
fi
|
||||
|
||||
if [[ $CREATE_USER_CA -eq 1 ]]; then
|
||||
wrote_lines=1
|
||||
prompt_user "SSH Host" "Create the trusted keys file?"
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
(step ssh config --roots > "$path")
|
||||
@@ -214,8 +213,6 @@ create_files() {
|
||||
update_prompt $RED_X
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $wrote_lines -eq 1 ]]; then echo; fi
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +223,7 @@ check_ssh_config_files
|
||||
create_files
|
||||
restart_sshd
|
||||
|
||||
title_msg "SSH Host Cert" "$SSH_HOST_CERT\n"
|
||||
title_msg "SSH Host Cert" "$SSH_HOST_CERT"
|
||||
CERT_INFO=$(ssh-keygen -Lf "$SSH_HOST_CERT")
|
||||
echo -e "$CERT_INFO" | grep "Public key"
|
||||
echo -e "$CERT_INFO" | grep "Valid"
|
||||
|
||||
Reference in New Issue
Block a user