login prompts with issue

From Noah.org
Jump to: navigation, search


The file /etc/issue is used to create the login prompt for console logins. The file /etc/issue.net is used for SSH logins (if enabled -- see below).

enable login prompts for SSH

/etc/dhcp3/dhclient-exit-hooks.d/issue script

bug
This presumes that the primary interface is 'eth0'.
if [ "$reason" = "BOUND" ] && [ "$interface" = "eth0" ]; then
    update-issue
fi

/usr/sbin/update-issue script

This will display some useful information on virtual console logins and on SSH network logins. Note that sshd must have issue.net printing enabled if you want to show this.

bug
This presumes that the primary interface begins with 'eth'. It picks the fist 'eth' interface with a number after it.
#!/bin/sh
. /etc/environment
DEVICE=$(ip -o link show | grep -o -E "eth[[:digit:]]+")
DEVICE_MAC=$(cat /sys/class/net/${DEVICE}/address)
DEVICE_IP=$(ip -o addr show ${DEVICE_MAC} | sed -n -e "s/.*inet \([[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\).*/\1/p")

(echo "MAC:|${DEVICE_MAC}"
echo "IP:|${DEVICE_IP}"
echo ) | column -t -s "|" > /etc/issue.net
echo >> /etc/issue.net

echo "\033[2J\033[f" > /etc/issue
(echo "Line:|\\\\l @ \\\\b baud"
echo "Date:|\\\\d"
echo "Time:|\\\\t"
echo "MAC:|${DEVICE_MAC}"
echo "IP:|${DEVICE_IP}"
echo 
echo ) | column -t -s "|" >> /etc/issue
echo >> /etc/issue