cleanup debug
This commit is contained in:
parent
938eb9ac97
commit
d9f64fd4d3
2 changed files with 10 additions and 6 deletions
|
|
@ -20,7 +20,7 @@ mkdir -p $SEEDS_DIR >> $LOG_FILE 2>&1
|
||||||
SEED=$(openssl rand -hex 32)
|
SEED=$(openssl rand -hex 32)
|
||||||
echo $SEED > $SEED_FILE
|
echo $SEED > $SEED_FILE
|
||||||
|
|
||||||
echo "Generating SSL certificates (takes a few seconds)..."
|
echo "Generating SSL certificates..."
|
||||||
|
|
||||||
CA_KEY_PATH=$KEY_DIR/Lamassu_OP_Root_CA.key
|
CA_KEY_PATH=$KEY_DIR/Lamassu_OP_Root_CA.key
|
||||||
CA_PATH=$CERT_DIR/Lamassu_OP_Root_CA.pem
|
CA_PATH=$CERT_DIR/Lamassu_OP_Root_CA.pem
|
||||||
|
|
@ -33,6 +33,7 @@ openssl genrsa \
|
||||||
|
|
||||||
openssl req \
|
openssl req \
|
||||||
-x509 \
|
-x509 \
|
||||||
|
-sha256 \
|
||||||
-new \
|
-new \
|
||||||
-nodes \
|
-nodes \
|
||||||
-key $CA_KEY_PATH \
|
-key $CA_KEY_PATH \
|
||||||
|
|
@ -48,7 +49,11 @@ openssl genrsa \
|
||||||
openssl req -new \
|
openssl req -new \
|
||||||
-key $SERVER_KEY_PATH \
|
-key $SERVER_KEY_PATH \
|
||||||
-out /tmp/Lamassu_OP.csr.pem \
|
-out /tmp/Lamassu_OP.csr.pem \
|
||||||
-subj "/C=IS/ST=/L=Reykjavik/O=Lamassu Operator/CN=$DOMAIN" \
|
-subj "/C=IS/ST=/L=Reykjavik/O=Lamassu Operator/CN=$IP" \
|
||||||
|
-reqexts SAN \
|
||||||
|
-sha256 \
|
||||||
|
-config <(cat /etc/ssl/openssl.cnf \
|
||||||
|
<(printf "[SAN]\nsubjectAltName=IP.1:$IP")) \
|
||||||
>> $LOG_FILE 2>&1
|
>> $LOG_FILE 2>&1
|
||||||
|
|
||||||
openssl x509 \
|
openssl x509 \
|
||||||
|
|
@ -57,6 +62,9 @@ openssl x509 \
|
||||||
-CAkey $CA_KEY_PATH \
|
-CAkey $CA_KEY_PATH \
|
||||||
-CAcreateserial \
|
-CAcreateserial \
|
||||||
-out $SERVER_CERT_PATH \
|
-out $SERVER_CERT_PATH \
|
||||||
|
-extfile <(cat /etc/ssl/openssl.cnf \
|
||||||
|
<(printf "[SAN]\nsubjectAltName=IP.1:$IP")) \
|
||||||
|
-extensions SAN \
|
||||||
-days 3650 >> $LOG_FILE 2>&1
|
-days 3650 >> $LOG_FILE 2>&1
|
||||||
|
|
||||||
rm /tmp/Lamassu_OP.csr.pem
|
rm /tmp/Lamassu_OP.csr.pem
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,6 @@ function poll (req, res) {
|
||||||
|
|
||||||
pids[deviceId] = {pid, ts: Date.now()}
|
pids[deviceId] = {pid, ts: Date.now()}
|
||||||
|
|
||||||
logger.debug('poll request from: %s', deviceId)
|
|
||||||
|
|
||||||
let rates = {}
|
let rates = {}
|
||||||
let balances = {}
|
let balances = {}
|
||||||
|
|
||||||
|
|
@ -329,7 +327,6 @@ function filterOldRequests (req, res, next) {
|
||||||
|
|
||||||
function authorize (req, res, next) {
|
function authorize (req, res, next) {
|
||||||
const deviceId = req.connection.getPeerCertificate().fingerprint
|
const deviceId = req.connection.getPeerCertificate().fingerprint
|
||||||
console.log(deviceId)
|
|
||||||
|
|
||||||
return pairing.isPaired(deviceId)
|
return pairing.isPaired(deviceId)
|
||||||
.then(r => {
|
.then(r => {
|
||||||
|
|
@ -392,7 +389,6 @@ function init (opts) {
|
||||||
localApp.post('/reboot', (req, res) => {
|
localApp.post('/reboot', (req, res) => {
|
||||||
const pid = req.body.pid
|
const pid = req.body.pid
|
||||||
const deviceId = req.body.deviceId
|
const deviceId = req.body.deviceId
|
||||||
console.log('pid: %s, deviceId: %s', pid, deviceId)
|
|
||||||
|
|
||||||
if (!deviceId || !pid) {
|
if (!deviceId || !pid) {
|
||||||
return res.sendStatus(400)
|
return res.sendStatus(400)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue