From 5a7ab3ff791485b6eb2b4bd48d2cb146fd8ed1da Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 19 Sep 2014 02:15:38 -0700 Subject: [PATCH] disable_kill --- README | 4 ++-- slock.c | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README b/README index f38843c..8f0b23f 100644 --- a/README +++ b/README @@ -31,8 +31,8 @@ Changes by chjj wrong password or pressed ALT/CTRL/F1-13/SYSRQ. See twilio_example.h to create a twilio.h file. You will need a twilio account to set this up. -- Disabling alt+sysrq before shutting down: This prevents an attacker from - alt+sysrq+k'ing the screenlock quickly before the shutdown. +- Disabling alt+sysrq and ctrl+alt+backspace before shutting down: This + prevents an attacker from killing the screenlock quickly before the shutdown. - This requires a sudoers option to be set in /etc/sudoers: diff --git a/slock.c b/slock.c index 759e307..ce1ce5e 100644 --- a/slock.c +++ b/slock.c @@ -148,9 +148,10 @@ error: return NULL; } -// Disable alt+sysrq - keeps the attacker from alt+sysrq+k'ing our process +// Disable alt+sysrq and crtl+alt+backspace - keeps the +// attacker from alt+sysrq+k'ing our process static void -disable_sysrq(void) { +disable_kill(void) { #if POWEROFF // Needs sudo privileges - alter your /etc/sudoers file: // [username] [hostname] =NOPASSWD: /usr/bin/tee /proc/sys/kernel/sysrq @@ -438,8 +439,8 @@ readpw(Display *dpy, const char *pws) // Poweroff if there are more than 5 bad attempts. if(lock_tries > 5) { - // Disable alt+sysrq - disable_sysrq(); + // Disable alt+sysrq and crtl+alt+backspace + disable_kill(); // Take a webcam shot of whoever is tampering with our machine: webcam_shot(0); @@ -482,7 +483,7 @@ readpw(Display *dpy, const char *pws) case XK_Escape: len = 0; break; - case XK_BackSpace: + case XK_Delete: if(len) --len; break; @@ -503,8 +504,9 @@ readpw(Display *dpy, const char *pws) case XK_F11: case XK_F12: case XK_F13: - // Disable alt+sysrq - disable_sysrq(); + case XK_BackSpace: + // Disable alt+sysrq and crtl+alt+backspace + disable_kill(); // Take a webcam shot of whoever is tampering with our machine: webcam_shot(0);