summaryrefslogtreecommitdiff
path: root/src/common
AgeCommit message (Collapse)Author
2014-04-24Merge branch 'bug11396_v2_squashed'Nick Mathewson
Conflicts: src/or/main.c
2014-04-24get_total_system_memory(): see how much RAM we haveNick Mathewson
2014-04-18Improved message when running sandbox on Linux without libseccompNick Mathewson
Previously we said "Sandbox is not implemented on this platform" on Linux boxes without libseccomp. Now we say that you need to build Tor built with libseccomp. Fixes bug 11543; bugfix on 0.2.5.1-alpha.
2014-04-17Merge remote-tracking branch 'public/ticket11528_024'Nick Mathewson
2014-04-17Remove spurious libevent include in sandbox.cNick Mathewson
2014-04-17Elevate server TLS cipher preferences over clientNick Mathewson
The server cipher list is (thanks to #11513) chosen systematically to put the best choices for Tor first. The client cipher list is chosen to resemble a browser. So let's set SSL_OP_CIPHER_SERVER_PREFERENCE to have the servers pick according to their own preference order.
2014-04-16Log the name of the failing syscall on failureNick Mathewson
2014-04-16Sandbox: permit O_NONBLOCK and O_NOCTTY for files we refuseNick Mathewson
OpenSSL needs this, or RAND_poll() will kill the process. Also, refuse with EACCESS, not errno==-1 (!).
2014-04-16Don't allow change to ConnLimit while sandbox is activeNick Mathewson
2014-04-16Use SCMP_CMP_MASKED_EQ to allow flags, not force themNick Mathewson
Older versions of Libevent are happy to open SOCK_DGRAM sockets non-cloexec and non-nonblocking, and then set those flags afterwards. It's nice to be able to allow a flag to be on or off in the sandbox without having to enumerate all its values. Also, permit PF_INET6 sockets. (D'oh!)
2014-04-16Get Libevent's PRNG functioning under the linux sandboxNick Mathewson
Libevent uses an arc4random implementation (I know, I know) to generate DNS transaction IDs and capitalization. But it liked to initialize it either with opening /dev/urandom (which won't work under the sandbox if it doesn't use the right pointer), or with sysctl({CTL_KERN,KERN_RANDOM,RANDOM_UUIC}). To make _that_ work, we were permitting sysctl unconditionally. That's not such a great idea. Instead, we try to initialize the libevent PRNG _before_ installing the sandbox, and make sysctl always fail with EPERM under the sandbox.
2014-04-16Make sure everything using an interned string is preceded by a logNick Mathewson
(It's nice to know what we were about to rename before we died from renaming it.)
2014-04-16Introduce arg-counting macros to wrap seccomp_rule_add()Nick Mathewson
The compiler doesn't warn about this code: rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(openat), 1, SCMP_CMP(0, SCMP_CMP_EQ, AT_FDCWD), SCMP_CMP(1, SCMP_CMP_EQ, param->value), SCMP_CMP(2, SCMP_CMP_EQ, O_RDONLY|...)); but note that the arg_cnt argument above is only 1. This means that only the first filter (argument 0 == AT_FDCWD) is actually checked! This patch also fixes the above error in the openat() filter. Earlier I fixed corresponding errors in filters for rename() and mprotect().
2014-04-16Fix sandbox protection for renameNick Mathewson
(We were only checking the first parameter of each rename call.)
2014-04-16Upgrade warning about missing interned string for sandboxNick Mathewson
2014-04-16Have sandbox string protection include multi-valued parmeters.Nick Mathewson
2014-04-16Clean up sandbox structures a bitNick Mathewson
Drop pindex,pindex2 as unused. Admit a type to avoid using a void*
2014-04-16Add missing rename function for non-linux platformsNick Mathewson
2014-04-16Drop 'fr' parameter from sandbox code.Nick Mathewson
Appearently, the majority of the filenames we pass to sandbox_cfg_allow() functions are "freeable right after". So, consider _all_ of them safe-to-steal, and add a tor_strdup() in the few cases that aren't. (Maybe buggy; revise when I can test.)
2014-04-16Add 'rename' to the sandboxed syscallsNick Mathewson
(If we don't restrict rename, there's not much point in restricting open, since an attacker could always use rename to make us open whatever they want.)
2014-04-16Only intern one copy of each magic string for the sandboxNick Mathewson
If we intern two copies of a string, later calls to sandbox_intern_string will give the wrong one sometimes.
2014-04-16Fix some initial sandbox issues.Nick Mathewson
Allow files that weren't in the list; Allow the _sysctl syscall; allow accept4 with CLOEXEC and NONBLOCK.
2014-04-16Only expose clean_backtrace() if we'll implement itNick Mathewson
Fixes windows compilation; bug not in any released Tor. Bugfix on cc9e86db.
2014-04-15Merge remote-tracking branch 'public/bug11465'Nick Mathewson
2014-04-15Uplift status.c unit test coverage with new test cases and macros.dana koch
A new set of unit test cases are provided, as well as introducing an alternative paradigm and macros to support it. Primarily, each test case is given its own namespace, in order to isolate tests from each other. We do this by in the usual fashion, by appending module and submodule names to our symbols. New macros assist by reducing friction for this and other tasks, like overriding a function in the global namespace with one in the current namespace, or declaring integer variables to assist tracking how many times a mock has been called. A set of tests for a small-scale module has been included in this commit, in order to highlight how the paradigm can be used. This suite gives 100% coverage to status.c in test execution.
2014-04-15Merge remote-tracking branch 'public/bug11513_024'Nick Mathewson
2014-04-14New sort order for server choice of ciphersuites.Nick Mathewson
Back in 175b2678, we allowed servers to recognize clients who are telling them the truth about their ciphersuites, and select the best cipher from on that list. This implemented the server side of proposal 198. In bugs 11492, 11498, and 11499, cypherpunks found a bunch of mistakes and omissions and typos in the UNRESTRICTED_SERVER_CIPHER_LIST we had. In #11513, I found a couple more. Rather than try to hand-edit this list, I wrote a short python script to generate our ciphersuite preferences from the openssl headers. The new rules are: * Require forward secrecy. * Require RSA (since our servers only configure RSA keys) * Require AES or 3DES. (This means, reject RC4, DES, SEED, CAMELLIA, and NULL.) * No export ciphersuites. Then: * Prefer AES to 3DES. * If both suites have the same cipher, prefer ECDHE to DHE. * If both suites have the same DHE group type, prefer GCM to CBC. * If both suites have the same cipher mode, prefer SHA384 to SHA256 to SHA1. * If both suites have the same digest, prefer AES256 to AES128.
2014-04-10Log a backtrace when the sandbox finds a failureNick Mathewson
This involves some duplicate code between backtrace.c and sandbox.c, but I don't see a way around it: calling more functions would mean adding more steps to our call stack, and running clean_backtrace() against the wrong point on the stack.
2014-04-10Make the sandbox code allow the writev() syscall.Nick Mathewson
Tor doesn't use it directly, but the glibc backtrace-to-fd code does
2014-04-08Merge remote-tracking branch 'public/update_ciphers_ff28'Nick Mathewson
2014-04-08Update ciphers.inc to match ff28Nick Mathewson
The major changes are to re-order some ciphers, to drop the ECDH suites (note: *not* ECDHE: ECDHE is still there), to kill off some made-up stuff (like the SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA suite), to drop some of the DSS suites... *and* to enable the ECDHE+GCM ciphersuites. This change is autogenerated by get_mozilla_ciphers.py from Firefox 28 and OpenSSL 1.0.1g. Resolves ticket 11438.
2014-04-08Teach the get_mozilla_ciphers.py script to parse recent firefoxenNick Mathewson
2014-04-07Merge remote-tracking branch 'public/bug10363_024_squashed'Nick Mathewson
2014-04-07Another 10363 instance: this one in tor_memmem fallback codeNick Mathewson
2014-04-05Merge remote-tracking branch 'public/bug10801_024'Nick Mathewson
Conflicts: src/common/address.c src/or/config.c
2014-04-05Make tor_addr_port_parse handle portless IPv6 addresses correctly.Nick Mathewson
(Not a bugfix on any Tor release; before 10801_024, it didn't handle portless addresses at all.)
2014-04-01Merge remote-tracking branch 'public/bug4645'Nick Mathewson
Conflicts: src/or/dirserv.c
2014-04-01Merge remote-tracking branch 'public/bug11232'Nick Mathewson
2014-03-31Merge branch 'bug8787_squashed'Nick Mathewson
2014-03-31Handle tor_munmap_file(NULL) consistentlyNick Mathewson
2014-03-31Check strftime() return in tortls.cAndrea Shepard
2014-03-31Eliminate lseek() with unchecked return in tor_mmap_file()Andrea Shepard
2014-03-31Always check returns from unlink()Andrea Shepard
2014-03-31Add return value and assert for null parameter to tor_munmap_file()Andrea Shepard
2014-03-27Don't do a DNS lookup on a bridge line addressNick Mathewson
Fixes bug 10801; bugfix on 07bf274d in 0.2.0.1-alpha.
2014-03-25Fix warnings from doxygenNick Mathewson
Most of these are simple. The only nontrivial part is that our pattern for using ENUM_BF was confusing doxygen by making declarations that didn't look like declarations.
2014-03-23Never run crypto_early_init() more than onceRoger Dingledine
Previously we had set up all the infrastructure to avoid calling it after the first time, but didn't actually use it.
2014-03-23Merge remote-tracking branch 'public/bug9683_rebased'Nick Mathewson
2014-03-23whitespace fixRoger Dingledine
2014-03-18Fix a ubsan warning in addr_mask_get_bitsNick Mathewson
ubsan doesn't like us to do (1u<<32) when 32 is wider than unsigned. Fortunately, we already special-case addr_mask_get_bits(0), so we can just change the loop bounds.