In order to monitor some of the machines I
maintain, I rely
on a simple email setup using
logcheck. Unfortunately that
system completely breaks down if mail delivery stops.
This is the simple setup I've come up with to ensure that mail doesn't
pile up on the remote machine.
postconf -e maximal_queue_lifetime=10d
Then I created a new user:
adduser mailq-check
with a password straight out of pwgen -s 32.
I gave ssh
permission to
that user:
adduser mailq-check sshuser
and then authorized my new ssh key (see next section):
sudo -u mailq-check -i
mkdir ~/.ssh/
cat - > ~/.ssh/authorized_keys
ssh-keygen -t ed25519 -f .ssh/egilsstadir-mailq-check
cat ~/.ssh/egilsstadir-mailq-check.pub
which I then installed on the server.
Then I added this cronjob in /etc/cron.d/egilsstadir-mailq-check:
0 2 * * * francois /usr/bin/ssh -i /home/francois/.ssh/egilsstadir-mailq-check mailq-check@egilsstadir mailq grep -v "Mail queue is empty"
and that's it. I get a (locally delivered) email whenever the mail queue on
the server is non-empty.
There is a race condition built into this setup since it's possible that the
server will want to send an email at 2am. However, all that does is send a
spurious warning email in that case and so it's a pretty small price to pay
for a dirt simple setup that's unlikely to break.
I put some packages together this weekend. It s been a while since I ve debuilt anything officially.
"debuild -b -uc -us". For optional arguments, it has
--variations, which accepts a list of possible build variations to
test, one or more of 'captures_environment', 'domain_host',
'filesystem', 'home', 'kernel', 'locales',
'path', 'shell', 'time', 'timezone', 'umask', and 'user_group'
(see
variations
for more information); --dont_vary, which makes reprotest not test
any variations in the given list (the default is to run all variations);
--source_root, which accepts a directory to run the build command in
and defaults to the current working directory; and --verbose, which
will eventually enable more detailed logging. To get help for the
CLI, run reprotest -h or reprotest --help.
The config file has one section, basics, and the same options as the
CLI, except there's no dont_vary option, and there are build_command
and artifact options. If build_command and/or artifact are set
in the config file, reprotest can be run without passing those as
command-line arguments. Command-line arguments always override config
file options. Reprotest currently searches the working directory for
the config file, but it will also eventually search the user's home
directory. A sample config file is below.
[basics]
build_command = setup.py sdist
artifact = dist/reprotest-0.1.tar.gz
source_root = reprotest/
variations =
captures_environment
domain_host
filesystem
home
host
kernel
locales
path
shell
time
timezone
umask
user_group
At the moment, the only build variations that reprotest actually tests
are the environment variable variations: captures_environment, home,
locales, and timezone. Over the next week, I plan to add the rest of
the basic variations and accompanying tests. I also need to write
tests for the CLI and the configuration file. After that, I intend to
work on getting (s)chroot communication working, which will involve
integrating autopkgtest code.
Some of the variations require specific other packages to be
installed: for instance, the locales variation currently requires the
fr_CH.UTF-8 locale. Locales are a particular problem because I don't
know of a way in Debian to specify that a given locale must be
installed. For other packages, it's unclear to me whether I should
specify them as depends or recommends: they aren't dependencies in a
strict sense, but marking them as dependencies will make it easier to
install a fully-functional reprotest. When reprotest runs with
variations enabled that it can't test because it doesn't have the
correct packages installed, I intend to have it print a warning but
continue to run.
tests.reproducible-builds.org
also has different settings, such as different locales, for different
architectures. I'm not clear on why this is. I'd prefer to avoid
having to generate a giant list of variations based on architecture,
but if necessary, I can do that. The
prebuilder
script contains variations specific to Linux, to Debian, and to
pbuilder/cowbuilder. I'm not including Debian-specific variations
until I get much more of the basic functionality implemented, and I'm
not sure I'm going to include pbuilder-specific variations ever,
because it's probably better for extensibility to other OSes,
e.g. BSD, to add support for plugins or more complicated
configurations.
I implemented the variations by creating a function for each
variation. Each function takes as input two build commands, two
source trees, and two sets of environment variables and returns the
same. At the moment, I'm using dictionaries for the environment
variables, mutating them in-place and passing the references forward.
I'm probably going to replace those at some point with an immutable
mapping. While at the moment, reprotest only builds on the existing
system, when I start extending it to other build environments, this
will require double-dispatch, because the code that needs to be
executed will depend on both the variation to be tested and the
environment being built on. At the moment, I'm probably going to
implement this with a dictionary with tuple keys of
(build_environment, variation) or nested dictionaries. If it's
necessary for code to depend on OS or architecture, too, this could
end up becoming a triple or quadruple dispatch.
After long months of testing and waiting for the DVD production, we have released TeX Live 2016 today!
Detailed changes can be found here, the most important ones are:
Have a great day.
The other interesting part of the hotel was the wide range of
activities. Again, this being a family hotel, I thought the organised
activities would be pretty mild; but at least for our group, they
weren't. The
mountain bike ride
included an easy single-trail section, but while easy it was
single-trail and rocky, so complete beginners might have had a small
surprise. Overall it was about 50 minutes, 13.5km, with 230m altitude
gain, which again for sedentary people might be unusual. I probably
spent during the ride one of the deserts I ate later that day
The
"hike" they organised for another sub-group was also interesting,
involving going through old tunnels and something with broken water
pipes that caused people to either get their feet wet or
monkey-spidering along the walls. Fun!
After the bike ride, on the same afternoon, while walking around the
hotel, we found the Ecole de Trap ze volant open, which looked way
to exciting not to try it. Try and fail to do things right, but
nevertheless it was excellent and unexpected fun. I'll have to do that
again some day when I'll be more fit!
Plus that the hotel itself had a very nice location and olive garden,
so short runs in the morning were very pleasant. Only one cookie
though each
Back home
and then it was over; short, but quite good. The Provence area is
nice, and I'd like to be back again someday, for a proper
vacation longer and more relaxed. And do the trap ze thing again,
properly this time.
Quite a lot has happened in xdg-app since
last time I blogged about it. Most noticeably, it isn't called
xdg-app any more, having been renamed to Flatpak.
It is now available in Debian experimental under that name, and the
xdg-app package that was briefly there has been removed. I'm currently
in the process of updating Flatpak to the latest version 0.6.4.
The privileged part has also spun off into a separate project,
Bubblewrap, which recently
had its first release (0.1.0). This is intended as a common component
with which unprivileged users can start a container in a way that
won't let them escalate privileges, like a more flexible version of
linux-user-chroot.
Bubblewrap has also been made available in Debian, maintained by Laszlo
Boszormenyi (also maintainer of linux-user-chroot). Yesterday I sent a patch
to update Laszlo's packaging for 0.1.0.
I'm hoping to become a co-maintainer to upload that myself, since I suspect
Flatpak and Bubblewrap might need to track each other quite closely.
For the moment, Flatpak still uses its own internal copy of Bubblewrap,
but I consider that to be a bug and
I'd like to be able to fix it soon.
At some point I also want to experiment with using Bubblewrap to
sandbox some of the game engines that are packaged in Debian: networked
games are a large attack surface, and typically consist of the sort
of speed-optimized C or C++ code that is an ideal home for security
vulnerabilities. I've already made some progress on jailing game engines
with AppArmor, but making sensitive files completely invisible to the
game engine seems even better than preventing them from being opened.
Next weekend I'm going to be heading to Toronto for the
GTK Hackfest, primarily to to
talk to GNOME and Flatpak developers about their plans for sandboxing,
portals and Flatpak. Hopefully we can make some good progress there: the more I
know about the state of software security, the less happy I am with random
applications all being equally privileged. Newer display technologies like
Wayland and Mir represent an opportunity to plug one of the largest
holes in typical application containerization,
which is a major step in bringing sandboxes like Flatpak and Snap from
proof-of-concept to a practical improvement in security.
Other next steps for Flatpak in Debian:
experimental into unstable and testing. I've taken the
first step towards that by uploading libgsystem to unstable.
Before Flatpak can follow, OSTree also needs to move.help. I'd
appreciate contributions to the OSTree packaging from people
who are interested in using it to deploy dpkg-based operating systems -
I'm primarily looking at it from the Flatpak perspective, so the boot/OS
side of it isn't so well tested. Red Hat have rpm-ostree,
and I believe Endless do something analogous
to build OS images with dpkg, but I haven't had a chance to look into
that in detail yet.<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="audio/x-rosegarden">
<sub-class-of type="application/x-gzip"/>
<comment>Rosegarden project file</comment>
<glob pattern="*.rg"/>
</mime-type>
</mime-info>
This states that audio/x-rosegarden is a kind of application/x-gzip
(it is a gzipped XML file). Note, it is much better to use an
official MIME type registered with IANA than it is to make up ones own
unofficial ones like the x-rosegarden type used by rosegarden.
The desktop file of the rosegarden program failed to list
audio/x-rosegarden in its list of supported MIME types, causing the
file browsers to have no idea what to do with *.rg files:
The fix was to add "audio/x-rosegarden;" at the end of the MimeType= line. If you run into a file which fail to open the correct program when selected from the file browser, please check out the output from file --mime-type for the file, ensure the file ending and MIME type is registered somewhere under /usr/share/mime/ and check that some desktop file under /usr/share/applications/ is claiming support for this MIME type. If not, please report a bug to have it fixed. :)% grep Mime /usr/share/applications/rosegarden.desktop MimeType=audio/x-rosegarden-composition;audio/x-rosegarden-device;audio/x-rosegarden-project;audio/x-rosegarden-template;audio/midi; X-KDE-NativeMimeType=audio/x-rosegarden-composition %
Steps to install reSIProcate
First you have to configure the telepathy-qt library properly to be able to install reSIProcate. It s important to notice that you shouldn t install telepathy-qt from apt-get because in this way it wont have the telepathy-qt4-service shared library.
$ mkdir ~/telepathy-qt-stuff $ cd ~/telepathy-qt-stuff $ git clone https://github.com/dpocock/telepathy-qt-debian $ cd telepathy-qt-debian $ git checkout jessie-build-all-shared $ cd ..
Then you should download the tar http://http.debian.net/debian/pool/main/t/telepathy-qt/telepathy-qt_0.9.6.1.orig.tar.gz in the telepathy-qt-stuff folder and continue:
$ tar xzf telepathy-qt_0.9.6.1.orig.tar.gz $ cd telepathy-qt_0.9.6.1 $ [ -d debian ] && echo "warning: debian/ already exists!" $ cp -r ../telepathy-qt-debian/debian . $ dpkg-buildpackage -rfakeroot -i.* -j13 -us -uc $ cd .. $ ls *.deb
Now you should see a list of libtelepathy-qt* and telepathy-qt* .deb packages. You just have to install a few more packages:
$ dpkg -i libtelepathy-qt4-2_0.9.6.1-2_amd64.deb libtelepathy-qt4-dev_0.9.6.1-2_amd64.deb libtelepathy-qt4-farstream2_0.9.6.1-2_amd64.deb
After that you have the necessary packages to install reSIProcate.
$ dpkg -l grep telepathy-qt
Should return you something like this:
|
ii |
libtelepathy-qt4-2:amd64 |
0.9.6.1-2 |
amd64 |
Telepathy framework Qt 4 library |
|
ii |
libtelepathy-qt4-dev |
0.9.6.1-2 |
amd64 |
Qt 4 Telepathy library (headers and static library) |
|
ii |
libtelepathy-qt4-farstream2:amd64 |
0.9.6.1-2 |
amd64 |
Telepathy/Farsight integration Qt 4 library |
After installing telepathy-qt properly you would be able to configure reSIProcate.
Make sure you have added backports to your /etc/apt/sources.list file
$ git clone https://github.com/resiprocate/resiprocate $ cd resiprocate $ apt-get install libpq-dev dh-autoreconf $ apt-get build-dep resiprocate $ apt-get install -t jessie-backports libradcli-dev $ ./build/debian.sh $ make
per_account:set sendmail = "$HOME/bin/check-mail-gpg /usr/bin/msmtp -a $my_email"
And here goes the python script check-mail-gpg:
#! /usr/bin/python3
import os
import sys
import subprocess
import email.parser
from email.header import decode_header
from email.utils import parseaddr
STATUS_FILE = '/tmp/check-mail-gpg.tmp'
def dec(header):
head = decode_header(header)
if len(head) == 1 and head[0][1] == None:
return head[0][0]
else:
return ''.join([h.decode(enc) if enc else h.decode('ascii') \
for (h,enc) in head])
def send_mail(mail):
print('Calling external email client to send the email...')
#return -1 # testing mode
p = subprocess.Popen(sys.argv[1:], stdin=subprocess.PIPE)
p.stdin.write(mail.encode('utf-8'))
p.stdin.close()
return p.wait()
def main():
mail = sys.stdin.read()
heads = email.parser.Parser().parsestr(mail, headersonly=True)
content = heads['Content-Type'].split(';')[0].strip()
print('Content is:', content)
if content == 'multipart/encrypted':
print('Ok: encrypted mail, we can return now...')
sys.exit(send_mail(mail))
addrs = [parseaddr(addr) for addr in heads['To'].split(',')]
print('Found emails:', addrs)
gpg_cnt = 0
for name, addr in addrs:
print('Looking for', addr, 'in the keyring...')
res = subprocess.call(['gpg', '--list-keys', addr],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if res == 0:
gpg_cnt += 1
if gpg_cnt == 0:
print('Ok: no email found in the gpg keyring, we can return now...')
sys.exit(send_mail(mail))
if not os.path.exists(STATUS_FILE):
open(STATUS_FILE, 'w').close()
msg_id = heads['Message-ID']
msg_id_prev = ''
with open(STATUS_FILE, 'r') as f:
msg_id_prev = f.read()
if msg_id.strip() == msg_id_prev.strip():
sys.exit(send_mail(mail))
else:
with open(STATUS_FILE, 'w') as f:
f.write(msg_id)
print('Alert: trying to send an unencrypted email to', addrs,
', for which some gpg keys were found in the keyring!')
print('Try again if you are sure to send this message unencrypted.')
sys.exit(1)
if __name__ == '__main__':
main()
crypt_opportunistic_encrypt in mutt, which
provides a feature very similar to what I was looking for. This option will
automatically enable encryption when the recipient has a GPG key in your
keyring.
From mutt s man page:
3.41. crypt_opportunistic_encrypt Type: boolean Default: no Setting this variable will cause Mutt to automatically enable and disable encryption, based on whether all message recipient keys can be located by mutt. When this option is enabled, mutt will determine the encryption setting each time the TO, CC, and BCC lists are edited. If $edit_headers is set, mutt will also do so each time the message is edited. While this is set, encryption settings can t be manually changed. The pgp or smime menus provide an option to disable the option for a particular message. If $crypt_autoencrypt or $crypt_replyencrypt enable encryption for a message, this option will be disabled for the message. It can be manually re-enabled in the pgp or smime menus. (Crypto only)
Debian is quite probably the project that most uses a OpenPGP implementation (that is, GnuPG, or gpg) for many of its internal operations, and that places most trust in it. PGP is also very widely used, of course, in many other projects and between individuals. It is regarded as a secure way to do all sorts of crypto (mainly, encrypting/decrypting private stuff, signing public stuff, certifying other people's identities). PGP's lineage traces back to Phil Zimmerman's program, first published in 1991 By far, not a newcomer
PGP is secure, as it was 25 years ago. However, some uses of it might not be so. We went through several migrations related to algorithmic weaknesses (i.e. v3 keys using MD5; SHA1 is strongly discouraged, although not yet completely broken, and it should be avoided as well) or to computational complexity (as the migration away from keys smaller than 2048 bits, strongly prefering 4096 bits). But some vulnerabilities are human usage (that is, configuration-) related.
Today, Enrico Zini gave us a heads-up in the #debian-keyring IRC channel, and started a thread in the debian-private mailing list; I understand the mail to a private list was partly meant to get our collective attention, and to allow for potentially security-relevant information to be shared. I won't go into details about what is, is not, should be or should not be private, but I'll post here only what's public information already.
What are short and long key IDs?
I'll start by quoting Enrico's mail:
there are currently at least 3 ways to refer to a gpg key: short key ID (last 8 hex digits of fingerprint), long key ID (last 16 hex digits) and full fingerprint. The short key ID used to be popular, and since 5 years it is known that it is computationally easy to generate a gnupg key with an arbitrary short key id. A mitigation to this is using "keyid-format long" in gpg.conf, and a better thing to do, especially in scripts, is to use the full fingerprint to refer to a key, or just ship the public key for verification and skip the key servers. Note that in case of keyid collision, gpg will download and import all the matching keys, and will use all the matching keys for verifying signatures.So... What is this about? We humans are quite bad at recognizing and remembering randomly-generated strings with no inherent patterns in them. Every GPG key can be uniquely identified by its fingerprint, a 128-bit string, usually encoded as ten blocks of four hexadecimal characters (this allows for 160 bits; I guess there's space for a checksum in it). That is, my (full) key's signature is:
AB41 C1C6 8AFD 668C A045 EBF8 673A 03E4 C1DB 921FHowever, it's quite hard to recognize such a long string, let alone memorize it! So, we often do what humans do: Given that strong cryptography implies a homogenous probability distribution, people compromised on using just a portion of the key the last portion. The short key ID. Mine is then the last two blocks (shown in boldface): C1DB921F. We can also use what's known as the long key ID, that's twice as long: 64 bits. However, while I can speak my short key ID on a single breath (and maybe even expect you to remember and note it down), try doing so with the long one (shown in italics above): 673A03E4C1DB921F. Nah. Too much for our little, analog brains. This short and almost-rememberable number has then 32 bits of entropy I have less than one in 4,000,000,000 chance of generating a new key with this same short key ID. Besides, key generation is a CPU-intensive operation, so it's quite unlikely we will have a collision, right? Well, wrong. Previous successful attacks on short key IDs Already five years ago, Asheesh Laroia migrated his 1024D key to a 4096R. And, as he describes in his always-entertaining fashion, he made his computer sweat until he was able to create a new key for which the short key ID collided with the old one. It might not seem like a big deal, as he did this non-maliciously, but this easily should have spelt game over for the usage of short key IDs. After all, being able to generate a collision is usually the end for cryptographic systems. Asheesh specifically mentioned in his posting how this could be abused. But we didn't listen. Short key IDs are just too convenient! Besides, they allow us to have fun, can be a means of expression! I know of at least two keys that would qualify as vanity: Obey Arthur Liu's 0x29C0FFEE (created in 2009) and Keith Packard's 0x00000011 (created in 2012). Then we got the Evil 32 project. They developed Scallion, started (AFAICT) in 2012. Scallion automates the search for a 32-bit collision using GPUs; they claim that it takes only four seconds to find a collision. So, they went through the strong set of the public PGP Web of Trust, and created a (32-bit-)colliding key for each of the existing keys. And what happened now? What happened today? We still don't really know, but it seems we found a first potentially malicious collision that is, the first "nonacademic" case. Enrico found two keys sharing the 9F6C6333 short ID, apparently belonging to the same person (as would be the case of Asheesh, mentioned above). After contacting Gustavo, though, he does not know about the second That is, it can be clearly regarded as an impersonation attempt. Besides, what gave away this attempt are the signatures it has: Both keys are signed by what appears to be the same three keys: B29B232A, F2C850CA and 789038F2. Those three keys are not (yet?) uploaded to the keyservers, though... But we can expect them to appear at any point in the future. We don't know who is behind this, or what his purpose is. We just know this looks very evil. Now, don't panic: Gustavo's key is safe. Same for his certifiers, Marga, Agust n and Maxy. It's just a 32-bit collision. So, in principle, the only parties that could be cheated to trust the attacker are humans, right? Nope. Enrico tested on the PGP pathfinder & key statistics service, a keyserver that finds trust paths between any two arbitrary keys in the strong set. Surprise: The pathfinder works on the short key IDs, even when supplied full fingerprints. So, it turns out I have three faked trust paths into our impostor. What next? There are several things this should urge us to do.
The electrum bitcoin wallet seems to use SSL insecurely.
Here are two bug reports I filed about it:
ignores invalid
ssl certs with CERT_NONE, allowing MITM
fails to verify
ssl cert hostname for cached certsNext.