Repository: droe/sslsplit

Issue #104: Cannot run due to evdns errors (failed to open resolv.conf) with new privsep code
Created: 2015-07-21T16:33:02Z
Hi there,
I was eager to test the STARTTLS ability of the feature/autossl branch. Unfortunately, I cannot get it to run, neither on Mac OS X nor on Linux:
Issued command: sudo ./sslsplit -D -l conn.log -j ./out -S ./out/logs -k ca.key -c ca.crt ssl 127.0.0.1 8443 tcp 127.0.0.1 8080
...
NAT engine preinit 'pf'
Created self-pipe [r=6,w=7]
Created chld-pipe [r=8,w=9]
Created socketpair 0 [p=10,c=11]
Created socketpair 1 [p=12,c=13]
Created socketpair 2 [p=14,c=15]
NAT engine fini 'pf'
NAT engine init 'pf'
Received privsep req type 00 sz 1 on srvsock 14
evdns cannot parse resolv.conf: failed to open file (1)
Failed to initialize proxy.
NAT engine fini 'pf'
Received privsep req type 00 sz 1 on srvsock 12
Child proc 1108 exited with status 0

On Linux, I get Error creating dns event base at the same stage.
Of course, /etc/resolv.conf is available on both systems. On OS X it's actually a soft link to /var/run/resolv.conf but using a regular file does not change anything. sslsplit ran as root with sudo.
What shall I provide to debug this issue?
Thanks and best regards

Duplicate issue #110: Signal handling error in daemon mode
Created: 2015-11-09T08:28:00Z
In daemon mode, sslsplit can't process any traffic when receive SIGPIPE.
In debug mode, it works well.
following is sslsplit status when receive SIGPIPE
sslsplit process STAT changed from Ssl to Rsl and stop with futex lock.
bash-3.1# ps x|grep sslsplit
7384 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /tmp/CA.crt -k /tmp/CA.prv ssl 0.0.0.0 40022 netfilter
7577 pts/0    S+     0:00 grep sslsplitbash-3.1# killall -PIPE sslsplit
bash-3.1# ps x
bash-3.1# ps x|grep sslsplit
7384 ?        Rsl    0:01 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /tmp/CA.crt -k /tmp/CA.prv ssl 0.0.0.0 40022 netfilter
7641 pts/0    S+     0:00 grep sslsplit
bash-3.1# strace -f -p 7384
Process 7384 attached with 66 threads
[pid  7449] epoll_wait(402,  <unfinished ...>
[pid  7448] epoll_wait(396,  <unfinished ...>
[pid  7447] epoll_wait(390,  <unfinished ...>
[pid  7446] epoll_wait(384,  <unfinished ...>
[pid  7445] epoll_wait(378,  <unfinished ...>
[pid  7444] epoll_wait(372,  <unfinished ...>
[pid  7443] epoll_wait(366,  <unfinished ...>
[pid  7442] epoll_wait(360,  <unfinished ...>
[pid  7441] epoll_wait(354,  <unfinished ...>
[pid  7440] epoll_wait(348,  <unfinished ...>
[pid  7439] epoll_wait(342,  <unfinished ...>
[pid  7438] epoll_wait(336,  <unfinished ...>
[pid  7437] epoll_wait(330,  <unfinished ...>
[pid  7436] epoll_wait(324,  <unfinished ...>
[pid  7435] epoll_wait(318,  <unfinished ...>
[pid  7434] epoll_wait(312,  <unfinished ...>
[pid  7433] epoll_wait(306,  <unfinished ...>
[pid  7432] epoll_wait(300,  <unfinished ...>
[pid  7431] epoll_wait(294,  <unfinished ...>
[pid  7430] epoll_wait(288,  <unfinished ...>
[pid  7429] epoll_wait(282,  <unfinished ...>
[pid  7428] epoll_wait(276,  <unfinished ...>
[pid  7427] epoll_wait(270,  <unfinished ...>
[pid  7426] epoll_wait(264,  <unfinished ...>
[pid  7425] epoll_wait(258,  <unfinished ...>
[pid  7424] epoll_wait(252,  <unfinished ...>
[pid  7423] epoll_wait(246,  <unfinished ...>
[pid  7422] epoll_wait(240,  <unfinished ...>
[pid  7421] epoll_wait(234,  <unfinished ...>
[pid  7420] epoll_wait(228,  <unfinished ...>
[pid  7419] epoll_wait(222,  <unfinished ...>
[pid  7418] epoll_wait(216,  <unfinished ...>
[pid  7417] epoll_wait(210,  <unfinished ...>
[pid  7416] epoll_wait(204,  <unfinished ...>
[pid  7415] epoll_wait(198,  <unfinished ...>
[pid  7414] epoll_wait(192,  <unfinished ...>
[pid  7413] epoll_wait(186,  <unfinished ...>
[pid  7412] epoll_wait(180,  <unfinished ...>
[pid  7411] epoll_wait(174,  <unfinished ...>
[pid  7410] epoll_wait(168,  <unfinished ...>
[pid  7409] epoll_wait(162,  <unfinished ...>
[pid  7408] epoll_wait(156,  <unfinished ...>
[pid  7407] epoll_wait(150,  <unfinished ...>
[pid  7406] epoll_wait(144,  <unfinished ...>
[pid  7405] epoll_wait(138,  <unfinished ...>
[pid  7404] epoll_wait(132,  <unfinished ...>
[pid  7403] epoll_wait(126,  <unfinished ...>
[pid  7402] epoll_wait(120,  <unfinished ...>
[pid  7401] epoll_wait(114,  <unfinished ...>
[pid  7400] epoll_wait(108,  <unfinished ...>
[pid  7399] epoll_wait(102,  <unfinished ...>
[pid  7398] epoll_wait(96,  <unfinished ...>
[pid  7397] epoll_wait(90,  <unfinished ...>
[pid  7396] epoll_wait(84,  <unfinished ...>
[pid  7395] epoll_wait(78,  <unfinished ...>
[pid  7394] epoll_wait(72,  <unfinished ...>
[pid  7393] epoll_wait(66,  <unfinished ...>
[pid  7392] epoll_wait(60,  <unfinished ...>
[pid  7391] epoll_wait(54,  <unfinished ...>
[pid  7390] epoll_wait(48,  <unfinished ...>
[pid  7389] epoll_wait(42,  <unfinished ...>
[pid  7388] epoll_wait(36,  <unfinished ...>
[pid  7387] epoll_wait(30,  <unfinished ...>
[pid  7386] epoll_wait(24,  <unfinished ...>
[pid  7385] futex(0x17b41bc, FUTEX_WAIT_PRIVATE, 1, NULL
bash-3.1# ps -eLf x|grep sslsplit
root      7384     1  7384 95   66 17:18 ?        Rsl    5:32 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7385  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7386  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7387  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7388  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7389  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7390  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7391  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7392  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7393  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7394  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7395  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7396  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7397  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7398  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7399  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7400  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7401  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7402  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7403  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7404  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7405  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7406  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7407  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7408  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7409  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7410  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7411  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7412  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7413  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7414  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7415  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7416  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7417  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7418  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7419  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7420  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7421  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7422  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7423  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7424  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7425  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7426  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7427  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7428  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7429  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7430  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7431  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7432  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7433  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7434  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7435  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7436  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7437  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7438  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7439  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7440  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7441  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7442  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7443  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7444  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7445  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7446  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7447  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7448  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root      7384     1  7449  0   66 17:18 ?        Ssl    0:00 /usr/local/sbin/sslsplit -P -d -p /var/run/sslsplit.pid -u root -c /
root     11767 22841 11767  0    1 17:24 pts/0    S+     0:00 grep sslsplit

Closing comment (2015-11-10T13:23:50Z): I think the problem is that the signal handlers do not survive the forks part of detaching from TTY. The develop branch currently installs signal handlers after detaching from TTY, so this should not be an issue there. If you can test and confirm that, would be great.
Related to #104 in that the quickfix to #104 would probably reintroduce this bug in the develop branch.