Commit cc24d2bc authored by Tails developers's avatar Tails developers

obtain whisperback debugging info through an helper script as root

parent ceb184b8
amnesia ALL = NOPASSWD: /usr/local/sbin/tails-debugging-info
......@@ -102,42 +102,24 @@ def mail_prepended_info():
# (this information will be encrypted). This is useful to add
# configuration files usebul for debugging.
#
# It shound not take any parameter, and should return a string to be
# It should not take any parameter, and should return a string to be
# appended to the email
def mail_appended_info():
"""Returns debugging informations on the running amnesia system
@return XXX: document me
@return a long string containing debugging informations
"""
debug_files = ["/etc/X11/xorg.conf", "/var/log/Xorg.0.log",
"/var/log/live-persist", "/var/lib/gdm3/tails.persistence"]
debug_commands = ["/bin/dmesg", "/bin/lsmod", "/usr/bin/lspci"]
debugging_info = ""
for debug_command in debug_commands:
debugging_info += "\n===== output of command %s =====\n" % debug_command
try:
process = subprocess.Popen (debug_command,
stdout=subprocess.PIPE)
for line in process.stdout:
debugging_info += line
process.wait()
except OSError:
debugging_info += "%s command not found\n" % debug_command
except subprocess.CalledProcessError:
debugging_info += "%s returned an error\n" % debug_command
for debug_file in debug_files:
debugging_info += "===== content of %s =====\n" % debug_file
f = None
try:
f = open(debug_file)
debugging_info += f.read()
except IOError:
debugging_info += "%s not found\n" % debug_file
finally:
if f is not None: f.close()
try:
process = subprocess.Popen (["sudo", "/usr/local/sbin/tails-debugging-info"],
stdout=subprocess.PIPE)
for line in process.stdout:
debugging_info += line
process.wait()
except OSError:
debugging_info += "sudo command not found\n" % debug_command
except subprocess.CalledProcessError:
debugging_info += "debugging command returned an error\n" % debug_command
return debugging_info
#!/bin/sh
debug_command() {
echo
echo "===== output of command $@ ====="
"$@"
}
debug_file() {
echo
echo "===== content of $1 ====="
cat $1
}
debug_command "/bin/dmesg"
debug_command "/bin/lsmod"
debug_command "/usr/bin/lspci"
debug_file "/etc/X11/xorg.conf"
debug_file "/var/log/Xorg.0.log"
debug_file "/var/log/live-persist"
debug_file "/var/lib/gdm3/tails.persistence"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment