Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
aljazmedic | 9bbd730380 | |
aljazmedic | 00798a5247 | |
aljazmedic | 9e5aa72a7b | |
aljazmedic | 38c8c21f81 |
|
@ -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"]
|
|
@ -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
|
|
@ -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';
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
);
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue