Git Product home page Git Product logo

pac4cli's People

Contributors

claviola avatar denilsonsa avatar johnsonb88 avatar kdehairy avatar kdoheiri avatar lrocha-bcom avatar lucrocha avatar tkluck avatar tkluck-booking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pac4cli's Issues

Hash sum mismatches with apt

I have the following error when updating my repositories through pac4cli, but not when I instruct apt to go directly through the proxy:

~> sudo apt update
[...]
Get:28 http://nl.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [252 kB]                                          
Get:28 http://nl.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [252 kB]                                                  
Get:28 http://nl.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [252 kB]
Err:28 http://nl.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages                                                                 
  Hash Sum mismatch
  Hashes of expected file:
   - Filesize:252356 [weak]
   - SHA256:4ac29191784f2fb23fcc15e0c63e31186e715ac5f225ae4f67e8609f670c328d
   - SHA1:06838369a89a798e49f6cd38402da035f4cadce3 [weak]
   - MD5Sum:aa49210f64a49fc87757d47d776d2205 [weak]
  Hashes of received file:
   - SHA256:b9b2bcbdc22af3c84ae97165e56bbc1072c03417a56a3fcbe18cb5a3801252cf
   - SHA1:05529bcf9522ecf66b06f0896e104b847693a157 [weak]
   - MD5Sum:164012ed99f02a2427f3aee21bb4de89 [weak]
   - Filesize:158124 [weak]
  Last modification reported: Fri, 10 Aug 2018 00:59:36 +0000
  Release file created at: Fri, 10 Aug 2018 06:13:35 +0000
Err:31 http://nl.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata                              

Get:32 http://nl.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 64x64 Icons [53.7 kB]                                                                                      
Get:33 http://nl.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [158 kB]                            
Get:34 http://nl.archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages [158 kB]                                                                                        
Hit:24 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease  
[...]                                                      

W: http://nl.archive.ubuntu.com/ubuntu/dists/bionic-updates/main/binary-i386/by-hash/SHA256/4ac29191784f2fb23fcc15e0c63e31186e715ac5f225ae4f67e8609f670c328d: Automatically disabled Acquire::http::Pipeline-Depth due to incorrect response from server/proxy. (man 5 apt.conf)     

I cannot reproduce the issue from the command line:

~> env HTTP_PROXY='http://webproxy:3128/' wget --quiet http://nl.archive.ubuntu.com/ubuntu/dists/bionic-updates/main/binary-i386/by-hash/SHA256/4ac29191784f2fb23fcc15e0c63e31186e715ac5f225ae4f67e8609f670c328d -O - | wc -c
252356
~> env HTTP_PROXY='http://localhost:3128/' wget --quiet http://nl.archive.ubuntu.com/ubuntu/dists/bionic-updates/main/binary-i386/by-hash/SHA256/4ac29191784f2fb23fcc15e0c63e31186e715ac5f225ae4f67e8609f670c328d -O - | wc -c
252356

The downloaded files are binary-equal.

This doesn't just happen for apt update. apt-upgrade also failed on, say, this package:

Err:2 http://nl.archive.ubuntu.com/ubuntu bionic-proposed/main amd64 console-setup all 1.178ubuntu2.6
  Hash Sum mismatch
  Hashes of expected file:
   - SHA256:0054a78701d67fd1f34227b5718edf3d8e50102696790dcf934dd372988ef201
   - SHA1:b9424f627123511aa5b94705275d1cf635e25e28 [weak]
   - MD5Sum:9795f2526d271aedfff53ecdf6cecee8 [weak]
   - Filesize:104608 [weak]
  Hashes of received file:
   - SHA256:d5cf27902451885a3ff18446015729f3eae72e7a196a926017982170bf8a27c7
   - SHA1:b8cd777ee21157ad3cca0e16336addac01a18963 [weak]
   - MD5Sum:1668125ec62016fcf375c6bdf102039e [weak]
   - Filesize:104608 [weak]
  Last modification reported: Thu, 09 Aug 2018 13:08:18 +0000

I remember having a similar issue with my workplace's squid proxies as well, but the newer proxies don't seem to exhibit this issue. The only resolution at the time, IIRC, was not using the proxies...

pac4cli does not respect http header case

As reported by @denilsonsa over email, discussing his setup in our shared work environment (some details redacted):

So, I use "adminer" as a web interface to query the database. The way I've set it up is by running PHP cli server in the KVM, and then do SSH port redirection.

After I installed pac4cli, I noticed adminer stopped working. After an hour of debugging, I've manged to track down the exact reason: pac4cli is lower-casing the HTTP headers, and the old PHP 5.4 on my KVM seems to dislike that.

How to reproduce (minimal version):

Create a [centos VM], then run the following commands:
ssh -L 127.0.0.1:1495:127.0.0.1:1495 your-centos-vm
sudo yum install php-cli
mkdir ~/foobar
cd ~/foobar
echo '<form action="" method="POST"> <input type="text" name="foo"> <input type="submit"> </form> <?php var_dump($_POST); ?>' > index.php
php -S 127.0.0.1:1495
Finally, open http://127.0.0.7:1495/ in your browser…
    When you submit the form through pac4cli, nothing gets printed.
    When you submit the form directly (bypassing pac4cli), the submitted value gets printed.

So, yeah, this is a corner case.
I tried reproducing it by running PHP cli server on my laptop, but it seems to work fine in PHP 7.

Now… Why does it happen? I've also investigated that by running "nc -l -p 1495". I believe it is caused by pac4cli sending all HTTP headers in lower-case.

But when are they converted to lowercase? Well, inside twisted:
https://github.com/twisted/twisted/blob/twisted-18.9.0/src/twisted/web/http.py#L1358

Also, that documentation suggests using another method instead of getAllHeaders.

So, you might want to create some unit tests on pac4cli for checking if the same header passed multiple times on the input will be passed correctly to the remote server; and if the case is preserved from the input to the output (or, at least the case is in canonical capitalization).

Thanks! I hope this is enough to understand and reproduce this bug. :)
Feel free to ask any questions!

edit: redacted some corporate details for non-disclosure and more general applicability.

Request PPA for Ubuntu 22.04 (Jammy)

Would it be possible to build pac4cli and txdbus in your PPA (edit - fixed acronym) for 22.04? That would be very helpful.

Pac4cli is wonderful -- I haven't found any other way to get Windows-style automatic proxy detection on Linux.
Thanks!

Pac4cli recently broke on Ubuntu 20.04

Pac4cli (Ubuntu 20.04 PPA version) had been working great for years, but broke within the last few days:

> pac4cli --loglevel=debug
INFO [9718]: pac4cli: Starting proxy server on 127.0.0.1:None
ERROR [9718]: pac4cli: Problem starting the server
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pac4cli/__main__.py", line 105, in main
    yield start_server(args.bind, args.port, reactor)
TypeError: an integer is required (got type NoneType)

> python3 -m twisted --version
18.9.0

I assume this is due to a change in the version of one of its dependencies, possibly twisted.
Any suggestions? I'm happy to gather more info.

pac4cli getting errors on 22.04 even with DynamicUser=true

Hi...

I thought I had the same issue in Ubuntu 22.04 as seen in the issue:

Pac4cli recently broke on Ubuntu 20.04
#78

But I have made the change to DynamicUseer=True and am seeing stack traces on startup:

Dec 08 15:05:25 rbeldin-HP-ZBook-15-G3 systemd[1]: Started PAC autoconfigured proxy for use through http_proxy= environment variables.
Dec 08 15:05:25 rbeldin-HP-ZBook-15-G3 /usr/lib/python3/dist-packages/pac4cli/main.py[14353]: WARNING [14353]: pac4cli: Problem reading configuration file /etc/pac4cli/pac4cli.config
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pac4cli/wpad.py", line 136, in getUrls
wpad_url = self.get_config_wpad_url(self.config_file)
File "/usr/lib/python3/dist-packages/pac4cli/wpad.py", line 125, in get_config_wpad_url
url = config.get('wpad', 'url')
File "/usr/lib/python3.10/configparser.py", line 783, in get
d = self._unify_values(section, vars)
File "/usr/lib/python3.10/configparser.py", line 1154, in _unify_values
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'wpad'

My config file is a single line:

url=http://autocache.acme.corp/

It seems to 'mostly' work with the errors above, but it seems it is complaining about the format.

Do I have the format incorrect?

Thanks

txdbus in PPA for focal - again

Thanks for working on txdbus in #76! However, it looks like it only got enabled for 19.10. It's still not there for 20.04 (focal)...

Thanks,
Brian

PPA for focal (20.04)

I don't see packages for Ubuntu 20.04 ("focal") in the tkluck/pac4cli PPA. It only seems to have packages up through 19.04 ("disco"). Would you consider adding a build for 20.04, since it's a new long-term support (LTS) release?

Pac4cli is an awesomely useful package! I don't actually use it much for CLI apps, but I use it as a systemwide proxy for browsers, VMs, and everything else I use. It makes it absolutely seamless to move between my corporate network and unproxied networks outside the office. Great job!

Thanks,
Brian

Removing pac4cli on Ubuntu 22.04

On a previous issue, I had a problem with the config file on Ubuntu 22.04.

During troubleshooting, I completely removed pac4cli with apt remove pac4cli. After doing so, I had to reboot for another reason. I was surprised when I came back up that my user processes still seem to have references to 3128:

env | grep 3128
https_proxy=http://127.0.0.1:3128
http_proxy=http://127.0.0.1:3128
_JAVA_OPTIONS= -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3128

I found some scripts leftover in /etc/profiles.d that would set these, but can't find others. I think this is cached somewhere in the login environment.

Explicitly specify IPv6 preference in CLI

Proposal:

pac4cli --bind localhost --ipv6

This will have the effect of preferring IPv6 interface over IPv4 interface if both are present.

pac4cli --bind 127.0.0.0 --ipv6

Has no effect

Regular traceback in system logs

I get a lot of this in my logs:

Mar 21 14:47:22 taniwha pac4cli[1386]: Unhandled Error
Mar 21 14:47:22 taniwha pac4cli[1386]: Traceback (most recent call last):
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/pac4cli/__main__.py", line 126, in <module>
Mar 21 14:47:22 taniwha pac4cli[1386]:     reactor.run()
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
Mar 21 14:47:22 taniwha pac4cli[1386]:     self.mainLoop()
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1255, in mainLoop
Mar 21 14:47:22 taniwha pac4cli[1386]:     self.doIteration(t)
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/internet/epollreactor.py", line 235, in doPoll
Mar 21 14:47:22 taniwha pac4cli[1386]:     log.callWithLogger(selectable, _drdw, selectable, fd, event)
Mar 21 14:47:22 taniwha pac4cli[1386]: --- <exception caught here> ---
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 103, in callWithLogger
Mar 21 14:47:22 taniwha pac4cli[1386]:     return callWithContext({"system": lp}, func, *args, **kw)
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 86, in callWithContext
Mar 21 14:47:22 taniwha pac4cli[1386]:     return context.call({ILogContext: newCtx}, func, *args, **kw)
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 122, in callWithContext
Mar 21 14:47:22 taniwha pac4cli[1386]:     return self.currentContext().callWithContext(ctx, func, *args, **kw)
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 85, in callWithContext
Mar 21 14:47:22 taniwha pac4cli[1386]:     return func(*args,**kw)
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/internet/posixbase.py", line 627, in _doReadOrWrite
Mar 21 14:47:22 taniwha pac4cli[1386]:     self._disconnectSelectable(selectable, why, inRead)
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/internet/posixbase.py", line 258, in _disconnectSelectable
Mar 21 14:47:22 taniwha pac4cli[1386]:     selectable.connectionLost(failure.Failure(why))
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 475, in connectionLost
Mar 21 14:47:22 taniwha pac4cli[1386]:     self._commonConnection.connectionLost(self, reason)
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 289, in connectionLost
Mar 21 14:47:22 taniwha pac4cli[1386]:     protocol.connectionLost(reason)
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 585, in connectionLost
Mar 21 14:47:22 taniwha pac4cli[1386]:     self.handleResponseEnd()
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/web/proxy.py", line 87, in handleResponseEnd
Mar 21 14:47:22 taniwha pac4cli[1386]:     self.father.finish()
Mar 21 14:47:22 taniwha pac4cli[1386]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 992, in finish
Mar 21 14:47:22 taniwha pac4cli[1386]:     "Request.finish called on a request after its connection was lost; "
Mar 21 14:47:22 taniwha pac4cli[1386]: builtins.RuntimeError: Request.finish called on a request after its connection was lost; use Request.notifyFinish to keep track of this.

version:

robin@taniwha:~$ apt policy pac4cli
pac4cli:
  Geïnstalleerd: 0.1ubuntu2+git119~ubuntu18.04.1
  Kandidaat:     0.1ubuntu2+git119~ubuntu18.04.1
  Versietabel:
 *** 0.1ubuntu2+git119~ubuntu18.04.1 500
        500 http://ppa.launchpad.net/tkluck/pac4cli/ubuntu bionic/main amd64 Packages
        500 http://ppa.launchpad.net/tkluck/pac4cli/ubuntu bionic/main i386 Packages
        100 /var/lib/dpkg/status

pac4cli crash loop during startup on Ubuntu 18.10

I ran into this issue because I still had some old configuration files on my system. The system journal shows:

okt 17 20:51:12 tkluck-xps systemd[1]: Started PAC autoconfigured proxy for use through http_proxy= environment variables.
okt 17 20:51:13 tkluck-xps systemd[1]: pac4cli.service: Service RestartSec=100ms expired, scheduling restart.
okt 17 20:51:13 tkluck-xps systemd[1]: pac4cli.service: Scheduled restart job, restart counter is at 1.
okt 17 20:51:13 tkluck-xps systemd[1]: Stopped PAC autoconfigured proxy for use through http_proxy= environment variables.
okt 17 20:51:13 tkluck-xps systemd[1]: Started PAC autoconfigured proxy for use through http_proxy= environment variables.
okt 17 20:51:13 tkluck-xps systemd[1]: pac4cli.service: Service RestartSec=100ms expired, scheduling restart.
okt 17 20:51:13 tkluck-xps systemd[1]: pac4cli.service: Scheduled restart job, restart counter is at 2.
okt 17 20:51:13 tkluck-xps systemd[1]: Stopped PAC autoconfigured proxy for use through http_proxy= environment variables.
okt 17 20:51:13 tkluck-xps systemd[1]: Started PAC autoconfigured proxy for use through http_proxy= environment variables.
okt 17 20:51:14 tkluck-xps systemd[1]: pac4cli.service: Service RestartSec=100ms expired, scheduling restart.
okt 17 20:51:14 tkluck-xps systemd[1]: pac4cli.service: Scheduled restart job, restart counter is at 3.
okt 17 20:51:14 tkluck-xps systemd[1]: Stopped PAC autoconfigured proxy for use through http_proxy= environment variables.
okt 17 20:51:14 tkluck-xps systemd[1]: Started PAC autoconfigured proxy for use through http_proxy= environment variables.
okt 17 20:51:17 tkluck-xps systemd[1]: pac4cli.service: Service RestartSec=100ms expired, scheduling restart.
okt 17 20:51:17 tkluck-xps systemd[1]: pac4cli.service: Scheduled restart job, restart counter is at 4.
okt 17 20:51:17 tkluck-xps systemd[1]: Stopped PAC autoconfigured proxy for use through http_proxy= environment variables.
okt 17 20:51:17 tkluck-xps systemd[1]: Started PAC autoconfigured proxy for use through http_proxy= environment variables.
okt 17 20:51:20 tkluck-xps systemd[1]: pac4cli.service: Service RestartSec=100ms expired, scheduling restart.
okt 17 20:51:20 tkluck-xps systemd[1]: pac4cli.service: Scheduled restart job, restart counter is at 5.
okt 17 20:51:20 tkluck-xps systemd[1]: Stopped PAC autoconfigured proxy for use through http_proxy= environment variables.
okt 17 20:51:20 tkluck-xps systemd[1]: pac4cli.service: Start request repeated too quickly.
okt 17 20:51:20 tkluck-xps systemd[1]: pac4cli.service: Failed with result 'start-limit-hit'.
okt 17 20:51:20 tkluck-xps systemd[1]: Failed to start PAC autoconfigured proxy for use through http_proxy= environment variables.

This will be fixed by #47 and this fix is already in the daily ppa build. Recording it as an issue here so it can be googled.

Getting error 'Start request repeated too quickly.'

sudo service pac4cli status | fold -s 
● pac4cli.service - PAC autoconfigured proxy for use through http_proxy= 
environment variables
   Loaded: loaded (/usr/local/lib/systemd/system/pac4cli.service; disabled; 
vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-02-18 19:00:01 IST; 1min 
24s ago
  Process: 6816 ExecStart=/usr/local/bin/pac4cli -p 3128 --systemd --config 
/etc/pac4cli/pac4cli.config --loglevel warn (code=exited, status=1/FAILURE)
 Main PID: 6816 (code=exited, status=1/FAILURE)

Feb 18 19:00:01 pop-os systemd[1]: pac4cli.service: Failed with result 
'exit-code'.
Feb 18 19:00:01 pop-os systemd[1]: Failed to start PAC autoconfigured proxy for 
use through http_proxy= environment variables.
Feb 18 19:00:01 pop-os systemd[1]: pac4cli.service: Service RestartSec=100ms 
expired, scheduling restart.
Feb 18 19:00:01 pop-os systemd[1]: pac4cli.service: Scheduled restart job, 
restart counter is at 5.
Feb 18 19:00:01 pop-os systemd[1]: Stopped PAC autoconfigured proxy for use 
through http_proxy= environment variables.
Feb 18 19:00:01 pop-os systemd[1]: pac4cli.service: Start request repeated too 
quickly.
Feb 18 19:00:01 pop-os systemd[1]: pac4cli.service: Failed with result 
'exit-code'.
Feb 18 19:00:01 pop-os systemd[1]: Failed to start PAC autoconfigured proxy for 
use through http_proxy= environment variables.

support installation in /usr, depend on system packages

This requires at least the following:

  • rename main.py to just pac4cli; put it in $PREFIX/bin
  • put proxy.py in $PREFIX/lib/python3/site-packages/pac4cli
  • (for debian) package txdbus and the new version of python3-systemd

It probably means we want make install to work with system packages and install in /usr/local, and make the virtualenv /opt installation a supported but non-default option. make opt-install or something.

Helpful:

  • make pacparser installable through pip and remove it as a git-submodule.
  • other?

pac4cli cannot be used for building docker images

AFAICT docker containers exist on the other end of a docker tunnel called "docker0"; on my laptop, I've got the laptop itself on 172.17.0.1 and the "machine" (?) running the container on 172.17.0.2.

Those machines are typically configured to use Google DNS, so attempting to use a domain name as HTTP_PROXY only works if their DNS name is known to Google.

~> ip address show dev docker0
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:ef:ab:8d:54 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:efff:feab:8d54/64 scope link 
       valid_lft forever preferred_lft forever
~> docker run -it alpine ip address show dev eth0
99: eth0@if100: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP 
    link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0
       valid_lft forever preferred_lft forever
~> docker run -it alpine cat /etc/resolv.conf | tail -n2
nameserver 8.8.8.8
nameserver 8.8.4.4

As a result:

  • Attempting to set HTTP_PROXY to 127.0.0.1 doesn't work, since 127.0.0.1 doesn't point to your machine, but to the container itself.
  • Setting HTTP_PROXY to 172.17.0.1 doesn't work since pac4cli binds to the laptop's 127.0.0.1; when confronted with a request from 172.17.0.2, it'll refuse the connection.
  • Setting HTTP_PROXY to the name of the internal corporate proxy I have to use doesn't work, which mean I need to hardcode IP addresses in ~/.docker/config.json, making pac4cli even more desirable to use than it normally is.

I don't know if you have a happy middle ground between just binding to localhost and binding to literally anything and hoping the firewall does the right thing, but I wanted at least to document my struggles for the benefit of the next unfortunate soul.

Removing pac4cli on Ubuntu 22.04

On a previous issue, I had a problem with the config file on Ubuntu 22.04.

During troubleshooting, I completely removed pac4cli with apt remove pac4cli. After doing so, I had to reboot for another reason. I was surprised when I came back up that my user processes still seem to have references to 3128:

env | grep 3128
https_proxy=http://127.0.0.1:3128
http_proxy=http://127.0.0.1:3128
_JAVA_OPTIONS= -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3128

I found some scripts leftover in /etc/profiles.d that would set these, but can't find others. I wonder if this is cached somewhere in the login environment. I can't swear to it, but it seems limited to the desktop login and not ssh logins.

dbus-python problem on OSX?

Hey, don't know what's the best way to fix this (or if it needs to be fixed), but I was having problems when trying to install dbus-puthon on Mac, so I had to run this first -> brew install dbus.

binding to IPv6 address of localhost (if exists)

When curl is restricted to use IPv6 interfaces, it resolves localhost to ::1 which we don't listen on.

Proposal:
Resolve localhost (when left as the default binding interface) to both it's IPv4 and IPv6 interfaces as declared in /etc/hosts.

Refer to #3 (comment)

Need txdbus built for Ubuntu 18.04

In the Ubuntu PPA, pac4cli is being built for 18.04, but txdbus is not. So I get an error while trying to install:

laptop1> sudo apt-get install pac4cli
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 pac4cli : Depends: python3-txdbus but it is not installable
E: Unable to correct problems, you have held broken packages.

I must not have noticed this before, since I had had to force the 17.10 PPA to install pac4cli. That must have installed txdbus. Then when I removed pac4cli and switched to the 18.04 PPA, txdbus was already present, so I didn't get a dependency error. But now I'm installing on a fresh system, so the error occurs.

If you could update the PPA, I'd appreciate it.

Thanks,
Brian Johnson

apt downloads do not disconnect

I've observed that when apt downloads indexes or packages, it gets stuck at 100% download, waiting for a timeout instead of proceeding to download the next package.

My hypothesis is that pac4cli does not properly disconnect the apt -> pac4cli connection when the pac4cli -> server connection is being dropped by the server.

This is when downloading over http. I haven't validated whether it's using CONNECT or just GET, but I suspect the latter.

txdbus in PPA for focal

Thanks for building the PPA for Ubuntu 20.04 (focal fossa) under issue #75. The pac4cli package is available for download. However, launchpad only shows txdbus packages up through 19.04. The missing package is causing an unmet dependency:

$ sudo apt install pac4cli
   ...
The following packages have unmet dependencies:
 pac4cli : Depends: python3-txdbus but it is not installable

Could you enable txdbus in the PPA as well? Or is there somewhere else I should be installing python3-txdbus from?

Thanks!
Brian

Should run as a non-privileged user

The current systemd config start pac4cli as root. In the unlikely event of an exploit, it's safer if it runs e.g. as nobody or as its own user.

"builtins.ValueError: too many values to unpack (expected 2)" traceback on connecting to network

When my computer connects, I see this in syslog:

Sep 17 16:20:55 taniwha pac4cli[18693]: Unhandled Error
Sep 17 16:20:55 taniwha pac4cli[18693]: Traceback (most recent call last):
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 103, in callWithLogger
Sep 17 16:20:55 taniwha pac4cli[18693]:     return callWithContext({"system": lp}, func, *args, **kw)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 86, in callWithContext
Sep 17 16:20:55 taniwha pac4cli[18693]:     return context.call({ILogContext: newCtx}, func, *args, **kw)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 122, in callWithContext
Sep 17 16:20:55 taniwha pac4cli[18693]:     return self.currentContext().callWithContext(ctx, func, *args, **kw)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 85, in callWithContext
Sep 17 16:20:55 taniwha pac4cli[18693]:     return func(*args,**kw)
Sep 17 16:20:55 taniwha pac4cli[18693]: --- <exception caught here> ---
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
Sep 17 16:20:55 taniwha pac4cli[18693]:     why = selectable.doRead()
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 205, in doRead
Sep 17 16:20:55 taniwha pac4cli[18693]:     return self._dataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 211, in _dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     rval = self.protocol.dataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2125, in dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     return basic.LineReceiver.dataReceived(self, data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/protocols/basic.py", line 578, in dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     why = self.rawDataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2132, in rawDataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     self._transferDecoder.dataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 1614, in dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     finishCallback(data[contentLength:])
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2029, in _finishRequestBody
Sep 17 16:20:55 taniwha pac4cli[18693]:     self.allContentReceived()
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2104, in allContentReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     req.requestReceived(command, path, version)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 866, in requestReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     self.process()
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/pac4cli/pac4cli.py", line 38, in process
Sep 17 16:20:55 taniwha pac4cli[18693]:     host, port = host.split(':')
Sep 17 16:20:55 taniwha pac4cli[18693]: builtins.ValueError: too many values to unpack (expected 2)
Sep 17 16:20:55 taniwha pac4cli[18693]: Unhandled Error
Sep 17 16:20:55 taniwha pac4cli[18693]: Traceback (most recent call last):
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 103, in callWithLogger
Sep 17 16:20:55 taniwha pac4cli[18693]:     return callWithContext({"system": lp}, func, *args, **kw)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 86, in callWithContext
Sep 17 16:20:55 taniwha pac4cli[18693]:     return context.call({ILogContext: newCtx}, func, *args, **kw)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 122, in callWithContext
Sep 17 16:20:55 taniwha pac4cli[18693]:     return self.currentContext().callWithContext(ctx, func, *args, **kw)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 85, in callWithContext
Sep 17 16:20:55 taniwha pac4cli[18693]:     return func(*args,**kw)
Sep 17 16:20:55 taniwha pac4cli[18693]: --- <exception caught here> ---
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
Sep 17 16:20:55 taniwha pac4cli[18693]:     why = selectable.doRead()
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 205, in doRead
Sep 17 16:20:55 taniwha pac4cli[18693]:     return self._dataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 211, in _dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     rval = self.protocol.dataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2125, in dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     return basic.LineReceiver.dataReceived(self, data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/protocols/basic.py", line 578, in dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     why = self.rawDataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2132, in rawDataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     self._transferDecoder.dataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 1614, in dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     finishCallback(data[contentLength:])
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2029, in _finishRequestBody
Sep 17 16:20:55 taniwha pac4cli[18693]:     self.allContentReceived()
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2104, in allContentReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     req.requestReceived(command, path, version)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 866, in requestReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     self.process()
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/pac4cli/pac4cli.py", line 38, in process
Sep 17 16:20:55 taniwha pac4cli[18693]:     host, port = host.split(':')
Sep 17 16:20:55 taniwha pac4cli[18693]: builtins.ValueError: too many values to unpack (expected 2)
Sep 17 16:20:55 taniwha pac4cli[18693]: Unhandled Error
Sep 17 16:20:55 taniwha pac4cli[18693]: Traceback (most recent call last):
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 103, in callWithLogger
Sep 17 16:20:55 taniwha pac4cli[18693]:     return callWithContext({"system": lp}, func, *args, **kw)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 86, in callWithContext
Sep 17 16:20:55 taniwha pac4cli[18693]:     return context.call({ILogContext: newCtx}, func, *args, **kw)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 122, in callWithContext
Sep 17 16:20:55 taniwha pac4cli[18693]:     return self.currentContext().callWithContext(ctx, func, *args, **kw)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 85, in callWithContext
Sep 17 16:20:55 taniwha pac4cli[18693]:     return func(*args,**kw)
Sep 17 16:20:55 taniwha pac4cli[18693]: --- <exception caught here> ---
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
Sep 17 16:20:55 taniwha pac4cli[18693]:     why = selectable.doRead()
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 205, in doRead
Sep 17 16:20:55 taniwha pac4cli[18693]:     return self._dataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 211, in _dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     rval = self.protocol.dataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2125, in dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     return basic.LineReceiver.dataReceived(self, data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/protocols/basic.py", line 578, in dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     why = self.rawDataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2132, in rawDataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     self._transferDecoder.dataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 1614, in dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     finishCallback(data[contentLength:])
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2029, in _finishRequestBody
Sep 17 16:20:55 taniwha pac4cli[18693]:     self.allContentReceived()
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2104, in allContentReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     req.requestReceived(command, path, version)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 866, in requestReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     self.process()
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/pac4cli/pac4cli.py", line 38, in process
Sep 17 16:20:55 taniwha pac4cli[18693]:     host, port = host.split(':')
Sep 17 16:20:55 taniwha pac4cli[18693]: builtins.ValueError: too many values to unpack (expected 2)
Sep 17 16:20:55 taniwha pac4cli[18693]: Unhandled Error
Sep 17 16:20:55 taniwha pac4cli[18693]: Traceback (most recent call last):
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 103, in callWithLogger
Sep 17 16:20:55 taniwha pac4cli[18693]:     return callWithContext({"system": lp}, func, *args, **kw)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 86, in callWithContext
Sep 17 16:20:55 taniwha pac4cli[18693]:     return context.call({ILogContext: newCtx}, func, *args, **kw)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 122, in callWithContext
Sep 17 16:20:55 taniwha pac4cli[18693]:     return self.currentContext().callWithContext(ctx, func, *args, **kw)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 85, in callWithContext
Sep 17 16:20:55 taniwha pac4cli[18693]:     return func(*args,**kw)
Sep 17 16:20:55 taniwha pac4cli[18693]: --- <exception caught here> ---
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
Sep 17 16:20:55 taniwha pac4cli[18693]:     why = selectable.doRead()
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 205, in doRead
Sep 17 16:20:55 taniwha pac4cli[18693]:     return self._dataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 211, in _dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     rval = self.protocol.dataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2125, in dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     return basic.LineReceiver.dataReceived(self, data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/protocols/basic.py", line 578, in dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     why = self.rawDataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2132, in rawDataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     self._transferDecoder.dataReceived(data)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 1614, in dataReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     finishCallback(data[contentLength:])
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2029, in _finishRequestBody
Sep 17 16:20:55 taniwha pac4cli[18693]:     self.allContentReceived()
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 2104, in allContentReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     req.requestReceived(command, path, version)
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/twisted/web/http.py", line 866, in requestReceived
Sep 17 16:20:55 taniwha pac4cli[18693]:     self.process()
Sep 17 16:20:55 taniwha pac4cli[18693]:   File "/usr/lib/python3/dist-packages/pac4cli/pac4cli.py", line 38, in process
Sep 17 16:20:55 taniwha pac4cli[18693]:     host, port = host.split(':')
Sep 17 16:20:55 taniwha pac4cli[18693]: builtins.ValueError: too many values to unpack (expected 2)

Installed from the PPA:

$ apt-cache policy pac4cli
pac4cli:
  Geïnstalleerd: 0.1ubuntu2+git101~ubuntu18.04.1

The maximum number of active connections for UID 0 has been reached

I don't know the exact steps on how to reproduce it. It happened once to me, and caused major issues that force me to restart my laptop.

I'm running Ubuntu 18.04, with LXDE (Lubuntu) as the desktop, on a laptop machine. pac4cli is installed through the PPA. The laptop had about 14 days of uptime when that happened. I also had a docker container running (for quite some time), which spawned a couple of virtual network interfaces (not sure if it is related or not).

I've found these entries on my /var/log/syslog (I've removed some noisy non-relevant lines):

Nov 27 16:12:55  /usr/lib/python3/dist-packages/pac4cli/__main__.py[4517]: WARNING [4517]: pac4cli: Problem getting wpad option for connection /org/freedesktop/NetworkManager/ActiveConnection/26#012Traceback (most recent call last):#012  File "/usr/lib/python3/dist-packages/pac4cli/wpad.py", line 84, in get_wpad_url#012    'org.freedesktop.NetworkManager.Connection.Active', 'Dhcp4Config')#012txdbus.error.RemoteError: org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/NetworkManager/ActiveConnection/26
Nov 27 16:12:55  systemd-sleep[27931]: Suspending system...

Nov 27 16:20:28  dbus-daemon[1128]: [system] The maximum number of active connections for UID 0 has been reached (max_connections_per_user=256)
Nov 27 16:20:28  /usr/lib/python3/dist-packages/pac4cli/__main__.py[4517]: WARNING [4517]: pac4cli: Issue getting wpad configuration#012Traceback (most recent call last):#012  File "/usr/lib/python3/dist-packages/pac4cli/__main__.py", line 70, in get_possible_configuration_locations#012    urls = yield wpad.getUrls()#012txdbus.error.RemoteError: org.freedesktop.DBus.Error.LimitsExceeded: The maximum number of active connections for UID 0 has been reached

Nov 28 10:37:09  pac4cli[4513]: Unhandled Error
Nov 28 10:37:09  pac4cli[4513]: Traceback (most recent call last):
Nov 28 10:37:09  pac4cli[4513]:   File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
Nov 28 10:37:09  pac4cli[4513]:     exec(code, run_globals)
Nov 28 10:37:09  pac4cli[4513]:   File "/usr/lib/python3/dist-packages/pac4cli/__main__.py", line 145, in <module>
Nov 28 10:37:09  pac4cli[4513]:     reactor.run()
Nov 28 10:37:09  pac4cli[4513]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
Nov 28 10:37:09  pac4cli[4513]:     self.mainLoop()
Nov 28 10:37:09  pac4cli[4513]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
Nov 28 10:37:09  pac4cli[4513]:     self.runUntilCurrent()
Nov 28 10:37:09  pac4cli[4513]: --- <exception caught here> ---
Nov 28 10:37:09  pac4cli[4513]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 851, in runUntilCurrent
Nov 28 10:37:09  pac4cli[4513]:     f(*a, **kw)
Nov 28 10:37:09  pac4cli[4513]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 627, in stop
Nov 28 10:37:09  pac4cli[4513]:     "Can't stop reactor that isn't running.")
Nov 28 10:37:09  pac4cli[4513]: twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't running.
Nov 28 10:37:09  pac4cli[4513]: Unhandled Error
Nov 28 10:37:09  pac4cli[4513]: Traceback (most recent call last):
Nov 28 10:37:09  pac4cli[4513]:   File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
Nov 28 10:37:09  pac4cli[4513]:     exec(code, run_globals)
Nov 28 10:37:09  pac4cli[4513]:   File "/usr/lib/python3/dist-packages/pac4cli/__main__.py", line 145, in <module>
Nov 28 10:37:09  pac4cli[4513]:     reactor.run()
Nov 28 10:37:09  pac4cli[4513]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
Nov 28 10:37:09  pac4cli[4513]:     self.mainLoop()
Nov 28 10:37:09  pac4cli[4513]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
Nov 28 10:37:09  pac4cli[4513]:     self.runUntilCurrent()
Nov 28 10:37:09  pac4cli[4513]: --- <exception caught here> ---
Nov 28 10:37:09  pac4cli[4513]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 851, in runUntilCurrent
Nov 28 10:37:09  pac4cli[4513]:     f(*a, **kw)
Nov 28 10:37:09  pac4cli[4513]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 627, in stop
Nov 28 10:37:09  pac4cli[4513]:     "Can't stop reactor that isn't running.")
Nov 28 10:37:09  pac4cli[4513]: twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't running.
Nov 28 10:37:09  pac4cli[4513]: ['127.0.0.1']
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:A-0000072/cgroup/eventpoll_pwq(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:A-0000128/cgroup/eventpoll_epi(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/sock_inode_cache/cgroup/sock_inode_cache(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:A-0000208/cgroup/vm_area_struct(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:A-0002112/cgroup/mm_struct(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:A-0000704/cgroup/files_cache(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/proc_inode_cache/cgroup/proc_inode_cache(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/inode_cache/cgroup/inode_cache(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/sighand_cache/cgroup/sighand_cache(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:A-0000256/cgroup/filp(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:A-0000192/cgroup/cred_jar(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:A-0005952/cgroup/task_struct(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:A-0001024/cgroup/signal_cache(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/anon_vma/cgroup/anon_vma(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:A-0000064/cgroup/pid(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:0002048/cgroup/kmalloc-2048(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:0004096/cgroup/kmalloc-4096(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:0000256/cgroup/kmalloc-256(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:0000512/cgroup/kmalloc-512(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:0000096/cgroup/kmalloc-96(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:0000192/cgroup/kmalloc-192(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:0001024/cgroup/kmalloc-1024(1972:pac4cli.service)"
Nov 28 10:37:09  snapd[25277]: udevmon.go:184: udev monitor observed remove event for unknown device "/sys/kernel/slab/:0000064/cgroup/kmalloc-64(1972:pac4cli.service)"
Nov 28 10:37:09  systemd[1]: pac4cli.service: Service hold-off time over, scheduling restart.
Nov 28 10:37:09  systemd[1]: pac4cli.service: Scheduled restart job, restart counter is at 1.
Nov 28 10:37:09  systemd[1]: Stopped PAC autoconfigured proxy for use through http_proxy= environment variables.
Nov 28 10:37:09  systemd[1]: Started PAC autoconfigured proxy for use through http_proxy= environment variables.
Nov 28 10:37:10  systemd-resolved[860]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Nov 28 10:37:11  systemd-resolved[860]: message repeated 3 times: [ Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.]
Nov 28 10:38:05  pac4cli[3788]: Unhandled Error
Nov 28 10:38:05  pac4cli[3788]: Traceback (most recent call last):
Nov 28 10:38:05  pac4cli[3788]:   File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
Nov 28 10:38:05  pac4cli[3788]:     exec(code, run_globals)
Nov 28 10:38:05  pac4cli[3788]:   File "/usr/lib/python3/dist-packages/pac4cli/__main__.py", line 145, in <module>
Nov 28 10:38:05  pac4cli[3788]:     reactor.run()
Nov 28 10:38:05  pac4cli[3788]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
Nov 28 10:38:05  pac4cli[3788]:     self.mainLoop()
Nov 28 10:38:05  pac4cli[3788]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
Nov 28 10:38:05  pac4cli[3788]:     self.runUntilCurrent()
Nov 28 10:38:05  pac4cli[3788]: --- <exception caught here> ---
Nov 28 10:38:05  pac4cli[3788]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 851, in runUntilCurrent
Nov 28 10:38:05  pac4cli[3788]:     f(*a, **kw)
Nov 28 10:38:05  pac4cli[3788]:   File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 627, in stop
Nov 28 10:38:05  pac4cli[3788]:     "Can't stop reactor that isn't running.")
Nov 28 10:38:05  pac4cli[3788]: twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't running.
Nov 28 10:38:05  pac4cli[3788]: ['127.0.0.1']
Nov 28 10:38:05  systemd[1]: pac4cli.service: Service hold-off time over, scheduling restart.
Nov 28 10:38:05  systemd[1]: pac4cli.service: Scheduled restart job, restart counter is at 2.
Nov 28 10:38:05  systemd[1]: Stopped PAC autoconfigured proxy for use through http_proxy= environment variables.
Nov 28 10:38:05  systemd[1]: Started PAC autoconfigured proxy for use through http_proxy= environment variables.
Nov 28 10:38:06  systemd-resolved[860]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Nov 28 10:38:06  systemd-resolved[860]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.

When I looked at running processes (using htop), I noticed there were several instances of pac4cli running.

I suspect pac4cli crashed somehow or just misbehaved, and then systemd (or something else) spawned a new process, which also crashed, which spawned a new process… Until I had about a dozen pac4cli processes and then the entire system started to degenerate with The maximum number of active connections for UID 0 has been reached messages.

Nov 28 10:22:29  dbus-daemon[1128]: [system] Connection has not authenticated soon enough, closing it (auth_timeout=30000ms, elapsed: 30002ms)
Nov 28 10:22:31  dbus-daemon[1128]: [system] Connection has not authenticated soon enough, closing it (auth_timeout=30000ms, elapsed: 30001ms)
Nov 28 10:22:33  NetworkManager[1187]: <info>  [1543396953.2148] audit: op="connection-activate" uuid="…" name="…" pid=2249 uid=1000 result="success"
Nov 28 10:22:33  NetworkManager[1187]: <info>  [1543396953.2242] vpn-connection[0x55f59cc0c500,…,"…",0]: Started the VPN service, PID 310
Nov 28 10:22:33  dbus-daemon[1128]: [system] The maximum number of active connections for UID 0 has been reached (max_connections_per_user=256)
Nov 28 10:22:35  dbus-daemon[1128]: [system] Connection has not authenticated soon enough, closing it (auth_timeout=30000ms, elapsed: 30002ms)
Nov 28 10:22:37  NetworkManager[1187]: <warn>  [1543396957.9902] vpn-connection[0x55f59cc0c500,…,"…",0]: Timed out waiting for the service to start
Nov 28 10:22:38  dbus-daemon[1128]: [system] Connection has not authenticated soon enough, closing it (auth_timeout=30000ms, elapsed: 30001ms)
Nov 28 10:22:38  dbus-daemon[1128]: [system] Connection has not authenticated soon enough, closing it (auth_timeout=30000ms, elapsed: 30000ms)
Nov 28 10:22:38  dbus-daemon[1128]: [system] Connection has not authenticated soon enough, closing it (auth_timeout=30000ms, elapsed: 30000ms)
Nov 28 10:22:46  NetworkManager[1187]: <info>  [1543396966.3281] audit: op="connection-activate" uuid="…" name="…" pid=2249 uid=1000 result="success"
Nov 28 10:22:46  NetworkManager[1187]: <info>  [1543396966.3683] vpn-connection[0x55f59cc0c700,…,"…",0]: Started the VPN service, PID 317
Nov 28 10:22:46  dbus-daemon[1128]: [system] The maximum number of active connections for UID 0 has been reached (max_connections_per_user=256)
Nov 28 10:22:51  NetworkManager[1187]: <warn>  [1543396971.9913] vpn-connection[0x55f59cc0c700,…,"…",0]: Timed out waiting for the service to start
Nov 28 10:23:23  NetworkManager[1187]: <info>  [1543397003.2327] audit: op="connection-activate" uuid="…" name="…" pid=2249 uid=1000 result="success"
Nov 28 10:23:23  NetworkManager[1187]: <info>  [1543397003.2470] vpn-connection[0x55f59cc0c700,…,"…",0]: Started the VPN service, PID 389
Nov 28 10:23:23  dbus-daemon[1128]: [system] The maximum number of active connections for UID 0 has been reached (max_connections_per_user=256)
Nov 28 10:23:28  NetworkManager[1187]: <warn>  [1543397008.9916] vpn-connection[0x55f59cc0c700,…,"…",0]: Timed out waiting for the service to start

Nov 28 10:27:01  dbus-daemon[1128]: [system] Activating service name='org.debian.apt' requested by ':1.1004' (uid=1000 pid=535 comm="/usr/bin/python3 /usr/bin/update-manager " label="unconfined") (using servicehelper)
Nov 28 10:27:02  AptDaemon: INFO: Initializing daemon
Nov 28 10:27:02  org.debian.apt[1128]: 10:27:02 AptDaemon [INFO]: Initializing daemon
Nov 28 10:27:02  dbus-daemon[1128]: [system] The maximum number of active connections for UID 0 has been reached (max_connections_per_user=256)
Nov 28 10:27:02  org.debian.apt[1128]: Traceback (most recent call last):
Nov 28 10:27:02  org.debian.apt[1128]:   File "/usr/sbin/aptd", line 39, in <module>
Nov 28 10:27:02  org.debian.apt[1128]:     aptdaemon.core.main()
Nov 28 10:27:02  org.debian.apt[1128]:   File "/usr/lib/python3/dist-packages/aptdaemon/core.py", line 2178, in main
Nov 28 10:27:02  org.debian.apt[1128]:     daemon = AptDaemon(options, bus=bus)
Nov 28 10:27:02  org.debian.apt[1128]:   File "/usr/lib/python3/dist-packages/aptdaemon/core.py", line 1416, in __init__
Nov 28 10:27:02  org.debian.apt[1128]:     bus = dbus.SystemBus()
Nov 28 10:27:02  org.debian.apt[1128]:   File "/usr/lib/python3/dist-packages/dbus/_dbus.py", line 194, in __new__
Nov 28 10:27:02  org.debian.apt[1128]:     private=private)
Nov 28 10:27:02  org.debian.apt[1128]:   File "/usr/lib/python3/dist-packages/dbus/_dbus.py", line 100, in __new__
Nov 28 10:27:02  org.debian.apt[1128]:     bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
Nov 28 10:27:02  org.debian.apt[1128]:   File "/usr/lib/python3/dist-packages/dbus/bus.py", line 122, in __new__
Nov 28 10:27:02  org.debian.apt[1128]:     bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
Nov 28 10:27:02  org.debian.apt[1128]: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.LimitsExceeded: The maximum number of active connections for UID 0 has been reached
Nov 28 10:27:02  dbus-daemon[1128]: [system] Activated service 'org.debian.apt' failed: Launch helper exited with unknown return code 1
Nov 28 10:27:41  dbus-daemon[1128]: [system] The maximum number of active connections for UID 0 has been reached (max_connections_per_user=256)

Nov 28 10:29:57  dbus-daemon[1128]: [system] Reloaded configuration
Nov 28 10:29:58  systemd[1]: Reexecuting.
Nov 28 10:29:58  kernel: [373387.899583] systemd: 35 output lines suppressed due to ratelimiting
Nov 28 10:29:58  kernel: [373387.908379] systemd[1]: systemd 237 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
Nov 28 10:29:58  kernel: [373387.908807] systemd[1]: Detected architecture x86-64.
Nov 28 10:29:58  dbus-daemon[1128]: [system] The maximum number of active connections for UID 0 has been reached (max_connections_per_user=256)
Nov 28 10:29:58  kernel: [373387.968634] systemd[1]: Failed to get initial list of names: No buffer space available
Nov 28 10:29:58  kernel: [373387.968640] systemd[1]: Failed to set up API bus: No buffer space available
Nov 28 10:29:58  kernel: [373387.968644] systemd[1]: Error occured during D-Bus APIs initialization: No buffer space available
Nov 28 10:29:58  kernel: [373387.968734] systemd[1]: Failed to register Manager vtable: File exists
Nov 28 10:29:58  kernel: [373387.968737] systemd[1]: Failed to set up API bus: File exists
Nov 28 10:29:58  kernel: [373387.968740] systemd[1]: Error occured during D-Bus APIs initialization: File exists
Nov 28 10:29:58  systemd[1]: Starting resolvconf-pull-resolved.service...
Nov 28 10:29:58  systemd[1]: Started resolvconf-pull-resolved.service.
Nov 28 10:30:02  dbus-daemon[1128]: [system] The maximum number of active connections for UID 0 has been reached (max_connections_per_user=256)
Nov 28 10:35:36  dbus-daemon[1128]: [system] The maximum number of active connections for UID 0 has been reached (max_connections_per_user=256)
Nov 28 10:36:06  dbus-daemon[1128]: [system] Connection has not authenticated soon enough, closing it (auth_timeout=30000ms, elapsed: 30003ms)
Nov 28 10:36:06  dbus-daemon[1128]: [system] The maximum number of active connections for UID 0 has been reached (max_connections_per_user=256)
Nov 28 10:36:36  dbus-daemon[1128]: [system] Connection has not authenticated soon enough, closing it (auth_timeout=30000ms, elapsed: 30000ms)
Nov 28 10:36:36  dbus-daemon[1128]: [system] The maximum number of active connections for UID 0 has been reached (max_connections_per_user=256)

At that point, I couldn't start/stop/restart services, some stuff just did not work (e.g. apt upgrade just hung when trying to update grub, and OpenVPN failed to connect), and I had to restart the entire system.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.