[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#439512: debian-installer: doubled serial console lines in /etc/securetty



Ferenc Wágner <wferi@niif.hu> writes:

> However, those entries are already present in the file, at the very top.
> It doesn't seem to cause a problem in itself, but can become dangerous
> if the administrator removes only one (pair) of the entries and thinks
> s/he disabled root login over the serial console.
>
> I think it's better to remove this append from the installer.

I see two possible solutions for it. One is to remove the original
ones from login package and let d-i to set it. Other is to use
something line the bellow patch to avoid duplicating it.

I hadn't test it myself but if people has no problems with it, I'll
test it and go with it.

diff --git a/packages/finish-install/finish-install.d/90console b/packages/finish-install/finish-install.d/90console
index 2fd6e2f..fd2a38d 100755
--- a/packages/finish-install/finish-install.d/90console
+++ b/packages/finish-install/finish-install.d/90console
@@ -5,6 +5,14 @@ log() {
 	logger -t finish-install "$@"
 }
 
+avoid_duplication() {
+	if ! grep -q "$1" "$2"; then
+		echo "" >> "$2"
+		echo "# serial console added by debian-installer" >> "$2"
+		echo "$1" >> "$2"
+	fi
+}		
+
 # Since this script is running with debconf, 'tty' does
 # not give reliable answers about what sort of terminal
 # we have.  The stdin of /sbin/debian-installer seems
@@ -39,11 +47,9 @@ case "$console" in
 		    /target/etc/event.d/tty1 > /target/etc/event.d/$console
 	fi
 
-	echo "" >> /target/etc/securetty
-	echo "# serial console added by debian-installer" >> /target/etc/securetty
-	echo "$rawconsole" >> /target/etc/securetty
+	avoid_duplication "$rawconsole" /target/etc/securetty
 	if [ -n "$console" ] && [ "$console" != "$rawconsole" ]; then
-		echo "$console" >> /target/etc/securetty
+		avoid_duplication "$console" /target/etc/securetty
 	fi
 	;;
 esac
-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio@debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."

Reply to: