Skip to content

Commit

Permalink
Add private / public key generation utils which comply with new requi…
Browse files Browse the repository at this point in the history
…rements on Mac OS 10.15 (#160)

* Add utilities to generate private key and public keys with alternate cnames

* Add separate package proxy.py-plugins, fixes #156

* Generate certificates to comply with Mac requirements.

* Add utility for CSR generation and signing

* Fixes #161

* Add initial pki tests
  • Loading branch information
abhinavsingh committed Nov 12, 2019
1 parent 93d8a55 commit 0cc4e5e
Show file tree
Hide file tree
Showing 13 changed files with 403 additions and 19 deletions.
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
coverage.xml
proxy.py.iml
*.pyc
ca-*.pem
https-*.pem

*.csr
*.crt
*.key

venv
cover
htmlcov
dist
build
proxy.py.egg-info

*.egg-info
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CA_SIGNING_KEY_FILE_PATH := ca-signing-key.pem
.PHONY: lib-clean lib-test lib-package lib-release-test lib-release lib-coverage lib-lint lib-profile
.PHONY: container container-run container-release
.PHONY: dashboard dashboard-clean dashboard-package
.PHONY: plugin-package-clean plugin-package

all: lib-clean lib-test

Expand Down Expand Up @@ -91,6 +92,12 @@ dashboard-package-clean:
dashboard-package: dashboard-package-clean
pushd dashboard && npm test && PYTHONPATH=.. python setup.py sdist bdist_wheel && popd

plugin-package-clean:
pushd plugin_examples && rm -rf build && rm -rf dist && popd

plugin-package: plugin-package-clean
pushd plugin_examples && PYTHONPATH=.. python setup.py sdist bdist_wheel && popd

container:
docker build -t $(LATEST_TAG) -t $(IMAGE_TAG) .

Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Table of Contents
* [Unable to connect with proxy.py from remote host](#unable-to-connect-with-proxypy-from-remote-host)
* [Basic auth not working with a browser](#basic-auth-not-working-with-a-browser)
* [Docker image not working on MacOS](#docker-image-not-working-on-macos)
* [Unable to load custom plugins](#unable-to-load-custom-plugins)
* [Unable to load plugins](#unable-to-load-plugins)
* [ValueError: filedescriptor out of range in select](#valueerror-filedescriptor-out-of-range-in-select)
* [Flags](#flags)
* [Changelog](#changelog)
Expand Down Expand Up @@ -129,8 +129,9 @@ Features
- Can decrypt TLS traffic between clients and upstream servers
- See [TLS Interception](#tls-interception)
- Supported proxy protocols
- `http`
- `https`
- `http(s)`
- `http1`
- `http1.1` pipeline
- `http2`
- `websockets`
- Optimized for large file uploads and downloads
Expand Down Expand Up @@ -968,9 +969,9 @@ See [moby/vpnkit exhausts docker resources](https://github.com/abhinavsingh/prox
and [Connection refused: The proxy could not connect](https://github.com/moby/vpnkit/issues/469)
for some background.

## Unable to load custom plugins
## Unable to load plugins

Make sure your plugin modules are discoverable by adding them to `PYTHONPATH`. Example:
Make sure plugin modules are discoverable by adding them to `PYTHONPATH`. Example:

`PYTHONPATH=/path/to/my/app proxy --plugins my_app.proxyPlugin`

Expand All @@ -983,6 +984,8 @@ or, make sure to pass fully-qualified path as parameter, e.g.

`proxy --plugins /path/to/my/app/my_app.proxyPlugin`

Note that `pip install proxy.py` don't ship [plugin_examples](https://github.com/abhinavsingh/proxy.py/blob/develop/plugin_examples).

## GCE log viewer integration for proxy.py

A starter [fluentd.conf](https://github.com/abhinavsingh/proxy.py/blob/develop/fluentd.conf)
Expand Down
2 changes: 0 additions & 2 deletions dashboard/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ tsbuild
node_modules
build
dist

proxy.py_dashboard.egg-info
File renamed without changes.
6 changes: 3 additions & 3 deletions dashboard/src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ class ApiDevelopment {
}

class WebsocketApi {
private hostname: string = 'localhost';
private port: number = 8899;
private hostname: string = window.location.hostname ? window.location.hostname : 'localhost';
private port: number = window.location.port ? Number(window.location.port) : 8899;
private wsPrefix: string = '/dashboard';
private wsScheme: string = 'ws';
private wsScheme: string = window.location.protocol === 'http:' ? 'ws' : 'wss';
private ws: WebSocket;
private wsPath: string = this.wsScheme + '://' + this.hostname + ':' + this.port + this.wsPrefix;

Expand Down
1 change: 1 addition & 0 deletions plugin_examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Proxy.py Plugins
84 changes: 84 additions & 0 deletions plugin_examples/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Programmable, TLS interception capable
proxy server for Application debugging, testing and development.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
"""
from setuptools import setup, find_packages

from proxy.common.constants import __author__, __author_email__
from proxy.common.constants import __homepage__, __description__, __download_url__, __license__

VERSION = (0, 1, 0)
__version__ = '.'.join(map(str, VERSION[0:3]))

setup(
name='proxy.py-plugins',
version=__version__,
author=__author__,
author_email=__author_email__,
url=__homepage__,
description=__description__,
long_description=open('README.md').read().strip(),
long_description_content_type='text/markdown',
download_url=__download_url__,
license=__license__,
packages=find_packages(),
install_requires=['proxy.py'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Environment :: No Input/Output (Daemon)',
'Environment :: Web Environment',
'Environment :: MacOS X',
'Environment :: Plugins',
'Environment :: Win32 (MS Windows)',
'Framework :: Robot Framework',
'Framework :: Robot Framework :: Library',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: System Administrators',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: MacOS',
'Operating System :: MacOS :: MacOS 9',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Operating System :: POSIX :: Linux',
'Operating System :: Unix',
'Operating System :: Microsoft',
'Operating System :: Microsoft :: Windows',
'Operating System :: Microsoft :: Windows :: Windows 10',
'Operating System :: Android',
'Operating System :: OS Independent',
'Programming Language :: Python :: Implementation',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Internet',
'Topic :: Internet :: Proxy Servers',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Browsers',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries',
'Topic :: Internet :: WWW/HTTP :: HTTP Servers',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Software Development :: Debuggers',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Monitoring',
'Topic :: System :: Networking',
'Topic :: System :: Networking :: Firewalls',
'Topic :: System :: Networking :: Monitoring',
'Topic :: Utilities',
'Typing :: Typed',
],
)
9 changes: 5 additions & 4 deletions proxy/common/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,11 @@ def init_parser() -> argparse.ArgumentParser:
action='store_true',
default=DEFAULT_ENABLE_WEB_SERVER,
help='Default: False. Whether to enable proxy.HttpWebServerPlugin.')
parser.add_argument('--hostname',
type=str,
default=str(DEFAULT_IPV6_HOSTNAME),
help='Default: ::1. Server IP address.')
parser.add_argument(
'--hostname',
type=str,
default=str(DEFAULT_IPV6_HOSTNAME),
help='Default: ::1. Server IP address.')
parser.add_argument(
'--key-file',
type=str,
Expand Down
Loading

0 comments on commit 0cc4e5e

Please sign in to comment.