diff --git a/.gitignore b/.gitignore index a0079186..e296571f 100644 --- a/.gitignore +++ b/.gitignore @@ -56,4 +56,5 @@ target/ *.db *.log .idea/ -static/uploads \ No newline at end of file +CTFd/static/uploads +.ctfd_secret_key \ No newline at end of file diff --git a/CTFd/config.py b/CTFd/config.py index 11b90439..3069596f 100644 --- a/CTFd/config.py +++ b/CTFd/config.py @@ -1,6 +1,16 @@ import os + +##### GENERATE SECRET KEY ##### +with open('.ctfd_secret_key', 'a+') as secret: + secret.seek(0) # Seek to beginning of file since a+ mode leaves you at the end and w+ deletes the file + key = secret.read() + if not key: + key = os.urandom(64) + secret.write(key) + secret.flush() + ##### SERVER SETTINGS ##### -SECRET_KEY = os.urandom(64) +SECRET_KEY = key SQLALCHEMY_DATABASE_URI = 'sqlite:///ctfd.db' SESSION_TYPE = "filesystem" SESSION_FILE_DIR = "/tmp/flask_session" diff --git a/CTFd/static/admin/js/chalboard.js b/CTFd/static/admin/js/chalboard.js index 3524b0a2..b9624ba6 100644 --- a/CTFd/static/admin/js/chalboard.js +++ b/CTFd/static/admin/js/chalboard.js @@ -27,6 +27,7 @@ function loadchal(id) { obj = $.grep(challenges['game'], function (e) { return e.id == id; })[0] + $('a[href=#desc-write]').click() // Switch to Write tab $('.chal-title').text(obj.name); $('.chal-name').val(obj.name); $('.chal-desc').val(obj.description); diff --git a/CTFd/templates/admin/config.html b/CTFd/templates/admin/config.html index 8faae385..efcd7628 100644 --- a/CTFd/templates/admin/config.html +++ b/CTFd/templates/admin/config.html @@ -49,7 +49,7 @@
- +
diff --git a/CTFd/templates/admin/static/css/style.css b/CTFd/templates/admin/static/css/style.css deleted file mode 100644 index f130aac6..00000000 --- a/CTFd/templates/admin/static/css/style.css +++ /dev/null @@ -1,88 +0,0 @@ -#submit-key{ - display: none; -} - -#chal > h1{ - text-align: center -} - -#chal > form{ - width: 400px; - margin: 0 auto; -} - -#chal > form > h3,h4{ - text-align: center; -} - -#chal > form > input{ - display: none; -} - -table{ - width: 100%; -} - -/*Not sure why foundation needs these two...*/ -.top-bar input{ - height: auto; - padding-top: 0.35rem; - padding-bottom: 0.35rem; - font-size: 0.75rem; -} - -.top-bar .button{ - padding-top: 0.45rem; - padding-bottom: 0.35rem; - margin-bottom: 0; - font-size: 0.75rem; -} - -.dropdown{ - background-color: #333 !important; - padding: 5px; -} - -.dropdown button{ - padding-top: 0.45rem; - padding-bottom: 0.35rem; - margin-bottom: 0; - font-size: 0.75rem; -} - -#challenges button{ - margin: 5px; -} - -.row h1{ - text-align: center; -} - - -.textbox{ - height: 150px; -} - -.chal-tag{ - margin: 0 5px 0 5px; -} - -#score-graph{ - max-height: 400px; -} - -#keys-pie-graph{ - width: 400px; - max-height: 330px; - float: left; -} - -#categories-pie-graph{ - width: 600px; - float: left; - max-height: 330px; -} - -#admin-pages-editor{ - width: 100%; -} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0e91d205..dae08c52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,5 +5,5 @@ RUN apt-get install git gunicorn -y RUN git clone https://github.com/isislab/CTFd.git /opt/CTFd && cd /opt/CTFd && ./prepare.sh WORKDIR /opt/CTFd -CMD ["gunicorn", "--bind", "0.0.0.0:8000", "-w", "1", "CTFd:create_app()"] +CMD ["gunicorn", "--bind", "0.0.0.0:8000", "-w", "4", "CTFd:create_app()"] EXPOSE 8000