Wait for at least one sdmem job to complete.
[tails-test.git] / config / chroot_local-includes / etc / whisperback / config.py
blobc61711c8306a3ad816113677c352cf8eb5b11198
1 # -*- coding: UTF-8 -*-
3 # Tails configuration file for Whisperback
4 # ==========================================
6 # This is a python script that will be read at startup. Any python
7 # syntax is valid.
9 ########################################################################
10 # WhisperBack - Send a feedback in an encrypted mail
11 # Copyright (C) 2009-2010 Amnesia <amnesia@boum.org>
13 # This file is part of WhisperBack
15 # WhisperBack is free software; you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation; either version 3 of the License, or (at
18 # your option) any later version.
20 # This program is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 # General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program. If not, see <http://www.gnu.org/licenses/>.
27 ########################################################################
29 # IMPORTS
31 # Do not change this - required to parse path
32 import os.path
34 # Custom imports
35 import subprocess
36 import random
38 # RECIPIENT
40 # This section defines the recepient parameters
42 # The address of the recipient
43 to_address = "tails@boum.org"
45 # The fingerprint of the recipient's GPG key
46 to_fingerprint = "09F6BC8FEEC9D8EE005DBAA41D2975EDF93E735F"
48 # SENDER
50 # This section defines the sender parameters
52 # The address of the sender
53 from_address = "devnull@tails.boum.org"
55 # SMTP
57 # This section defines the SMTP server parameters
59 # The SMTP server to use to send the mail
60 smtp_host = "4mvq3pnvid3awjln.onion"
61 # The port to connect to on that SMTP server
62 smtp_port = 25
63 # The path to a file containing the certificate to trust
64 # This can be either a CA certificate used to sign the SMTP server
65 # certificate or the certificate of the SMTP server itself
66 smtp_tlscafile = os.path.join("/", "etc", "whisperback", "4mvq3pnvid3awjln.onion.pem")
68 # MESSAGE
70 # This section defines the message parameters
72 # The subject of the email to be sent
73 # Please take into account that this will not be encrypted
74 mail_subject = "Bug report: %x" % random.randrange(16**32)
76 # A callback function to get information to prepend to the mail
77 # (this information will be encrypted). This is useful to add
78 # software version.
80 # It shound not take any parameter, and should return a string to be
81 # preprended to the email
82 def mail_prepended_info():
83 """Returns the version of the running amnesia system
85 @return The output of tails-version, if any, or an english string
86 explaining the error
87 """
89 try:
90 amnesia_version_process = subprocess.Popen ("tails-version",
91 stdout=subprocess.PIPE)
92 amnesia_version_process.wait()
93 amnesia_version = amnesia_version_process.stdout.read()
94 except OSError:
95 amnesia_version = "tails-version command not found"
96 except subprocess.CalledProcessError:
97 amnesia_version = "tails-version returned an error"
99 return "Tails-Version: %s\n" % amnesia_version
101 # A callback function to get information to append to the email
102 # (this information will be encrypted). This is useful to add
103 # configuration files usebul for debugging.
105 # It shound not take any parameter, and should return a string to be
106 # appended to the email
107 def mail_appended_info():
108 """Returns debugging informations on the running amnesia system
110 @return XXX: document me
113 debug_files = ["/etc/X11/xorg.conf", "/var/log/Xorg.0.log"]
114 debug_commands = ["/bin/dmesg", "/bin/lsmod", "/usr/bin/lspci"]
116 debugging_info = ""
118 for debug_command in debug_commands:
119 debugging_info += "\n===== output of command %s =====\n" % debug_command
120 try:
121 process = subprocess.Popen (debug_command,
122 stdout=subprocess.PIPE)
123 for line in process.stdout:
124 debugging_info += line
125 process.wait()
126 except OSError:
127 debugging_info += "%s command not found\n" % debug_command
128 except subprocess.CalledProcessError:
129 debugging_info += "%s returned an error\n" % debug_command
131 for debug_file in debug_files:
132 debugging_info += "===== content of %s =====\n" % debug_file
133 f = None
134 try:
135 f = open(debug_file)
136 debugging_info += f.read()
137 except IOError:
138 debugging_info += "%s not found\n" % debug_file
139 finally:
140 if f is not None: f.close()
142 return debugging_info