Compare commits

...

4 Commits

Author SHA1 Message Date
aljazmedic 9bbd730380 TCPdump container 2022-11-18 20:11:15 +01:00
aljazmedic 00798a5247 Change Passport allowed JWT algos 2022-11-18 17:21:49 +01:00
aljazmedic 9e5aa72a7b Uniq email 2022-11-18 17:21:40 +01:00
aljazmedic 38c8c21f81 Uniq email 2022-11-18 16:48:30 +01:00
5 changed files with 60 additions and 12 deletions

View File

@ -19,10 +19,11 @@ COPY . ./
#RUN npm install -g nodemon #RUN npm install -g nodemon
RUN mkdir /uploads && chown appuser:appgroup /uploads RUN mkdir /uploads && chown appuser:appgroup /uploads
RUN mkdir /pcaps
RUN apt-get install tcpdump -y
EXPOSE 3000 EXPOSE 3000
USER appuser
CMD ["node", "server.js"] CMD ["node", "server.js"]
# CMD ["nodemon", "server.js"] # CMD ["nodemon", "server.js"]

9
backend/cycle_tcpdump.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/sh
packet=$((9000))
while true
do
tcpdump -c 1000 -i any -w "/pcaps/traffic-2$packet.pcap"
packet=$((packet + 1))
done

View File

@ -70,7 +70,7 @@ const cookieExtractor = function (req) {
const opts = {}; const opts = {};
opts.jwtFromRequest = cookieExtractor; opts.jwtFromRequest = cookieExtractor;
opts.secretOrKey = PUB_KEY; opts.secretOrKey = PUB_KEY;
opts.algorithms = ['RS256', 'ES256', 'HS256']; opts.algorithms = ['RS256'];
//opts.issuer = 'localhost'; //opts.issuer = 'localhost';
//opts.audience = 'localhost'; //opts.audience = 'localhost';

View File

@ -1,13 +1,50 @@
CREATE TABLE IF NOT EXISTS channels (id VARCHAR(40), detail TEXT, private BOOL, PRIMARY KEY(id)); CREATE TABLE IF NOT EXISTS channels (
id VARCHAR(40),
detail TEXT,
private BOOL,
PRIMARY KEY(id)
);
CREATE TABLE IF NOT EXISTS users (email VARCHAR(40), nickname VARCHAR(40) UNIQUE, password VARCHAR(40), propic TEXT, PRIMARY KEY(email)); CREATE TABLE IF NOT EXISTS users (
email VARCHAR(40),
nickname VARCHAR(40) UNIQUE,
password VARCHAR(40),
propic TEXT,
PRIMARY KEY(email)
);
CREATE TABLE IF NOT EXISTS allowed_users (user_email VARCHAR(40), channel_id VARCHAR(40), PRIMARY KEY(user_email,channel_id), CREATE TABLE IF NOT EXISTS allowed_users (
FOREIGN KEY(user_email) REFERENCES users(email)); user_email VARCHAR(40),
channel_id VARCHAR(40),
PRIMARY KEY(user_email, channel_id),
FOREIGN KEY(user_email) REFERENCES users(email)
);
CREATE TABLE IF NOT EXISTS messages (id VARCHAR(40), channel_id VARCHAR(40), data TEXT, author VARCHAR(40),ts timestamp NOT NULL DEFAULT NOW(), PRIMARY KEY(id), CREATE TABLE IF NOT EXISTS messages (
FOREIGN KEY(author) REFERENCES users(email)); id VARCHAR(40),
channel_id VARCHAR(40),
data TEXT,
author VARCHAR(40),
ts timestamp NOT NULL DEFAULT NOW(),
PRIMARY KEY(id),
FOREIGN KEY(author) REFERENCES users(email)
);
INSERT INTO channels (id, detail, private) VALUES ('Crypto','web3 without crypto?',FALSE); INSERT INTO
INSERT INTO channels (id, detail, private) VALUES ('Random','whatever',FALSE); channels (id, detail, private)
INSERT INTO channels (id, detail, private) VALUES ('Brews','Share your best caffeine based concoction',FALSE); VALUES
('Crypto', 'web3 without crypto?', FALSE);
INSERT INTO
channels (id, detail, private)
VALUES
('Random', 'whatever', FALSE);
INSERT INTO
channels (id, detail, private)
VALUES
(
'Brews',
'Share your best caffeine based concoction',
FALSE
);

View File

@ -7,6 +7,7 @@ services:
- db - db
volumes: volumes:
- "vol-uploads:/uploads" - "vol-uploads:/uploads"
- "/pcaps_s3:/pcaps"
restart: on-failure restart: on-failure
frontend: frontend:
build: ./frontend build: ./frontend