Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Emulated vault#4097

Merged
ocket8888 merged 9 commits intoapache:masterfrom
nir-sopher:emulated_vault
Nov 25, 2019
Merged

Emulated vault#4097
ocket8888 merged 9 commits intoapache:masterfrom
nir-sopher:emulated_vault

Conversation

@nir-sopher
Copy link
Copy Markdown
Contributor

@nir-sopher nir-sopher commented Nov 7, 2019

What does this PR (Pull Request) do?

  • This PR is not related to any issue

The PR introduces the emulated_vault module which supplies a HTTP server mimicking RIAK behavior for usage as Traffic Vault.
It may be used in order to replace RIAK-based Traffic Vault, as it is much more simple to install.
The server may use different type of persistent storage (e.g. file-system), using the proper adapter.
The resiliency of the stored keys is derived from the resiliency of the underlying storage.

Which Traffic Control components are affected by this PR?

None by default.
It introduces a module that may replace the RIAK-based Traffic Vault.

What is the best way to verify this PR?

Install the emulated vault as described below, and add it to a running Traffic Ops instance instead of the standard RIAK-based Traffic Vault.
Run url-signing and SSL based scenarios.
Note: you would probably want to work on a fresh TC deployment, or somehow copy the RIAK vault to the emulated one...

The following criteria are ALL met by this PR

  • This PR contains tests or I have explained why tests are unnecessary
  • This PR contains documentation or I have explained why tests are unnecessary
  • This PR includes an update to CHANGELOG.md
  • This PR includes any and all required license headers
  • This PR does not include a database migration
  • This PR DOES NOT FIX A SERIOUS SECURITY VULNERABILITY (see the Apache Software Foundation's security guidelines for details)

Tests are not included in the PR as it is still under experimental.
Would be a must if/when the code goes to production.

Additional Information - Installation

Basic requirements: Centos ver >= 7; Python >= 2.7

In order to install the module on a server please:

  1. Copy the module files to the server's root
  2. Add the certificate and key to your favorite path
  3. Adjust /opt/emulated_vault/conf/cfg.json - pointing at your certificate and key
  4. "systemctl enable" the service

Logs may be found under /opt/emulated_vault/var/log

Additional Information - Developer's Notes

If you just want to play around with the module, you may of course run the server script on its own.
Before doing that, you would probably need to adjust the opt/emulated_vault/conf/cfg.json:

  1. Changing the db-path to one you have access to
  2. Disable ssl (just to make it easier)

Additionally, the vault-cmd script is also available to work against the DB with command line.
It is mostly useful when developing a new adapter.

@asf-ci
Copy link
Copy Markdown
Contributor

asf-ci commented Nov 7, 2019

Can one of the admins verify this patch?

@ocket8888 ocket8888 added the WIP "Work-in-Progress" - do not merge! (use 'draft' pull requests from now on) label Nov 8, 2019
@nir-sopher nir-sopher added experimental a feature/component not directly supported by ATC Traffic Vault related to Traffic Vault and removed WIP "Work-in-Progress" - do not merge! (use 'draft' pull requests from now on) labels Nov 8, 2019
@nir-sopher nir-sopher changed the title WIP: Emulated vault Emulated vault Nov 8, 2019
Copy link
Copy Markdown
Contributor

@ocket8888 ocket8888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing license headers in all files.

Comment thread experimental/emulated_vault/README Outdated
Comment thread experimental/emulated_vault/README Outdated
Comment thread experimental/emulated_vault/README Outdated
@ocket8888
Copy link
Copy Markdown
Contributor

Please fill out the Pull Request template to the best of your ability, and avoid deleting it entirely.

@ocket8888 ocket8888 self-assigned this Nov 9, 2019
Copy link
Copy Markdown
Contributor

@ocket8888 ocket8888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vast majority of this Python code-base could use some type-hinting and docstrings

Comment thread experimental/emulated_vault/README Outdated
Comment thread experimental/emulated_vault/README Outdated
Comment thread experimental/emulated_vault/README Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/adaptor/fs.py Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/adaptor/fs.py Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/vault-server Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/vault-server Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/conf/cfg.json Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/adaptor/fs.py Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/vault-server Outdated
Copy link
Copy Markdown
Contributor

@ocket8888 ocket8888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also isn't compatible with modern Python

Comment thread experimental/emulated_vault/opt/emulated-vault/adaptor/fs.py Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/conf/cfg.ini Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/vault-server Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/vault-server Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/vault-server Outdated
@nir-sopher nir-sopher force-pushed the emulated_vault branch 2 times, most recently from f635bc0 to edad420 Compare November 18, 2019 21:18
@mitchell852 mitchell852 added the Traffic Ops related to Traffic Ops label Nov 18, 2019
@nir-sopher
Copy link
Copy Markdown
Contributor Author

@ocket8888
As far as I can see, there are 2 type of remarks left to be handled.

  1. Coding style
  2. Server behavior (response codes, encoding).
    For update README.md - JIRA link #1 I replied.
    For Updates website docs for 1.7 and revs documentation version to 1.8 #2 I prefer to open an issue and make a separate PR

@ocket8888
Copy link
Copy Markdown
Contributor

That's certainly fine with me, especially since this is experimental. I'll try to be a bit lax about the contribution guidelines as well, with that fact that it is experimental in mind.

Copy link
Copy Markdown
Contributor

@ocket8888 ocket8888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some comments about how to approve your linter score above 4/10, but that's not strictly necessary for experimental code if you're strongly opposed to it.

Your files vault-debug and vault-server both start with "shebang"s (#!s) and don't end with .py which seems to indicate that they should be executable, and I think your unit file expects that as well. However, the files themselves are not executable - should they be?

Comment thread experimental/emulated_vault/opt/emulated-vault/vault-debug Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/vault-server Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/adapter/fs.py Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/adapter/base.py Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/adapter/base.py Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/adapter/fs.py Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/adapter/fs.py Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/vault-debug Outdated
Copy link
Copy Markdown
Contributor

@ocket8888 ocket8888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good at a glance. I'll run it through the linter again after this one small fix. I don't think I'll test it, since it's experimental.

Comment thread experimental/emulated_vault/opt/emulated-vault/storage/adapter_base.py Outdated
@nir-sopher
Copy link
Copy Markdown
Contributor Author

@ocket8888 Any additional AIs on my side?
Thanks,
Nir

Copy link
Copy Markdown
Contributor

@ocket8888 ocket8888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linter found a couple of bugs

Comment thread experimental/emulated_vault/opt/emulated-vault/vault-server Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/storage/adapter_base.py Outdated
Comment thread experimental/emulated_vault/opt/emulated-vault/storage/adapter_base.py Outdated
Copy link
Copy Markdown
Contributor

@ocket8888 ocket8888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, net positive linting score, untested but experimental.

@ocket8888 ocket8888 merged commit 37245dd into apache:master Nov 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

experimental a feature/component not directly supported by ATC Traffic Ops related to Traffic Ops Traffic Vault related to Traffic Vault

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants