disable_kill
This commit is contained in:
parent
8bdd144daa
commit
5a7ab3ff79
4
README
4
README
@ -31,8 +31,8 @@ Changes by chjj
|
|||||||
wrong password or pressed ALT/CTRL/F1-13/SYSRQ. See twilio_example.h to create a
|
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.
|
twilio.h file. You will need a twilio account to set this up.
|
||||||
|
|
||||||
- Disabling alt+sysrq before shutting down: This prevents an attacker from
|
- Disabling alt+sysrq and ctrl+alt+backspace before shutting down: This
|
||||||
alt+sysrq+k'ing the screenlock quickly before the shutdown.
|
prevents an attacker from killing the screenlock quickly before the shutdown.
|
||||||
|
|
||||||
- This requires a sudoers option to be set in /etc/sudoers:
|
- This requires a sudoers option to be set in /etc/sudoers:
|
||||||
|
|
||||||
|
16
slock.c
16
slock.c
@ -148,9 +148,10 @@ error:
|
|||||||
return NULL;
|
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
|
static void
|
||||||
disable_sysrq(void) {
|
disable_kill(void) {
|
||||||
#if POWEROFF
|
#if POWEROFF
|
||||||
// Needs sudo privileges - alter your /etc/sudoers file:
|
// Needs sudo privileges - alter your /etc/sudoers file:
|
||||||
// [username] [hostname] =NOPASSWD: /usr/bin/tee /proc/sys/kernel/sysrq
|
// [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.
|
// Poweroff if there are more than 5 bad attempts.
|
||||||
if(lock_tries > 5) {
|
if(lock_tries > 5) {
|
||||||
// Disable alt+sysrq
|
// Disable alt+sysrq and crtl+alt+backspace
|
||||||
disable_sysrq();
|
disable_kill();
|
||||||
|
|
||||||
// Take a webcam shot of whoever is tampering with our machine:
|
// Take a webcam shot of whoever is tampering with our machine:
|
||||||
webcam_shot(0);
|
webcam_shot(0);
|
||||||
@ -482,7 +483,7 @@ readpw(Display *dpy, const char *pws)
|
|||||||
case XK_Escape:
|
case XK_Escape:
|
||||||
len = 0;
|
len = 0;
|
||||||
break;
|
break;
|
||||||
case XK_BackSpace:
|
case XK_Delete:
|
||||||
if(len)
|
if(len)
|
||||||
--len;
|
--len;
|
||||||
break;
|
break;
|
||||||
@ -503,8 +504,9 @@ readpw(Display *dpy, const char *pws)
|
|||||||
case XK_F11:
|
case XK_F11:
|
||||||
case XK_F12:
|
case XK_F12:
|
||||||
case XK_F13:
|
case XK_F13:
|
||||||
// Disable alt+sysrq
|
case XK_BackSpace:
|
||||||
disable_sysrq();
|
// Disable alt+sysrq and crtl+alt+backspace
|
||||||
|
disable_kill();
|
||||||
|
|
||||||
// Take a webcam shot of whoever is tampering with our machine:
|
// Take a webcam shot of whoever is tampering with our machine:
|
||||||
webcam_shot(0);
|
webcam_shot(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user