Trolled by the NSA

Since I helped to troll the NSA by sharing a nifty auto-trolling script, they got back to me.

Hard.

It all started with the Fedora 19 that I’ve installed on my laptop. I’m slowly building an automatic configuration script with Ansible that includes the installation of Mirall, the ownCloud client file synchronization tool for Linux; I use it to synchronize small files to my home’s ownCloud, hosted by my Raspberry Pi.

Mirall can ignore some files in the synchronization process. It is a badly documented feature, inaccessible via the GUI, but it’s there: you just have to write the list of the file patterns that you want to ignore into one of these two files:

  • /etc/ownCloud/sync-exclude.lst
  • ~/.local/share/data/ownCloud/sync-exclude.lst

For example, my list is:

*.filepart
*~
*.bak
*.part
*.unison*
*csync_timedif.ctmp*
.*.sw?
.*.*sw?
.DS_Store
.ds_store
desktop.ini
Thumbs.db
*.lock

Anyway, even with this file in place, my KeePassX lock file (matched by the *.lock pattern) was still being synchronized!

After a few tries I decided to debug what Mirall was doing with strace.

$ strace /usr/bin/owncloud 2> ~/owncloud.strace
$ grep exclude ~/owncloud.strace

Thanks to strace and grep I was able to pinpoint the open syscall that was trying to read /etc/ownCloud/sync-exclude.lst. Here’s the relevant row of the strace output:

open("/etc/ownCloud/sync-exclude.lst", O_RDONLY|O_CLOEXEC) = 15

15? As far as I know, the syscalls usually return 0 when they’re successful: 15 means that something’s wrong. Let’s see, if I recall correctly, that should be an error constant that’s in /usr/include/errno.h. Wait, this is kernel’s stuff, so it’s /usr/include/asm/errno.h. Umh no, this points to /usr/include/asm-generic/errno.h. And this one contains the error codes starting from 35 upwards, I must look at /usr/include/asm-generic/errno-base.h. PHEW, here it is!

#define    ENOTBLK        15    /* Block device required */

Block device required..?

ARGHHHHHHHHHHHH!

troll-the-nsaI just got trolled by SELinux, and, ultimately, by the NSA itself. -.-

Epilogue

https://bugzilla.redhat.com/show_bug.cgi?id=994671

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.