mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
Merge branch 'reuse_key' into qa
This commit is contained in:
commit
9da6dd8f52
0
__init__.py
Normal file
0
__init__.py
Normal file
28
pyproject.toml
Normal file
28
pyproject.toml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
[project]
|
||||||
|
name = "warcprox"
|
||||||
|
authors = [
|
||||||
|
{ name="Noah Levitt", email="nlevitt@archive.org" },
|
||||||
|
]
|
||||||
|
maintainers = [
|
||||||
|
{ name="Vangelis Banos", email="vangelis@archive.org" },
|
||||||
|
{ name="Adam Miller", email="adam@archive.org" },
|
||||||
|
{ name="Barbara Miller", email="barbara@archive.org" },
|
||||||
|
{ name="Alex Dempsey", email="avdempsey@archive.org" },
|
||||||
|
]
|
||||||
|
description = "WARC writing MITM HTTP/S proxy"
|
||||||
|
readme = "README.rst"
|
||||||
|
requires-python = ">=3.8"
|
||||||
|
classifiers = [
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"License :: OSI Approved :: Apache Software License",
|
||||||
|
"Operating System :: OS Independent",
|
||||||
|
]
|
||||||
|
dynamic = [ "version", "license", "scripts", "dependencies", "optional-dependencies" ]
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
Homepage = "https://github.com/internetarchive/warcprox"
|
||||||
|
Issues = "https://github.com/internetarchive/warcprox/issues"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=61.0"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
5
setup.py
5
setup.py
@ -26,7 +26,7 @@ import setuptools
|
|||||||
deps = [
|
deps = [
|
||||||
'warctools>=4.10.0',
|
'warctools>=4.10.0',
|
||||||
'urlcanon>=0.3.0',
|
'urlcanon>=0.3.0',
|
||||||
'doublethink @ git+https://github.com/internetarchive/doublethink.git@Py311',
|
'doublethink==0.4.9',
|
||||||
'urllib3>=1.23',
|
'urllib3>=1.23',
|
||||||
'requests>=2.0.1',
|
'requests>=2.0.1',
|
||||||
'PySocks>=1.6.8',
|
'PySocks>=1.6.8',
|
||||||
@ -52,7 +52,8 @@ setuptools.setup(
|
|||||||
license='GPL',
|
license='GPL',
|
||||||
packages=['warcprox'],
|
packages=['warcprox'],
|
||||||
install_requires=deps,
|
install_requires=deps,
|
||||||
extras_require={'trough': ['trough @ git+https://github.com/internetarchive/trough.git@jammy_focal',],},
|
# preferred trough 'trough @ git+https://github.com/internetarchive/trough.git@jammy_focal'
|
||||||
|
extras_require={'trough': 'trough'},
|
||||||
setup_requires=['pytest-runner'],
|
setup_requires=['pytest-runner'],
|
||||||
tests_require=['mock', 'pytest', 'warcio'],
|
tests_require=['mock', 'pytest', 'warcio'],
|
||||||
entry_points={
|
entry_points={
|
||||||
|
@ -152,19 +152,12 @@ class CertificateAuthority(object):
|
|||||||
|
|
||||||
host = host.encode('utf-8')
|
host = host.encode('utf-8')
|
||||||
|
|
||||||
# Generate key
|
|
||||||
key = rsa.generate_private_key(
|
|
||||||
public_exponent=65537,
|
|
||||||
key_size=2048,
|
|
||||||
backend=default_backend()
|
|
||||||
)
|
|
||||||
|
|
||||||
# Generate CSR
|
# Generate CSR
|
||||||
csr = x509.CertificateSigningRequestBuilder().subject_name(
|
csr = x509.CertificateSigningRequestBuilder().subject_name(
|
||||||
x509.Name([
|
x509.Name([
|
||||||
x509.NameAttribute(NameOID.COMMON_NAME, host.decode('utf-8')),
|
x509.NameAttribute(NameOID.COMMON_NAME, host.decode('utf-8')),
|
||||||
])
|
])
|
||||||
).sign(key, hash_func, default_backend())
|
).sign(self.key, hash_func, default_backend())
|
||||||
|
|
||||||
# Generate Cert
|
# Generate Cert
|
||||||
cert_builder = x509.CertificateBuilder().subject_name(
|
cert_builder = x509.CertificateBuilder().subject_name(
|
||||||
@ -193,8 +186,8 @@ class CertificateAuthority(object):
|
|||||||
cert = cert_builder.sign(root_key, hash_func, default_backend())
|
cert = cert_builder.sign(root_key, hash_func, default_backend())
|
||||||
|
|
||||||
# Write cert + key
|
# Write cert + key
|
||||||
self.write_pem(host_filename, cert, key)
|
self.write_pem(host_filename, cert, self.key)
|
||||||
return cert, key
|
return cert, self.key
|
||||||
|
|
||||||
def write_pem(self, filename, cert, key):
|
def write_pem(self, filename, cert, key):
|
||||||
with open(filename, 'wb+') as f:
|
with open(filename, 'wb+') as f:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user