Skip to content

Commit

Permalink
Upgrade OpenVPN software version
Browse files Browse the repository at this point in the history
Upgrade requirements and bump micro version
Improve linting and runbook UI
  • Loading branch information
dormant-user committed May 27, 2024
1 parent 6c18bc8 commit 281a480
Show file tree
Hide file tree
Showing 15 changed files with 253 additions and 147 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/markdown-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ on:

jobs:
none-shall-pass:
runs-on:
- self-hosted
- Ubuntu
runs-on: thevickypedia-default
steps:
- uses: thevickypedia/none-shall-pass@v5
with:
Expand Down
30 changes: 6 additions & 24 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
# This workflow will upload a Python Package using Twine when a release is created

name: pypi-publish

# Controls when the workflow will run
on:
workflow_dispatch: {}
workflow_dispatch:
release:
types: [ published ]

jobs:
deploy:
runs-on: self-hosted
pypi-publisher:
runs-on: thevickypedia-default
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Create packages
run: python -m build
- name: Run twine check
run: twine check dist/*
- name: Upload to pypi
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*.whl
- uses: thevickypedia/pypi-publisher@v3
env:
token: ${{ secrets.PYPI_TOKEN }}
81 changes: 42 additions & 39 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
---
fail_fast: true
exclude: ^docs/
exclude: ^(notebooks/|scripts/|.github/|docs/)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-byte-order-marker
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-merge-conflict
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-aws-credentials
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: name-tests-test
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: check-json
- id: check-added-large-files
- id: check-ast
- id: check-byte-order-marker
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-merge-conflict
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-aws-credentials
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: name-tests-test
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

- repo: local
hooks:
-
id: docs
name: docs
entry: /bin/bash pre_commit.sh
language: system
pass_filenames: false
always_run: true
- repo: local
hooks:
-
id: docs
name: docs
entry: /bin/bash pre_commit.sh
language: system
pass_filenames: false
always_run: true
3 changes: 3 additions & 0 deletions doc_gen/static.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.sphinxsidebarwrapper {
overflow-y: scroll;
}
3 changes: 3 additions & 0 deletions docs/_static/static.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.sphinxsidebarwrapper {
overflow-y: scroll;
}
10 changes: 10 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,16 @@ <h1>Configuration<a class="headerlink" href="#configuration" title="Permalink to
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">AMIBase</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<ul class="simple">
<li><p>Subscription Home Page: <a class="reference external" href="https:/">https:/</a>/{REGION}.console.aws.amazon.com/marketplace/home#/subscriptions/{_PRODUCT_ID}</p></li>
<li><p>Product ID: Found in the home page URL under Summary as ‘Product ID’</p></li>
<li><p>Product Code: Offer ID in the home page URL</p></li>
<li><p>AMI Alias: Found in configuration page (_BASE_URL) as ‘Ami Alias’</p></li>
<li><p>Product Code: Found in configuration page (_BASE_URL) as ‘Product Code’</p></li>
</ul>
</div>
<p>Create a new model by parsing and validating input data from keyword arguments.</p>
<p>Raises [<cite>ValidationError</cite>][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Release Notes
=============

1.7.1 (05/26/2024)
------------------
- Upgrades ``OpenVPN`` software version and dependencies
- Improves linting and runbook UI

1.7 (01/30/2024)
----------------
- Improved accuracy for validating alias record
Expand Down
6 changes: 3 additions & 3 deletions vpn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Place holder for package."""

from vpn.main import VPNServer # noqa: F401
from vpn.models import (config, exceptions, image_factory, # noqa: F401
logger, route53, server, util)
from vpn.models import image_factory # noqa: F401
from vpn.models import config, exceptions, logger, route53, server, util

version = "1.7"
version = "1.7.1"
50 changes: 30 additions & 20 deletions vpn/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,26 +190,36 @@ def _authorize_security_group(self,
security_group = self.ec2_resource.SecurityGroup(security_group_id)
security_group.authorize_ingress(
IpPermissions=[
{'IpProtocol': 'tcp',
'FromPort': 22,
'ToPort': 22,
'IpRanges': [{'CidrIp': '0.0.0.0/0'}]},
{'IpProtocol': 'tcp',
'FromPort': 443,
'ToPort': 443,
'IpRanges': [{'CidrIp': '0.0.0.0/0'}]},
{'IpProtocol': 'tcp',
'FromPort': config.env.vpn_port,
'ToPort': config.env.vpn_port,
'IpRanges': [{'CidrIp': '0.0.0.0/0'}]},
{'IpProtocol': 'tcp',
'FromPort': 945,
'ToPort': 945,
'IpRanges': [{'CidrIp': '0.0.0.0/0'}]},
{'IpProtocol': 'udp',
'FromPort': 1194,
'ToPort': 1194,
'IpRanges': [{'CidrIp': '0.0.0.0/0'}]}
{
'IpProtocol': 'tcp',
'FromPort': 22,
'ToPort': 22,
'IpRanges': [{'CidrIp': '0.0.0.0/0'}]
},
{
'IpProtocol': 'tcp',
'FromPort': 443,
'ToPort': 443,
'IpRanges': [{'CidrIp': '0.0.0.0/0'}]
},
{
'IpProtocol': 'tcp',
'FromPort': config.env.vpn_port,
'ToPort': config.env.vpn_port,
'IpRanges': [{'CidrIp': '0.0.0.0/0'}]
},
{
'IpProtocol': 'tcp',
'FromPort': 945,
'ToPort': 945,
'IpRanges': [{'CidrIp': '0.0.0.0/0'}]
},
{
'IpProtocol': 'udp',
'FromPort': 1194,
'ToPort': 1194,
'IpRanges': [{'CidrIp': '0.0.0.0/0'}]
}
])
except ClientError as error:
error = str(error)
Expand Down
138 changes: 110 additions & 28 deletions vpn/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ class AMIBase(BaseModel):
>>> AMIBase
See Also:
- Subscription Home Page: https://{REGION}.console.aws.amazon.com/marketplace/home#/subscriptions/{_PRODUCT_ID}
- Product ID: Found in the home page URL under Summary as 'Product ID'
- Product Code: Offer ID in the home page URL
- AMI Alias: Found in configuration page (_BASE_URL) as 'Ami Alias'
- Product Code: Found in configuration page (_BASE_URL) as 'Product Code'
"""

_BASE_URL: str = 'https://aws.amazon.com/marketplace/server/configuration?productId={productId}'
Expand All @@ -32,7 +38,7 @@ class AMIBase(BaseModel):

PRODUCT_PAGE: HttpUrl = _BASE_URL.format(productId=_PRODUCT_ID)
NAME: str = f'OpenVPN Access Server QA Image-{_PRODUCT_ID}'
ALIAS: str = _BASE_SSM.format(path='qqrkogtl46mpu/2.11.3')
ALIAS: str = _BASE_SSM.format(path='qqrkogtl46mpu/2.13.1')
PRODUCT_CODE: str = 'f2ew2wrz425a1jagnifd02u5t'


Expand Down Expand Up @@ -114,32 +120,108 @@ class Settings(BaseModel):
def configuration_dict(param: EnvConfig) -> List[ConfigurationSettings]:
"""Get configuration interaction as a list of dictionaries."""
for config_dict in [
{'request': "Please enter 'yes' to indicate your agreement \\[no\\]: ", 'response': 'yes', 'timeout': 5,
'critical': False},
{'request': '> Press ENTER for default \\[yes\\]: ', 'response': 'yes', 'timeout': 1, 'critical': False},
{'request': '> Press Enter for default \\[1\\]: ', 'response': '1', 'timeout': 1, 'critical': False},
{'request': '> Press ENTER for default \\[rsa\\]:', 'response': 'rsa', 'timeout': 1, 'critical': False},
{'request': '> Press ENTER for default \\[ 2048 \\]:', 'response': '2048', 'timeout': 1,
'critical': False},
{'request': '> Press ENTER for default \\[rsa\\]:', 'response': 'rsa', 'timeout': 1, 'critical': False},
{'request': '> Press ENTER for default \\[ 2048 \\]:', 'response': '2048', 'timeout': 1,
'critical': False},
{'request': '> Press ENTER for default \\[943\\]: ', 'response': param.vpn_port, 'timeout': 1,
'critical': False},
{'request': '> Press ENTER for default \\[443\\]: ', 'response': '443', 'timeout': 1, 'critical': False},
{'request': '> Press ENTER for default \\[no\\]: ', 'response': 'yes', 'timeout': 1, 'critical': False},
{'request': '> Press ENTER for default \\[no\\]: ', 'response': 'yes', 'timeout': 1, 'critical': False},
{'request': '> Press ENTER for EC2 default \\[yes\\]: ', 'response': 'yes', 'timeout': 1,
'critical': False},
{'request': '> Press ENTER for default \\[yes\\]: ', 'response': 'no', 'timeout': 1, 'critical': False},
{'request': '> Specify the username for an existing user or for the new user account: ',
'response': param.vpn_username, 'timeout': 1, 'critical': True},
{'request': f"Type a password for the '{param.vpn_username}' account "
"(if left blank, a random password will be generated):",
'response': param.vpn_password, 'timeout': 1, 'critical': True},
{'request': f"Confirm the password for the '{param.vpn_username}' account:", 'response': param.vpn_password,
'timeout': 1, 'critical': True},
{'request': '> Please specify your Activation key (or leave blank to specify later): ', 'response': '\n',
'timeout': 1, 'critical': False}
{
"request": "Please enter 'yes' to indicate your agreement \\[no\\]: ",
"response": "yes",
"timeout": 5,
"critical": False,
},
{
"request": "> Press ENTER for default \\[yes\\]: ",
"response": "yes",
"timeout": 1,
"critical": False,
},
{
"request": "> Press Enter for default \\[1\\]: ",
"response": "1",
"timeout": 1,
"critical": False,
},
{
"request": "> Press ENTER for default \\[rsa\\]:",
"response": "rsa",
"timeout": 1,
"critical": False,
},
{
"request": "> Press ENTER for default \\[ 2048 \\]:",
"response": "2048",
"timeout": 1,
"critical": False,
},
{
"request": "> Press ENTER for default \\[rsa\\]:",
"response": "rsa",
"timeout": 1,
"critical": False,
},
{
"request": "> Press ENTER for default \\[ 2048 \\]:",
"response": "2048",
"timeout": 1,
"critical": False,
},
{
"request": "> Press ENTER for default \\[943\\]: ",
"response": param.vpn_port,
"timeout": 1,
"critical": False,
},
{
"request": "> Press ENTER for default \\[443\\]: ",
"response": "443",
"timeout": 1,
"critical": False,
},
{
"request": "> Press ENTER for default \\[no\\]: ",
"response": "yes",
"timeout": 1,
"critical": False,
},
{
"request": "> Press ENTER for default \\[no\\]: ",
"response": "yes",
"timeout": 1,
"critical": False,
},
{
"request": "> Press ENTER for EC2 default \\[yes\\]: ",
"response": "yes",
"timeout": 1,
"critical": False,
},
{
"request": "> Press ENTER for default \\[yes\\]: ",
"response": "no",
"timeout": 1,
"critical": False,
},
{
"request": "> Specify the username for an existing user or for the new user account: ",
"response": param.vpn_username,
"timeout": 1,
"critical": True,
},
{
"request": f"Type a password for the '{param.vpn_username}' account "
"(if left blank, a random password will be generated):",
"response": param.vpn_password,
"timeout": 1,
"critical": True,
},
{
"request": f"Confirm the password for the '{param.vpn_username}' account:",
"response": param.vpn_password,
"timeout": 1,
"critical": True,
},
{
"request": "> Please specify your Activation key (or leave blank to specify later): ",
"response": "\n",
"timeout": 1,
"critical": False,
},
]:
yield ConfigurationSettings(**config_dict)
Loading

0 comments on commit 281a480

Please sign in to comment.