Blame view

Documentation/SAK.txt 3 KB
2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
1
2
3
4
5
6
  =========================================
  Linux Secure Attention Key (SAK) handling
  =========================================
  
  :Date: 18 March 2001
  :Author: Andrew Morton
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
8
9
10
11
12
13
14
15
16
17
18
19
  
  An operating system's Secure Attention Key is a security tool which is
  provided as protection against trojan password capturing programs.  It
  is an undefeatable way of killing all programs which could be
  masquerading as login applications.  Users need to be taught to enter
  this key sequence before they log in to the system.
  
  From the PC keyboard, Linux has two similar but different ways of
  providing SAK.  One is the ALT-SYSRQ-K sequence.  You shouldn't use
  this sequence.  It is only available if the kernel was compiled with
  sysrq support.
  
  The proper way of generating a SAK is to define the key sequence using
2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
20
  ``loadkeys``.  This will work whether or not sysrq support is compiled
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
22
23
24
25
26
27
28
29
30
  into the kernel.
  
  SAK works correctly when the keyboard is in raw mode.  This means that
  once defined, SAK will kill a running X server.  If the system is in
  run level 5, the X server will restart.  This is what you want to
  happen.
  
  What key sequence should you use? Well, CTRL-ALT-DEL is used to reboot
  the machine.  CTRL-ALT-BACKSPACE is magical to the X server.  We'll
  choose CTRL-ALT-PAUSE.
2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
31
  In your rc.sysinit (or rc.local) file, add the command::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
32
33
34
35
  
  	echo "control alt keycode 101 = SAK" | /bin/loadkeys
  
  And that's it!  Only the superuser may reprogram the SAK key.
2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
36
  .. note::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
37

2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
38
39
40
    1. Linux SAK is said to be not a "true SAK" as is required by
       systems which implement C2 level security.  This author does not
       know why.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
41

2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
42
43
    2. On the PC keyboard, SAK kills all applications which have
       /dev/console opened.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
44

2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
45
46
47
48
       Unfortunately this includes a number of things which you don't
       actually want killed.  This is because these applications are
       incorrectly holding /dev/console open.  Be sure to complain to your
       Linux distributor about this!
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
49

2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
50
51
       You can identify processes which will be killed by SAK with the
       command::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
52
53
54
  
  	# ls -l /proc/[0-9]*/fd/* | grep console
  	l-wx------    1 root     root           64 Mar 18 00:46 /proc/579/fd/0 -> /dev/console
2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
55
       Then::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
56
57
58
  
  	# ps aux|grep 579
  	root       579  0.0  0.1  1088  436 ?        S    00:43   0:00 gpm -t ps/2
2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
59
60
61
       So ``gpm`` will be killed by SAK.  This is a bug in gpm.  It should
       be closing standard input.  You can work around this by finding the
       initscript which launches gpm and changing it thusly:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
62

2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
63
       Old::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
64
65
  
  	daemon gpm
2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
66
       New::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
67
68
  
  	daemon gpm < /dev/null
2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
69
       Vixie cron also seems to have this problem, and needs the same treatment.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
70

2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
71
72
       Also, one prominent Linux distribution has the following three
       lines in its rc.sysinit and rc scripts::
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
73
74
75
76
  
  	exec 3<&0
  	exec 4>&1
  	exec 5>&2
2273194d1   Mauro Carvalho Chehab   SAK.txt: standard...
77
78
79
80
81
       These commands cause **all** daemons which are launched by the
       initscripts to have file descriptors 3, 4 and 5 attached to
       /dev/console.  So SAK kills them all.  A workaround is to simply
       delete these lines, but this may cause system management
       applications to malfunction - test everything well.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
82