Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker infrastructure #104

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add docker infrastructure #104

wants to merge 4 commits into from

Conversation

Yoshi325
Copy link
Collaborator

@Yoshi325 Yoshi325 commented Jan 17, 2023

This is a pretty heavy one. Had to shift a bunch around to make it work. Specifically the command line setup needed to be split to support a web ui setup if user input is required. And the other half of it needed automatically (but idempotently) run before first request.

With a proper hashview/config.conf: docker compose up will bring up a container for mysql, as well as one for the application. A before_first_request hook sets up most of the default items. And a before_request hook handles changing the Admin user that is created by default, and populating the Settings in the database.

While working, I also addressed two comparisons with 0 that Flask was flagging. And unified logging a bit so that a common formatting is used, as well as fixing a bug where the flask migrate upgrade was squelching further log messages.

@Yoshi325 Yoshi325 changed the base branch from main to v0.8.1-dev January 17, 2023 17:21
@Yoshi325 Yoshi325 added this to In Progress in v0.8.2 Jan 17, 2023
try:
logger.info('Upgrading Database if needed Progressing.')
import alembic.command
migrate_ext = config = current_app.extensions['migrate']
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I need to remove this double-assignment.

from hashview.setup import admin_pass_needs_changed
from hashview.users.routes import bcrypt
if not admin_pass_needs_changed(db, bcrypt):
logger.info('Admin password needs changed.')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I need to fix this log message (it should convey the inverse).

@Yoshi325
Copy link
Collaborator Author

I need to add a section the the README. Specifically it should call out that this first pass of docker is intended to be a platform to build future production deployment of hashview via docker, but for now it is in more of a "developer ready" state. Also, it should point out that a config.conf needs created in order to be able to run docker-compose up and that to be secure, the MYSQL_PASSWORD should be changed in docker-compose.yml.

@Yoshi325
Copy link
Collaborator Author

I need to fit the typo in my latest commit (ducker => docker).

@bandrel
Copy link
Collaborator

bandrel commented May 12, 2023

Getting errors when trying to docker compose up.
image
I had to change the port to 5001:5001 because of a conflict other than that the example config was used.

@NotoriousRebel
Copy link

Any updates on this @Yoshi325 ?

@i128
Copy link
Contributor

i128 commented Aug 19, 2023

This is the next update to go in. We wanted to land v0.8.1 first.

@Yoshi325
Copy link
Collaborator Author

Rebased and updated on top of the latest.

except:
logger.exception('Adding Admin User failed.')

try:
Copy link
Contributor

Choose a reason for hiding this comment

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

We should swap the order in which the default wordlists are added. Starting with the dynamic wordlist followed by the static wordlist.

This way, the dynamic wordlist, in the db ends up with id=1.

task = Tasks(
name = 'Rockyou Wordlist',
owner_id = '1',
wl_id = '1',
Copy link
Contributor

Choose a reason for hiding this comment

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

This is correct for now, in so much as the wl_id=1 is rock you, but if we swap it so that the dynamic wordlist is loaded first, then these should be updated wl_id=2

task = Tasks(
name = 'Rockyou Wordlist + Best64 Rules',
owner_id = '1',
wl_id = '1',
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. update to wl_id=2 if we make dynamic wordlist wl_id=1

Also required creating a web ui interface to force the admin password and settings to be set.

Also unified logging to a single format.
@Yoshi325 Yoshi325 changed the base branch from v0.8.1-dev to main May 7, 2024 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
v0.8.2
In Progress
Development

Successfully merging this pull request may close these issues.

None yet

4 participants