From 29d31fffc717321fdbc3e35fc5d8260d036d6091 Mon Sep 17 00:00:00 2001 From: Darryl Nixon Date: Tue, 23 May 2023 13:27:25 -0700 Subject: [PATCH] Add hilarious auto db password generation and docker build check. --- .env | 15 +++++++-------- Dockerfile | 3 +++ README.md | 3 ++- ghostforge/__init__.py | 9 +++++++++ requirements.txt | 1 + setup.py | 15 +++++++++++++++ 6 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 setup.py diff --git a/.env b/.env index df014f6..daa542a 100644 --- a/.env +++ b/.env @@ -1,10 +1,3 @@ -# DATABASE_* variables are used both to initially configure the -# ghostforge postgresql database and to later access the data from -# ghostforge execution. -DATABASE_USER=ghost -DATABASE_PASSWORD= -DATABASE_NAME=ghostforge - # GHOSTFORGE_*_WEB_PORT variables are used to determine what # port the web interface is served on within the container (INTERNAL) # and what port this will map to on the host (HOST). @@ -16,4 +9,10 @@ GHOSTFORGE_INTERNAL_WEB_PORT=1337 # GHOSTFORGE_ENV is used to determine debug verbosity # Valid values are [prod, dev] -GHOSTFORGE_ENV=prod \ No newline at end of file +GHOSTFORGE_ENV=prod + +# DATABASE_* variables are used both to initially configure the +# ghostforge postgresql database and to later access the data from +# ghostforge execution. +DATABASE_USER=ghost +DATABASE_NAME=ghostforge \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 1b163cd..47d789d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM python:3.11-alpine +ENV DATABASE_PASSWORD "" +RUN if [ -z "${DATABASE_PASSWORD}" ]; then echo "ghostforge build error: Set DATABASE_PASSWORD in .env."; exit 1; fi + WORKDIR /ghostforge COPY . . RUN rm .env diff --git a/README.md b/README.md index 3096a0a..0522f58 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # ghostforge -ghostforge manages **false identity information** for privacy prudent users. +ghostforge manages **false identity information** for privacy prudent persons. tl;dr it's a fancy DB frontend with sensible design, tailored features, and a nice UX.
@@ -23,6 +23,7 @@ You'll need `docker-compose` installed or you can convert the contents of `docke ```bash git clone https://github.com/darrylnixon/ghostforge.git && \ cd ghostforge && \ +PW=$(head -c 500 /dev/urandom | LC_ALL=C tr -dc '[:print:]' | fold -w 24 | head -n 1 | sed "s/\\\\/\\\\\\\\/g; s/'/\\\\\'/g") | sed -i .bak "s/^DATABASE_PASSWORD=.*/DATABASE_PASSWORD=$PW" .env; docker-compose up --detach --build; docker exec --interactive --tty ghostforge ghostforge_adduser; ``` diff --git a/ghostforge/__init__.py b/ghostforge/__init__.py index e69de29..eaf852f 100644 --- a/ghostforge/__init__.py +++ b/ghostforge/__init__.py @@ -0,0 +1,9 @@ +""" +Initialization constants for ghostforge. + +Constants: + _PROJECT (str): Name for the project + __version__ (str): The current version of the binhop package +""" +_PROJECT = "ghostforge" +__version__ = "0.0.1" diff --git a/requirements.txt b/requirements.txt index e69de29..945c9b4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..ff6e5f8 --- /dev/null +++ b/setup.py @@ -0,0 +1,15 @@ +from distutils.core import setup +from setuptools import find_packages +from ghostforge import _PROJECT, __version__ + +setup( + name=_PROJECT, + version=__version__, + packages=find_packages(), + license="MIT", + author="ghostforge", + description="False identity management web app", + long_description="A false identity information manager for privacy prudent persons", + keywords=["ghostforge", "persona", "red team", "tornado"], + install_requires=["tornado>=6.3.2", "queries>=2.1.1"], +)