Skip to content

Commit

Permalink
include: dts-functions: SSH warn missing IPv4
Browse files Browse the repository at this point in the history
Display "check your connection" in red color in IP field in
case no IPv4 address is assigned, otherwise display IP/PORT.

Signed-off-by: Daniil Klimuk <[email protected]>
  • Loading branch information
DaniilKl authored and macpijan committed Apr 15, 2024
1 parent e646747 commit 9737780
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions include/dts-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1334,8 +1334,15 @@ show_des_credentials() {
show_ssh_info() {
if systemctl is-active sshd.socket &> /dev/null; then
local ip=$(ip -br -f inet a show scope global | grep UP | awk '{ print $3 }' | tr '\n' ' ')
echo -e "${BLUE}**${NORMAL} SSH status: ${GREEN}ON${NORMAL} IP: ${ip}{${NORMAL}"
echo -e "${BLUE}*********************************************************${NORMAL}"
# Display "check your connection" in red color in IP field in case no IPV4
# address is assigned, otherwise display IP/PORT:
if [[ -z "$ip" ]]; then
echo -e "${BLUE}**${NORMAL} SSH status: ${GREEN}ON${NORMAL} IP: ${RED}check your connection${NORMAL}"
echo -e "${BLUE}*********************************************************${NORMAL}"
else
echo -e "${BLUE}**${NORMAL} SSH status: ${GREEN}ON${NORMAL} IP: ${ip}${NORMAL}"
echo -e "${BLUE}*********************************************************${NORMAL}"
fi
fi
}

Expand Down

0 comments on commit 9737780

Please sign in to comment.