chg: properly create a secret key
parent
5e4264a411
commit
2f7c286312
|
@ -122,4 +122,7 @@ website/web/static/d3*.js
|
||||||
# Same got bootstrap-select
|
# Same got bootstrap-select
|
||||||
website/web/static/bootstrap-select*
|
website/web/static/bootstrap-select*
|
||||||
|
|
||||||
|
# Session key
|
||||||
|
website/secret_key
|
||||||
|
|
||||||
*.swp
|
*.swp
|
||||||
|
|
12
README.md
12
README.md
|
@ -12,7 +12,7 @@ New version of BGP Ranking, complete rewrite in python3.6+ and an ARDB backend
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/antirez/redis.git
|
git clone https://github.com/antirez/redis.git
|
||||||
cd redis
|
cd redis
|
||||||
git checkout 4.0
|
git checkout 5.0
|
||||||
make
|
make
|
||||||
make test
|
make test
|
||||||
cd ..
|
cd ..
|
||||||
|
@ -23,11 +23,11 @@ cd ..
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/yinqiwen/ardb.git
|
git clone https://github.com/yinqiwen/ardb.git
|
||||||
cd ardb
|
cd ardb
|
||||||
make
|
DISABLE_WARNING_AS_ERROR=1 make # ardb (more precisely rocksdb) doesn't compile on ubuntu 18.04 unless you disable warning as error
|
||||||
cd ..
|
cd ..
|
||||||
```
|
```
|
||||||
|
|
||||||
## Install BGP Ranking
|
## Install & run BGP Ranking
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/D4-project/BGP-Ranking.git
|
git clone https://github.com/D4-project/BGP-Ranking.git
|
||||||
|
@ -41,6 +41,12 @@ start.py
|
||||||
start_website.py
|
start_website.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Shutdown BGP Ranking
|
||||||
|
|
||||||
|
```bash
|
||||||
|
stop.py
|
||||||
|
```
|
||||||
|
|
||||||
# Directory structure
|
# Directory structure
|
||||||
|
|
||||||
*Config files*: `bgpranking / config / *.json`
|
*Config files*: `bgpranking / config / *.json`
|
||||||
|
|
|
@ -7,6 +7,8 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from flask import Flask, render_template, request, session, Response, redirect, url_for
|
from flask import Flask, render_template, request, session, Response, redirect, url_for
|
||||||
|
@ -14,14 +16,21 @@ from flask_bootstrap import Bootstrap
|
||||||
|
|
||||||
from bgpranking.querying import Querying
|
from bgpranking.querying import Querying
|
||||||
from bgpranking.libs.exceptions import MissingConfigEntry
|
from bgpranking.libs.exceptions import MissingConfigEntry
|
||||||
from bgpranking.libs.helpers import load_general_config
|
from bgpranking.libs.helpers import load_general_config, get_homedir
|
||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
import pycountry
|
import pycountry
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
app.secret_key = '\xeb\xfd\x1b\xee\xed<\xa5~\xd5H\x85\x00\xa5r\xae\x80t5@\xa2&>\x03S'
|
secret_file_path = get_homedir() / 'website' / 'secret_key'
|
||||||
|
|
||||||
|
if not secret_file_path.exists() or secret_file_path.stat().st_size < 64:
|
||||||
|
with open(secret_file_path, 'wb') as f:
|
||||||
|
f.write(os.urandom(64))
|
||||||
|
|
||||||
|
with open(secret_file_path, 'rb') as f:
|
||||||
|
app.config['SECRET_KEY'] = f.read()
|
||||||
|
|
||||||
Bootstrap(app)
|
Bootstrap(app)
|
||||||
app.config['BOOTSTRAP_SERVE_LOCAL'] = True
|
app.config['BOOTSTRAP_SERVE_LOCAL'] = True
|
||||||
|
|
Loading…
Reference in New Issue