~kees/eucalyptus/lp436977

« back to all changes in this revision

Viewing changes to tools/kill-vblade

  • Committer: Kees Cook
  • Date: 2009-10-06 20:52:06 UTC
  • Revision ID: kees@outflux.net-20091006205206-ps7pvee616tqdj2x
* Attempt to limit the scope of euca_rootwrap, with wrapper configuration
  and helper scripts (LP: #436977):
  - tools/dd-lv, tools/kill-vblade, tools/modprobe-aoe
  - util/euca_rootwrap.c, util/wrappers.conf

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
import sys, os
 
3
 
 
4
if len(sys.argv)<3:
 
5
    print >>sys.stderr, "Invalid arguments"
 
6
    sys.exit(1)
 
7
 
 
8
pid = int(sys.argv[2])
 
9
if sys.argv[1] != '-9':
 
10
    print >>sys.stderr, "Unexpected signal"
 
11
    sys.exit(1)
 
12
 
 
13
if os.readlink('/proc/%d/exe' % (pid)) != '/sbin/vblade':
 
14
    print >>sys.stderr, "Target is not vblade"
 
15
    sys.exit(1)
 
16
 
 
17
os.kill(pid, 9)