From 7561bde29dac947411fb7e79f930639ab4e849d9 Mon Sep 17 00:00:00 2001 From: okuji Date: Sat, 21 Oct 2000 21:58:46 +0000 Subject: [PATCH] add a new utility, grub-md5-crypt. --- ChangeLog | 15 +++++++ NEWS | 2 + configure | 6 ++- configure.in | 3 +- docs/Makefile.am | 8 +++- docs/Makefile.in | 8 +++- docs/grub-install.8 | 12 +++--- docs/grub-md5-crypt.8 | 32 +++++++++++++++ docs/grub.texi | 3 ++ docs/stamp-vti | 2 +- docs/user-ref.texi | 22 ++++++++++ docs/version.texi | 2 +- util/Makefile.am | 2 +- util/Makefile.in | 9 ++-- util/grub-install.in | 10 ++--- util/grub-md5-crypt.in | 93 ++++++++++++++++++++++++++++++++++++++++++ 16 files changed, 207 insertions(+), 22 deletions(-) create mode 100644 docs/grub-md5-crypt.8 create mode 100644 util/grub-md5-crypt.in diff --git a/ChangeLog b/ChangeLog index ecabf9cd7..82d4390dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2000-10-22 OKUJI Yoshinori + + * util/grub-install.in (usage): Removed unnecessary commas. + + * util/grub-md5-crypt.in: New file. + * util/Makefile.am (sbin_SCRIPTS): Added grub-md5-crypt. + * configure.in (AC_OUTPUT): Added util/grub-md5-crypt. + * docs/Makefile.am (man_MANS): Added grub-md5-crypt.8. + [MAINTAINER_MODE] ($(srcdir)/grub-md5-crypt.8): New target. + * docs/grub-md5-crypt.8: New file. Generated by help2man. + + * docs/grub.texi (grub-md5-crypt): New direntry. + (Invoking grub-md5-crypt): New entry. + * docs/user-ref.texi (Invoking grub-md5-crypt): New chapter. + 2000-10-22 OKUJI Yoshinori From Matthias Granberry : diff --git a/NEWS b/NEWS index 1a005ff00..b745e6e63 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ New in 1.0 - XXXX-XX-XX: items with their own passwords. * New command, "displayapm". * New command, "md5crypt". +* The new utility ``grub-md5-crypt'' is a fontend of the grub shell. It + encrypts a password in MD5 format. New in 0.5.96 - 2000-10-04: * New commands, "reboot" and "halt". diff --git a/configure b/configure index afb17d96c..9f493de87 100644 --- a/configure +++ b/configure @@ -2998,7 +2998,8 @@ ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile stage1/Makefile stage2/Makefile docs/Makefile \ debian/Makefile lib/Makefile util/Makefile grub/Makefile \ - netboot/Makefile util/grub-image util/grub-install config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 + netboot/Makefile util/grub-image util/grub-install \ + util/grub-md5-crypt config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/configure.in b/configure.in index 19746bb59..89a7a1d6c 100644 --- a/configure.in +++ b/configure.in @@ -527,4 +527,5 @@ AC_SUBST(NETBOOT_DRIVERS) dnl Output. AC_OUTPUT([Makefile stage1/Makefile stage2/Makefile docs/Makefile \ debian/Makefile lib/Makefile util/Makefile grub/Makefile \ - netboot/Makefile util/grub-image util/grub-install]) + netboot/Makefile util/grub-image util/grub-install \ + util/grub-md5-crypt]) diff --git a/docs/Makefile.am b/docs/Makefile.am index e3fbe4ca0..55bef2a4b 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -3,7 +3,7 @@ grub_TEXINFOS = tutorial.texi user-ref.texi prog-ref.texi \ appendices.texi EXAMPLES = boot.S kernel.c multiboot.h multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot.h.texi -man_MANS = grub.8 mbchk.1 grub-install.8 +man_MANS = grub.8 mbchk.1 grub-install.8 grub-md5-crypt.8 HELP2MAN = help2man SRC2TEXI = src2texi noinst_SCRIPTS = $(HELP2MAN) $(SRC2TEXI) @@ -38,4 +38,10 @@ $(srcdir)/mbchk.1: ../util/mbchk $(srcdir)/$(HELP2MAN) $(PERL) $(srcdir)/$(HELP2MAN) \ --name="check the format of a Multiboot kernel" \ --section=1 --output=$@ $< + +$(srcdir)/grub-md5-crypt.8: ../util/grub-md5-crypt $(srcdir)/$(HELP2MAN) + chmod 755 $< + $(PERL) $(srcdir)/$(HELP2MAN) \ + --name="Encrypt a password in MD5 format" \ + --section=8 --output=$@ $< endif diff --git a/docs/Makefile.in b/docs/Makefile.in index 11c6aa62b..11fb16a23 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -93,7 +93,7 @@ grub_TEXINFOS = tutorial.texi user-ref.texi prog-ref.texi \ EXAMPLES = boot.S kernel.c multiboot.h multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot.h.texi -man_MANS = grub.8 mbchk.1 grub-install.8 +man_MANS = grub.8 mbchk.1 grub-install.8 grub-md5-crypt.8 HELP2MAN = help2man SRC2TEXI = src2texi noinst_SCRIPTS = $(HELP2MAN) $(SRC2TEXI) @@ -469,6 +469,12 @@ maintainer-clean-generic clean mostlyclean distclean maintainer-clean @MAINTAINER_MODE_TRUE@ --name="check the format of a Multiboot kernel" \ @MAINTAINER_MODE_TRUE@ --section=1 --output=$@ $< +@MAINTAINER_MODE_TRUE@$(srcdir)/grub-md5-crypt.8: ../util/grub-md5-crypt $(srcdir)/$(HELP2MAN) +@MAINTAINER_MODE_TRUE@ chmod 755 $< +@MAINTAINER_MODE_TRUE@ $(PERL) $(srcdir)/$(HELP2MAN) \ +@MAINTAINER_MODE_TRUE@ --name="Encrypt a password in MD5 format" \ +@MAINTAINER_MODE_TRUE@ --section=8 --output=$@ $< + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/docs/grub-install.8 b/docs/grub-install.8 index 1e4256427..8c30a6d92 100644 --- a/docs/grub-install.8 +++ b/docs/grub-install.8 @@ -16,21 +16,21 @@ print the version information and exit .TP \fB\-\-root\-directory\fR=\fIDIR\fR install GRUB images under the directory DIR -instead of the root directory. +instead of the root directory .TP \fB\-\-grub\-shell\fR=\fIFILE\fR -use FILE as the grub shell. +use FILE as the grub shell .TP \fB\-\-force\-lba\fR force GRUB to use LBA mode even for a buggy -BIOS. +BIOS .TP \fB\-\-recheck\fR -probe a device map even if it already exists. +probe a device map even if it already exists .PP INSTALL_DEVICE can be a GRUB device name or a system device filename. -.PP -Reports bugs to . +.SH "REPORTING BUGS" +Report bugs to . .SH "SEE ALSO" The full documentation for .B grub-install diff --git a/docs/grub-md5-crypt.8 b/docs/grub-md5-crypt.8 new file mode 100644 index 000000000..23805fea6 --- /dev/null +++ b/docs/grub-md5-crypt.8 @@ -0,0 +1,32 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.020. +.TH GRUB-MD5-CRYPT "8" "October 2000" "grub-md5-crypt (GNU GRUB )" FSF +.SH NAME +grub-md5-crypt \- Encrypt a password in MD5 format +.SH SYNOPSIS +.B grub-md5-crypt +[\fIOPTION\fR] +.SH DESCRIPTION +Encrypt a password in MD5 format. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this message and exit +.TP +\fB\-v\fR, \fB\-\-version\fR +print the version information and exit +.TP +\fB\-\-grub\-shell\fR=\fIFILE\fR +use FILE as the grub shell +.SH "REPORTING BUGS" +Report bugs to . +.SH "SEE ALSO" +The full documentation for +.B grub-md5-crypt +is maintained as a Texinfo manual. If the +.B info +and +.B grub-md5-crypt +programs are properly installed at your site, the command +.IP +.B info grub-md5-crypt +.PP +should give you access to the complete manual. diff --git a/docs/grub.texi b/docs/grub.texi index cf077a289..64ec979e3 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -22,6 +22,8 @@ @direntry * GRUB: (grub). The GRand Unified Bootloader * grub-install: (grub)Invoking grub-install. Install GRUB on your drive +* grub-md5-crypt: (grub)Invoking grub-md5-crypt. Encrypt a password + in MD5 format * mbchk: (grub)Invoking mbchk. Check for the format of a Multiboot kernel @end direntry @@ -113,6 +115,7 @@ Part II: The User Reference Manual * Troubleshooting:: Error messages produced by GRUB * Invoking the grub shell:: How to use the grub shell * Invoking grub-install:: How to use the GRUB installer +* Invoking grub-md5-crypt:: How to generate a cryptic password * Invoking mbchk:: How to use the Multiboot checker Part III: The Programmer Reference Manual diff --git a/docs/stamp-vti b/docs/stamp-vti index f31a10271..b8bcdfaff 100644 --- a/docs/stamp-vti +++ b/docs/stamp-vti @@ -1,3 +1,3 @@ -@set UPDATED 14 October 2000 +@set UPDATED 22 October 2000 @set EDITION 0.5.97 @set VERSION 0.5.97 diff --git a/docs/user-ref.texi b/docs/user-ref.texi index 2b8a53ff1..90938f840 100644 --- a/docs/user-ref.texi +++ b/docs/user-ref.texi @@ -1654,6 +1654,28 @@ grub-install --grub-shell="grub --read-only" /dev/fd0 @end table +@node Invoking grub-md5-crypt +@chapter Invoking grub-md5-crypt + +The program @command{grub-md5-crypt} encrypts a password in MD5 format. +This is just a frontend of the grub shell (@pxref{Invoking the grub +shell}). Passwords encrypted by this program can be used with the +command @command{password} (@pxref{Command-line and menu commands}). + +@command{grub-md5-crypt} accepts the following options: + +@table @option +@item --help +Print a summary of the command line options and exit. + +@item --version +Print the version information and exit. + +@item --grub-shell=@var{file} +Use @var{file} as the grub shell. +@end table + + @node Invoking mbchk @chapter Invoking mbchk diff --git a/docs/version.texi b/docs/version.texi index f31a10271..b8bcdfaff 100644 --- a/docs/version.texi +++ b/docs/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 14 October 2000 +@set UPDATED 22 October 2000 @set EDITION 0.5.97 @set VERSION 0.5.97 diff --git a/util/Makefile.am b/util/Makefile.am index 732e09428..f84193c6a 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -1,5 +1,5 @@ bin_PROGRAMS = mbchk -sbin_SCRIPTS = grub-install +sbin_SCRIPTS = grub-install grub-md5-crypt noinst_SCRIPTS = grub-image # XXX: Need to search for a header file in docs, because of multiboot.h. diff --git a/util/Makefile.in b/util/Makefile.in index 62a95a4fb..ed3f583fc 100644 --- a/util/Makefile.in +++ b/util/Makefile.in @@ -88,7 +88,7 @@ install_sh = @install_sh@ bin_PROGRAMS = mbchk -sbin_SCRIPTS = grub-install +sbin_SCRIPTS = grub-install grub-md5-crypt noinst_SCRIPTS = grub-image # XXX: Need to search for a header file in docs, because of multiboot.h. @@ -99,7 +99,7 @@ mbchk_LDADD = ../lib/libcommon.a subdir = util mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = grub-image grub-install +CONFIG_CLEAN_FILES = grub-image grub-install grub-md5-crypt PROGRAMS = $(bin_PROGRAMS) @@ -120,7 +120,8 @@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(mbchk_SOURCES) depcomp = $(SHELL) $(top_srcdir)/depcomp DEP_FILES = @AMDEP@ $(DEPDIR)/mbchk.Po -DIST_COMMON = Makefile.am Makefile.in grub-image.in grub-install.in +DIST_COMMON = Makefile.am Makefile.in grub-image.in grub-install.in \ +grub-md5-crypt.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -143,6 +144,8 @@ grub-image: $(top_builddir)/config.status grub-image.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status grub-install: $(top_builddir)/config.status grub-install.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +grub-md5-crypt: $(top_builddir)/config.status grub-md5-crypt.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status mostlyclean-binPROGRAMS: diff --git a/util/grub-install.in b/util/grub-install.in index 99a40b006..f5e5c9e6e 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -49,15 +49,15 @@ Install GRUB on your drive. -h, --help print this message and exit -v, --version print the version information and exit --root-directory=DIR install GRUB images under the directory DIR - instead of the root directory. - --grub-shell=FILE use FILE as the grub shell. + instead of the root directory + --grub-shell=FILE use FILE as the grub shell --force-lba force GRUB to use LBA mode even for a buggy - BIOS. - --recheck probe a device map even if it already exists. + BIOS + --recheck probe a device map even if it already exists INSTALL_DEVICE can be a GRUB device name or a system device filename. -Reports bugs to . +Report bugs to . EOF } diff --git a/util/grub-md5-crypt.in b/util/grub-md5-crypt.in new file mode 100644 index 000000000..8794f52f5 --- /dev/null +++ b/util/grub-md5-crypt.in @@ -0,0 +1,93 @@ +#! /bin/sh + +# Encrypt a password in MD5 format +# Copyright (C) 2000 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Initialize some variables. +grub_shell=${sbindir}/grub +progname="grub-md5-crypt" + +# Check the arguments. +for option in "$@"; do + case "$option" in + -h | --help) + cat <. +EOF + exit 0 + ;; + + -v | --version) + echo "$progname (GNU GRUB ${VERSION})" + exit 0 + ;; + + --grub-shell=*) + grub_shell=`echo "$option" | sed 's/--grub-shell=//'` + ;; + + *) + echo "$progname: unrecognized option `$option'" + echo "Usage: $progname [OPTION]" + echo "Try `$progname --help' for more information." + exit 1 + ;; + esac +done + +# Suppress echo backs. I don't know if this is really portable. -okuji +stty -echo + +# Prompt to enter a password. +echo -n "Password: " + +# read only one line... I don't know any really portable command for this. +# Does anyone know? -okuji +if test "x$BASH" = x; then + # FIXME: Use Perl instead at the moment. + password=`perl -e '$line = <>; print $line;'` +else + # In BASH, use the builtin command ``read''. + read -r password +fi + +# Resume echo backs. +echo +stty echo + +if test "x$password" = x; then + echo "Empty password is not permitted." + exit 1 +fi + +# Run the grub shell. +$grub_shell --batch --device-map=/dev/null <