px-proxy 0.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017-2025 Ganesh Viswanathan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,647 @@
1
+ Metadata-Version: 2.2
2
+ Name: px-proxy
3
+ Version: 0.10.0
4
+ Summary: An HTTP proxy server to automatically authenticate through an NTLM proxy
5
+ Author-email: Ganesh Viswanathan <dev@genotrance.com>
6
+ Project-URL: Homepage, https://github.com/genotrance/px
7
+ Project-URL: Repository, https://github.com/genotrance/px
8
+ Project-URL: Issues, https://github.com/genotrance/px/issues
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Win32 (MS Windows)
11
+ Classifier: Environment :: MacOS X
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Natural Language :: English
17
+ Classifier: Operating System :: MacOS :: MacOS X
18
+ Classifier: Operating System :: Microsoft :: Windows
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
+ Classifier: Topic :: Internet :: Proxy Servers
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE.txt
29
+ Requires-Dist: keyring
30
+ Requires-Dist: netaddr
31
+ Requires-Dist: psutil
32
+ Requires-Dist: pymcurl
33
+ Requires-Dist: pyspnego
34
+ Requires-Dist: python-dotenv
35
+ Requires-Dist: quickjs
36
+
37
+ [![Chat on Gitter](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/genotrance/px)
38
+ [![Chat on Matrix](https://img.shields.io/matrix/genotrance_px:matrix.org)](https://matrix.to/#/#genotrance_px:matrix.org)
39
+
40
+ # Px
41
+
42
+ ## What is Px?
43
+ Px is a HTTP(s) proxy server that allows applications to authenticate through
44
+ an NTLM or Kerberos proxy server, typically used in corporate deployments,
45
+ without having to deal with the actual handshake. Px leverages Windows SSPI or
46
+ single sign-on and automatically authenticates using the currently logged in
47
+ Windows user account. It is also possible to run Px on Windows, Linux and MacOS
48
+ without single sign-on by configuring the domain, username and password to
49
+ authenticate with.
50
+
51
+ Px uses libcurl and as a result supports all the authentication mechanisms
52
+ supported by [libcurl](https://curl.se/libcurl/c/CURLOPT_HTTPAUTH.html).
53
+
54
+ ## Installation
55
+
56
+ The whole point of Px is to help tools get through a typical corporate proxy.
57
+ This means using a package manager to install Px might not always be feasible
58
+ which is why Px offers two binary options:
59
+ - If Python is already available, Px and all its dependencies can be easily
60
+ installed by downloading the `wheels` package for the target OS from the
61
+ [releases](https://github.com/genotrance/px/releases) page. After extraction,
62
+ Px and all dependencies can be installed with `pip`:
63
+
64
+ `python -m pip install px-proxy --no-index -f /path/to/wheels`
65
+
66
+ - If Python is not available, get the latest compiled binary from the
67
+ [releases](https://github.com/genotrance/px/releases) page instead. The Windows
68
+ binary is built using Python Embedded and the Mac and Linux binaries are compiled
69
+ with [Nuitka](https://nuitka.net) and contain everything needed to run standalone.
70
+
71
+ If direct internet access is available along with Python, Px can be easily
72
+ installed using the Python package manager `pip`. This will download and install
73
+ Px as a Python module along with all dependencies:
74
+
75
+ python -m pip install px-proxy
76
+
77
+ On Windows, `scoop` can also be used to install Px:
78
+
79
+ scoop install px
80
+
81
+ Once installed, Px can be run as follows:
82
+ - Running `px` directly
83
+ - In the background: `pythonw -m px`
84
+ - In the foreground in a console window: `python -m px`
85
+
86
+ ### Source install
87
+
88
+ The latest Px version can be downloaded and installed from source via pip:
89
+
90
+ python -m pip install https://github.com/genotrance/px/archive/master.zip
91
+
92
+ Source can also be downloaded and installed:
93
+
94
+ - Via git:
95
+
96
+ `git clone https://github.com/genotrance/px`
97
+
98
+ - Download [ZIP](https://github.com/genotrance/px/archive/master.zip):
99
+
100
+ `https://github.com/genotrance/px/archive/master.zip`
101
+
102
+ Once downloaded, Px can be installed as a standard Python module along with all
103
+ dependencies :
104
+
105
+ python -m pip install .
106
+
107
+ NOTE: Source install methods will require internet access since Python will try
108
+ to install Px dependencies from the internet. The binaries mentioned in the
109
+ previous section could be used to bootstrap a source install.
110
+
111
+ ### Without installation
112
+
113
+ Px can be run as a local Python script without installation. Download the source
114
+ as described above, install all dependencies and then run Px:
115
+
116
+ ```
117
+ pip install keyring netaddr psutil pymcurl pyspnego python-dotenv quickjs
118
+
119
+ pythonw px.py # run in the background
120
+ python px.py # run in a console window
121
+ ```
122
+
123
+ ### Uninstallation
124
+
125
+ If Px has been installed to the Windows registry to start on boot, it should be
126
+ uninstalled before removal:
127
+
128
+ python -m px --uninstall
129
+
130
+ Px can then be uninstalled using `pip` as follows:
131
+
132
+ python -m pip uninstall px-proxy
133
+
134
+ ## Docker
135
+
136
+ Px is available as a prebuilt Docker [image](https://hub.docker.com/r/genotrance/px).
137
+
138
+ Two images are posted - the default includes keyring and associated dependencies
139
+ whereas the mini version is smaller but will have to depend on `PX_PASSWORD` and
140
+ `PX_CLIENT_PASSWORD` for credentials.
141
+
142
+ The following Docker flags will be useful to configure and run Px:
143
+ ```
144
+ --name px name container so it is easy to stop it
145
+ -d run in the background
146
+ --rm remove container on exit
147
+ ```
148
+
149
+ #### Networking
150
+ ```
151
+ --network host make Px directly accessible from host network
152
+ OR
153
+ -p 3128:3128 publish the port - Px needs to run in --gateway mode
154
+ ```
155
+
156
+ #### Configuration
157
+ ```
158
+ -e PX_LOG=4 set environment variables to configure Px
159
+
160
+ -v /dir:/px mount a host directory with a px.ini or .env file to configure Px
161
+ OR
162
+ --mount source=/dir,target=/px
163
+ mount a volume if preferred
164
+
165
+ docker run ... genotrance/px --gateway --verbose
166
+ configure directly from the command line
167
+ ```
168
+
169
+ #### Credentials
170
+
171
+ Keyring credentials can be stored in a host folder and mounted into the container
172
+ as follows:
173
+ ```
174
+ -v /keyrings:/root/.local/share/keyrings
175
+ mount a local dir to store keyring info
176
+ OR
177
+ --mount source=/keyrings,target=/root/.local/share/keyrings
178
+ mount a volume if preferred
179
+ ```
180
+
181
+ Credentials can be saved using the command line:
182
+ ```
183
+ docker run ... genotrance/px --username=... --password
184
+ configure keyring directly from the command line
185
+ ```
186
+
187
+ The mini version does not have keyring so credentials need to be set using environment
188
+ variables:
189
+ ```
190
+ -e PX_PASSWORD=... -e PX_CLIENT_PASSWORD=...
191
+ set environment variables to configure credentials
192
+ ```
193
+
194
+ ## Configuration
195
+
196
+ Px requires only one piece of information in order to function - the server
197
+ name and port of the proxy server. If not specified, Px will check `Internet
198
+ Options` or environment variables for any proxy definitions. Without this, Px
199
+ will try to connect to sites directly.
200
+
201
+ The `noproxy` capability allows Px to connect to configured hosts directly,
202
+ bypassing the proxy altogether. This allows clients to connect to hosts within
203
+ the intranet without requiring additional configuration for each client or at
204
+ the proxy.
205
+
206
+ Configuration can be specified in multiple ways, listed in order of precedence:
207
+ - Command line flags
208
+ - Environment variables
209
+ - Variables in a dotenv file (.env)
210
+ - In the working directory
211
+ - In the Px directory
212
+ - Configuration file `px.ini`
213
+ - In the working directory
214
+ - In the Px directory
215
+
216
+ There are many configuration options to tweak - refer to the [Usage](#usage)
217
+ section or `--help` for details and syntax.
218
+
219
+ ### Credentials
220
+
221
+ If SSPI is not available or not preferred, providing `--username` in `domain\username`
222
+ format allows Px to authenticate as that user. The corresponding password is
223
+ retrieved using Python keyring and needs to be setup in the appropriate OS
224
+ specific backend.
225
+
226
+ Credentials can be setup with the command line:
227
+
228
+ px --username=domain\username --password
229
+
230
+ If username is already defined with `PX_USERNAME` or in `px.ini`:
231
+
232
+ px --password
233
+
234
+ Information on keyring backends can be found [here](https://pypi.org/project/keyring).
235
+
236
+ As an alternative, Px can also load credentials from the environment variable
237
+ `PX_PASSWORD` or a dotenv file. This is only recommended when keyring is not
238
+ available.
239
+
240
+ #### Windows
241
+
242
+ Credential Manager is the recommended backend for Windows and the password is
243
+ stored as a 'Generic Credential' type with 'Px' as the network address name.
244
+ Credential Manager can be accessed as follows:
245
+
246
+ Control Panel > User Accounts > Credential Manager > Windows Credentials
247
+
248
+ Or on the command line: `rundll32.exe keymgr.dll, KRShowKeyMgr`
249
+
250
+ #### Mac
251
+
252
+ Keychain Access is used to store to passwords on Mac.
253
+ - Pick 'Passwords' on the top menu and 'login' on the left menu
254
+ - Add a new keychain item for 'Px' and 'PxClient' as needed
255
+
256
+ The first time Px tries to access the passwords, it will prompt to unlock the
257
+ keychain. Select 'Always Allow' to give Px access indefinitely.
258
+
259
+ On the command line, the 'security' tool can be used to manage credentials:
260
+
261
+ security add-generic-password -s Px -a username -w password
262
+
263
+ #### Linux
264
+
265
+ Gnome Keyring or KWallet is used to store passwords on Linux.
266
+
267
+ For systems without a GUI (headless, docker), D-Bus can be started interactively:
268
+
269
+ dbus-run-session -- sh
270
+
271
+ If this needs to be done in a script:
272
+
273
+ export DBUS_SESSION_BUS_ADDRESS=`dbus-daemon --fork --config-file=/usr/share/dbus-1/session.conf --print-address`
274
+
275
+ Gnome Keyring can then be unlocked as follows:
276
+
277
+ echo 'somecredstorepass' | gnome-keyring-daemon --unlock
278
+
279
+ If the default SecretService keyring backend does not work, a third-party
280
+ [backend](https://github.com/jaraco/keyring#third-party-backends) might be
281
+ required. Simply install and configure one and `keyring` will use it. Remember
282
+ to specify the environment variables they require before starting Px.
283
+
284
+ This will not work for the Nuitka binaries so as a fallback, `PX_PASSWORD` can
285
+ be used instead to set credentials.
286
+
287
+ ### Client authentication
288
+
289
+ Px is useful to authenticate with the upstream proxy server on behalf of clients
290
+ but it can also authenticate the client that connects to it if needed. This can
291
+ be useful in `gateway` mode where remote clients should log in before accessing
292
+ the upstream proxy via Px. `BASIC` and `DIGEST` auth are supported, along with
293
+ `NTLM` and `NEGOTIATE`.
294
+
295
+ The client credentials can be different from the upstream proxy credentials or
296
+ the same if preferred. SSPI is also supported on Windows and can be leveraged
297
+ for only the client or upstream or both.
298
+
299
+ Client authentication is turned off by default and can be enabled using
300
+ `--client-auth`, `PX_CLIENT_AUTH` or `px.ini`. Setting the value to `ANYSAFE` is
301
+ recommended.
302
+
303
+ Similar to the upstream proxy, the client username can be configured with
304
+ `--client-username`, `PX_CLIENT_USERNAME` or `px.ini` The password can be setup
305
+ in keyring using `PxClient` as the network address name. `PX_CLIENT_PASSWORD` is
306
+ available for cases where keyring is not available.
307
+
308
+ SSPI is enabled by default on Windows and can be disabled with `--client-nosspi`,
309
+ `PX_CLIENT_NOSSPI` or in `px.ini`.
310
+
311
+ Client credentials can be setup in keyring with the command line:
312
+
313
+ px --client-username=domain\username --client-password
314
+
315
+ Px only supports one credential for the upstream proxy but can be configured to
316
+ support multiple client users when keyring is used. Each user should be added to
317
+ keyring with the `PxClient` network address.
318
+
319
+ Using an upstream proxy is not required so Px can also be used simply as an
320
+ authenticating proxy for smaller setups.
321
+
322
+ ### Misc
323
+
324
+ The configuration file `px.ini` can be created or updated from the command line
325
+ using `--save`.
326
+
327
+ The binary distribution of Px runs in the background once started and can be
328
+ quit by running `px --quit`. When running in the foreground, use `CTRL-C`.
329
+
330
+ Px can also be setup to automatically run on startup on Windows with the
331
+ `--install` flag. This is done by adding an entry into the Window registry which
332
+ can be removed with `--uninstall`.
333
+
334
+ NOTE: Command line parameters passed with `--install` are not saved for use on
335
+ startup. The `--save` flag or manual editing of `px.ini` is required to provide
336
+ configuration to Px on startup.
337
+
338
+ NOTE: When using the Px binary distribution on Windows, run `.\pythonw -m px --install`
339
+ instead of using `px.exe`. This will avoid the popup console window on startup.
340
+
341
+ ## Usage
342
+
343
+ ```
344
+ px [FLAGS]
345
+ python px.py [FLAGS]
346
+ python -m px [FLAGS]
347
+
348
+ Actions:
349
+ --save
350
+ Save configuration to file specified with --config or px.ini in working directory
351
+ Allows setting up Px config directly from command line
352
+ Values specified on CLI override any values in existing config file
353
+ Values not specified on CLI or config file are set to defaults
354
+
355
+ --install
356
+ Add Px to the Windows registry to run on startup
357
+
358
+ --uninstall
359
+ Remove Px from the Windows registry
360
+
361
+ --quit
362
+ Quit a running instance of Px
363
+
364
+ --restart
365
+ Quit a running instance of Px and start a new instance
366
+
367
+ --password | PX_PASSWORD
368
+ Collect and save password to default keyring. Username needs to be provided
369
+ via --username, PX_USERNAME or in the config file.
370
+ As an alternative, Px can also load credentials from the environment variable
371
+ `PX_PASSWORD` or a dotenv file.
372
+
373
+ --client-password | PX_CLIENT_PASSWORD
374
+ Collect and save password to default keyring. Username needs to be provided
375
+ via --client-username, PX_CLIENT_USERNAME or in the config file.
376
+ As an alternative, Px can also load credentials from the environment variable
377
+ `PX_CLIENT_PASSWORD` or a dotenv file.
378
+
379
+ --test=URL | --test
380
+ Test Px as configured with the URL specified. This can be used to confirm that
381
+ Px is configured correctly and is able to connect and authenticate with the
382
+ upstream proxy. If URL is skipped, Px runs multiple tests against httpbin.org.
383
+
384
+ Configuration:
385
+ --config= | PX_CONFIG=
386
+ Specify config file. Valid file path, default: px.ini in working directory
387
+ or script directory
388
+
389
+ --proxy= --server= | PX_SERVER= | proxy:server=
390
+ NTLM server(s) to connect through. IP:port, hostname:port
391
+ Multiple proxies can be specified comma separated. Px will iterate through
392
+ and use the one that works
393
+
394
+ --pac= | PX_PAC= | proxy:pac=
395
+ PAC file to use to connect
396
+ Use in place of --server if PAC file should be loaded from a URL or local
397
+ file. Relative paths will be relative to the Px script or binary
398
+
399
+ --pac_encoding= | PX_PAC_ENCODING= | proxy:pac_encoding=
400
+ PAC file encoding
401
+ Specify in case default 'utf-8' encoding does not work
402
+
403
+ --listen= | PX_LISTEN= | proxy:listen=
404
+ Network interface(s) to listen on. Comma separated, default: 127.0.0.1
405
+ --gateway and --hostonly override this to bind to all interfaces
406
+
407
+ --port= | PX_PORT= | proxy:port=
408
+ Port to run this proxy on - default: 3128
409
+
410
+ --gateway | PX_GATEWAY= | proxy:gateway=
411
+ Allow remote machines to use proxy. 0 or 1, default: 0
412
+ Overrides --listen and binds to all interfaces
413
+
414
+ --hostonly | PX_HOSTONLY= | proxy:hostonly=
415
+ Allow only local interfaces to use proxy. 0 or 1, default: 0
416
+ Px allows all IP addresses assigned to local interfaces to use the service.
417
+ This allows local apps as well as VM or container apps to use Px when in a
418
+ NAT config. Overrides --listen and binds to all interfaces, overrides the
419
+ default --allow rules
420
+
421
+ --allow= | PX_ALLOW= | proxy:allow=
422
+ Allow connection from specific subnets. Comma separated, default: *.*.*.*
423
+ Whitelist which IPs can use the proxy. --hostonly overrides any definitions
424
+ unless --gateway mode is also specified
425
+ 127.0.0.1 - specific ip
426
+ 192.168.0.* - wildcards
427
+ 192.168.0.1-192.168.0.255 - ranges
428
+ 192.168.0.1/24 - CIDR
429
+
430
+ --noproxy= | PX_NOPROXY= | proxy:noproxy=
431
+ Direct connect to specific subnets or domains like a regular proxy. Comma separated
432
+ Skip the NTLM proxy for connections to these hosts
433
+ 127.0.0.1 - specific ip
434
+ 192.168.0.* - wildcards
435
+ 192.168.0.1-192.168.0.255 - ranges
436
+ 192.168.0.1/24 - CIDR
437
+ example.com - domains
438
+
439
+ --useragent= | PX_USERAGENT= | proxy:useragent=
440
+ Override or send User-Agent header on client's behalf
441
+
442
+ --username= | PX_USERNAME= | proxy:username=
443
+ Authentication to use when SSPI is unavailable. Format is domain\username
444
+ Service name "Px" and this username are used to retrieve the password using
445
+ Python keyring if available.
446
+
447
+ --auth= | PX_AUTH= | proxy:auth=
448
+ Force instead of discovering upstream proxy type
449
+ By default, Px will attempt to discover the upstream proxy type. This
450
+ option can be used to force either NEGOTIATE, NTLM, DIGEST, BASIC or the
451
+ other libcurl supported upstream proxy types. See:
452
+ https://curl.se/libcurl/c/CURLOPT_HTTPAUTH.html
453
+ To control which methods are available during proxy detection:
454
+ Prefix NO to avoid method - e.g. NONTLM => ANY - NTLM
455
+ Prefix SAFENO to avoid method - e.g. SAFENONTLM => ANYSAFE - NTLM
456
+ Prefix ONLY to support only that method - e.g ONLYNTLM => ONLY + NTLM
457
+ Set to NONE to defer all authentication to the client. This allows multiple
458
+ instances of Px to be chained together to access an upstream proxy that is not
459
+ directly connected:
460
+ Client -> Auth Px -> no-Auth Px -> Upstream proxy
461
+ 'Auth Px' cannot directly access upstream proxy but 'no-Auth Px' can
462
+
463
+ --client-username= | PX_CLIENT_USERNAME= | client:client_username=
464
+ Client authentication to use when SSPI is unavailable. Format is domain\username
465
+ Service name "PxClient" and this username are used to retrieve the password using
466
+ Python keyring if available.
467
+
468
+ --client-auth= | PX_CLIENT_AUTH= | client:client_auth=
469
+ Enable authentication for client connections. Comma separated, default: NONE
470
+ Mechanisms supported: NEGOTIATE, NTLM, DIGEST, BASIC
471
+ ANY = enable all supported mechanisms
472
+ ANYSAFE = enable all supported mechanisms except BASIC
473
+ NTLM = enable only NTLM, etc.
474
+ NONE = disable client authentication altogether (default)
475
+
476
+ --client-nosspi= | PX_CLIENT_NOSSPI= | client:client_nosspi=
477
+ Disable SSPI for client authentication on Windows. default: 0
478
+ Set to 1 to disable SSPI and use the configured username and password
479
+
480
+ --workers= | PX_WORKERS= | settings:workers=
481
+ Number of parallel workers (processes). Valid integer, default: 2
482
+
483
+ --threads= | PX_THREADS= | settings:threads=
484
+ Number of parallel threads per worker (process). Valid integer, default: 32
485
+
486
+ --idle= | PX_IDLE= | settings:idle=
487
+ Idle timeout in seconds for HTTP connect sessions. Valid integer, default: 30
488
+
489
+ --socktimeout= | PX_SOCKTIMEOUT= | settings:socktimeout=
490
+ Timeout in seconds for connections before giving up. Valid float, default: 20
491
+
492
+ --proxyreload= | PX_PROXYRELOAD= | settings:proxyreload=
493
+ Time interval in seconds before refreshing proxy info. Valid int, default: 60
494
+ Proxy info reloaded from manual proxy info defined in Internet Options
495
+
496
+ --foreground | PX_FOREGROUND= | settings:foreground=
497
+ Run in foreground when compiled or run with pythonw.exe. 0 or 1, default: 0
498
+ Px will attach to the console and write to it even though the prompt is
499
+ available for further commands. CTRL-C in the console will exit Px
500
+
501
+ --log= | PX_LOG= | settings:log=
502
+ Enable debug logging. default: 0
503
+ 1 = Log to script dir [--debug]
504
+ 2 = Log to working dir
505
+ 3 = Log to working dir with unique filename [--uniqlog]
506
+ 4 = Log to stdout [--verbose]. Implies --foreground
507
+ If Px crashes without logging, traceback is written to the working dir
508
+ ```
509
+
510
+ ## Examples
511
+
512
+ Use `proxyserver.com:80` and allow requests from localhost only:
513
+
514
+ px --proxy=proxyserver.com:80
515
+
516
+ Don't use any forward proxy at all, just log what's going on:
517
+
518
+ px --noproxy=0.0.0.0/0 --debug
519
+
520
+ Allow requests from `localhost` and all locally assigned IP addresses. This
521
+ is very useful for Docker for Windows and VMs in a NAT configuration because
522
+ all requests originate from the host's IP:
523
+
524
+ px --proxy=proxyserver.com:80 --hostonly
525
+
526
+ Allow requests from `localhost`, locally assigned IP addresses and the IPs
527
+ specified in the allow list outside the host:
528
+
529
+ px --proxy=proxyserver:80 --hostonly --gateway --allow=172.*.*.*
530
+
531
+ Allow requests from everywhere. Be careful, every client will use your login:
532
+
533
+ px --proxy=proxyserver.com:80 --gateway
534
+
535
+ NOTE: In Docker for Windows you need to set your proxy to
536
+ `http://host.docker.internal:3128` or `http://<your_ip>:3128` (or actual port
537
+ Px is listening to) in your containers and be aware of
538
+ https://github.com/docker/for-win/issues/1380.
539
+
540
+ Workaround:
541
+
542
+ docker build --build-arg http_proxy=http://<your ip>:3128 --build-arg https_proxy=http://<your ip>:3128 -t containername ../dir/with/Dockerfile
543
+
544
+ NOTE: In WSL2 you can setup your proxy in `/etc/profile` as follows:
545
+
546
+ ```
547
+ export http_proxy="http://$(tail -1 /etc/resolv.conf | cut -d' ' -f2):3128"
548
+ export https_proxy="http://$(tail -1 /etc/resolv.conf | cut -d' ' -f2):3128"
549
+ ```
550
+
551
+ NOTE: When running MQTT over websockets, it will help to increase the idle
552
+ timeout to 120 seconds: `--idle=120`. The default value of 30 will cause the
553
+ websocket connection to disconnect since the default MQTT keepalive period
554
+ is 60 seconds.
555
+
556
+ ## Dependencies
557
+
558
+ Px doesn't have any GUI and runs completely in the background. It depends on
559
+ the following Python packages:
560
+
561
+ - [keyring](https://pypi.org/project/keyring/)
562
+ - [netaddr](https://pypi.org/project/netaddr/)
563
+ - [pymcurl](https://pypi.org/project/pymcurl/)
564
+ - [psutil](https://pypi.org/project/psutil/)
565
+ - [pyspnego](https://pypi.org/project/pyspnego/)
566
+ - [python-dotenv](https://pypi.org/projects/python-dotenv/)
567
+ - [quickjs](https://pypi.org/project/quickjs/)
568
+
569
+ ## Limitations
570
+
571
+ Mac socket sharing is not implemented at this time and is limited to running
572
+ in a single process.
573
+
574
+ The `--hostonly` and `--quit` features do not work on Linux aarch64 systems.
575
+
576
+ ## Building
577
+
578
+ Px is a pure Python app but depends on several packages that have OS and
579
+ machine specific binaries. As a result, Px ships two kinds of binaries as
580
+ already mentioned in the installation section above.
581
+ - Wheels - all packages needed to install Px on supported versions of Python
582
+ - Binary - compiled binary using Python Embedded on Windows and Nuitka on Mac
583
+ and Linux
584
+
585
+ These binaries are provided for the following:
586
+ - Windows - amd64
587
+ - Mac - x86_64, arm64
588
+ - Linux - x86_64, aarch64 for glibc and musl based systems
589
+
590
+ To build the wheels package:
591
+
592
+ ./build.sh -b -d
593
+
594
+ To build the binary package:
595
+
596
+ ./build.sh -b -n
597
+
598
+ On Windows, [build.ps1](build.ps1) is provided to install the required dependencies using
599
+ `scoop`. It then calls [build.sh](build.sh) with the arguments provided.
600
+
601
+ Commands used to build all released artifacts:
602
+ ```bash
603
+ # Windows
604
+ # Builds wheels archive
605
+ # Builds embedded binary
606
+ .\build.ps1 -b
607
+
608
+ # Mac
609
+ # Builds wheels archive
610
+ # Builds Nuitka binary
611
+ ./build.sh -b
612
+
613
+ # Linux glibc systems
614
+ # Docker + manylinux container
615
+ # Builds wheels archive
616
+ # Builds Nuitka binary
617
+ ./build.sh -i glibc -b
618
+ ./build.sh -i glibc -a aarch64 -b
619
+
620
+ # Linux musl systems
621
+ # Docker + musllinux container
622
+ # Builds wheels archive
623
+ ./build.sh -i musl -b -d
624
+ ./build.sh -i musl -a aarch64 -b -d
625
+ # Docker + Alpine legacy container [#bug](https://github.com/Nuitka/Nuitka/issues/2625)
626
+ # Builds Nuitka binary
627
+ ./build.sh -i alpine:3.13 -b -n
628
+ ./build.sh -i alpine:3.13 -a aarch64 -b -n
629
+ ```
630
+
631
+ See [build.sh](build.sh) for more details.
632
+
633
+ ## Feedback
634
+
635
+ Px is definitely a work in progress and any feedback or suggestions are welcome.
636
+ It is hosted on [GitHub](https://github.com/genotrance/px) with an MIT license
637
+ so issues, forks and PRs are most appreciated. Join us on the
638
+ [discussion](https://github.com/genotrance/px/discussions) board,
639
+ [Gitter](https://gitter.im/genotrance/px) or
640
+ [Matrix](https://matrix.to/#/#genotrance_px:matrix.org) to chat about Px.
641
+
642
+ ## Credits
643
+
644
+ Thank you to all [contributors](https://github.com/genotrance/px/graphs/contributors)
645
+ for their PRs and all issue submitters.
646
+
647
+ Px is based on code from all over the internet and acknowledges innumerable sources.