From: martin f. krafft Date: Sat, 19 Apr 2008 13:19:40 +0000 (+0200) Subject: move README content to new manpage X-Git-Tag: 0.4~4 X-Git-Url: https://git.madduck.net/code/molly-guard.git/commitdiff_plain/fea7b8cdf75e8aa668889f8db66270a5f971ef1a?ds=sidebyside move README content to new manpage --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..242c36e --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl +XP=xsltproc -''-nonet + +MANPAGE=molly-guard.8 + +all: $(MANPAGE) + +%.8: %.xml + $(XP) $(DB2MAN) $< + +man: $(MANPAGE) + man -l $< +.PHONY: man + +clean: + rm -f $(MANPAGE) +.PHONY: clean + diff --git a/README b/README deleted file mode 100644 index 529dcda..0000000 --- a/README +++ /dev/null @@ -1,34 +0,0 @@ -molly-guard -=========== - -molly-guard attempts to prevent you from accidentally shutting down or -rebooting remote machines. It does this by injecting a couple of checks before -the existing commands: halt, reboot, shutdown, and poweroff. - -It does this by putting scripts with the same names into /usr/sbin, so it only -works if you have /usr/sbin before /sbin in your $PATH! - -The checks are: - - - test whether the current pty has been created by sshd - - test whether a variable $SSH_CONNECTION exists - -If any of these tests are successful, molly-guard asks you to type the -machine's hostname, which should be sufficient to prevent you from doing -something by accident. - -The following situations are still UNGUARDED. If you can think of ways to -protect against those, please let me know! - - - running sudo within screen or screen within sudo; sudo eats the - $SSH_CONNECTION variable, and screen creates a new pty. - - - executing those command in a remote terminal window, that is a XTerm - started on a remote machine but displaying on the local X server. - -You have been warned. You can use the --molly-guard-do-nothing switch to -prevent anything from happening, e.g. - - halt --molly-guard-do-nothing - - -- martin f. krafft Wed, 12 Mar 2008 20:02:14 +0100 diff --git a/molly-guard.xml b/molly-guard.xml new file mode 100644 index 0000000..01988ad --- /dev/null +++ b/molly-guard.xml @@ -0,0 +1,281 @@ + +.
will be generated. You may view the +manual page with: nroff -man .
| less'. A +typical entry in a Makefile or Makefile.am is: + +DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\ +manpages/docbook.xsl +XP=xsltproc -''-nonet + +manpage.1: manpage.dbk + $(XP) $(DB2MAN) $< + +The xsltproc binary is found in the xsltproc package. The +XSL files are in docbook-xsl. Please remember that if you +create the nroff version in one of the debian/rules file +targets (such as build), you will need to include xsltproc +and docbook-xsl in your Build-Depends control field. + +--> + + + martin f."> + krafft"> + + Apr 19, 2008"> + + 8"> + madduck@madduck.net"> + + molly-guard"> + + molly-guard"> + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + 2008 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhcommand; + + guard against accidental shutdowns/reboots + + + + + shutdown + + - + + + + + + -- script_options + + + + halt + + - + + + + + + -- script_options + + + + reboot + + - + + + + + + -- script_options + + + + poweroff + + - + + + + + + -- script_options + + + + + + DESCRIPTION + + &dhcommand; attempts to prevent you from accidentally shutting down + or rebooting machines. It does this by injecting a couple of checks + before the existing commands: halt, + reboot, shutdown, and + poweroff. This happens via scripts with the same + names in /usr/sbin, so it only works if you have + /usr/sbin before /sbin in your + PATH! + + Before &dhcommand; invokes the real command, all scripts in + /etc/molly-guard/run.d/ have to run and exit + successfully; else, it aborts the command. + run-parts(1) is used to process the directory. + + &dhcommand; passes any script_options to the + scripts, and also populates the environment with the following + variables: + + + MOLLYGUARD_CMD - the actual command + invoked by the user. + + MOLLYGUARD_DO_NOTHING - set to + if this is a demo-run. + + MOLLYGUARD_SETTINGS - the path to + a shell script snippet which scripts can source to obtain + settings. + + + &dhcommand; prints the contents of + /etc/molly-guard/messages.d/COMMAND or + /etc/molly-guard/messages.d/default to the console, + if either exists. This is due to + /etc/molly-guard/run.d/10-print-message. + + + + GUARDING SSH SESSIONS + + &dhcommand; was primarily designed to shield SSH connections. This + functionality (which should arguably be provided by the + openssh-server package) is implemented in + /etc/molly-guard/run.d/10-print-message. + + This script first tests whether the command is being executed from + a tty which has been created by + sshd. It also checks whether the variable + SSH_CONNECTION is defined. If any of these tests are + successful, test script queries the user for the machine's hostname, + which should be sufficient to prevent the user from doing something by + accident. + + You can pass the script option to + &dhcommand; to pretend that those tests succeeds. Alternatively, setting + ALWAYS_QUERY_HOSTNAME in + /etc/default/molly-guard causes the script to + always query. + + The following situations are still UNGUARDED. If you can think of + ways to protect against those, please let me know! + + + running sudo within + screen or screen within + sudo; sudo eats the + SSH_CONNECTION variable, and + screen creates a new + pty. + executing those command in a remote terminal window, + that is a XTerm started on a remote + machine but displaying on the local X + server. + + + You have been warned. You can use the + switch to prevent anything + from happening, e.g. halt + --molly-guard-do-nothing. + + + + OPTIONS + + + --molly-guard-do-nothing + + + Cause &dhcommand; to print the command which would be executed, + after processing all scripts, instead of executing it. + + + + + + -h + --help + + + Display usage information. + + + + + + -V + --version + + + Display version information. + + + + + + + + SEE ALSO + + + shutdown + 8 + , + + halt + 1 + , + + reboot + 8 + , + + poweroff + 8 + . + + + + + LEGALESE + + + &dhpackage; is copyright by &dhusername;. Andrew Ruthven came up with + the idea of using the scripts directory and submitted a patch, which + I modified a bit. + + + + This manual page was written by &dhusername; &dhemail;. + + + + Permission is granted to copy, distribute and/or modify this document + under the terms of the Artistic License 2.0 + + + +