also sprach Francois Marier <franc...@debian.org> [2013.04.14.1234 +0200]:
> On the other hand, if I use mosh to access the same server, typing
> "sudo reboot" immediately reboots the server without any prompts.

Does this patch against /etc/molly-guard/30-query-hostname guard
against this?

--- a/run.d/30-query-hostname
+++ b/run.d/30-query-hostname
@@ -11,7 +11,7 @@ ME=molly-guard
 
 # Walk up the process tree until PID 1 is reached or a process with 'sshd' in
 # its /proc/<pid>/cmdline is met. Return success if such a process is found.
-is_child_of_sshd() {
+is_child_of_sshd_or_mosh_server() {
   pid=$$
   ppid=$PPID
   # Be a bit paranoid with the guard, should some horribly broken system
@@ -19,7 +19,7 @@ is_child_of_sshd() {
   # sane systems.
   [ -z "$pid" ] || [ -z "$ppid" ] && return 2
   while [ $pid -gt 1 ] && [ $pid -ne $ppid ]; do
-    if grep -q sshd /proc/$ppid/cmdline; then
+    if egrep -q 'sshd|mosh-server' /proc/$ppid/cmdline; then
       return 0
     fi
     pid=$ppid

-- 
 .''`.   martin f. krafft <madduck@d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems

Attachment: digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)

Reply via email to