Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ typings/

# dotenv environment variables file
.env

# Eclipse initialization
.project
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
## Install NodeJS (If not installed)

<pre>
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
</pre>

Expand All @@ -170,9 +170,9 @@ sudo npm install forever -g
sudo npm start
</pre>

* For Debian this is all that is needed and Glass should start immediately, you can browse via http://server-ip:3000
* For Debian this is all that is needed and Glass should start immediately, you can browse via http://server-ip:8081
* For Ubuntu users - you will have additional Apparmor config to add
* **Recommended** to iptables port 3000 to close off Glass if you are facing the public on your server
* **Recommended** to iptables port 8081 to close off Glass if you are facing the public on your server
* **Recommended** to keep Glass up through reboots, see [Glass Process Keepalive](#glass-process-keepalive)

## Apparmor
Expand Down Expand Up @@ -206,7 +206,9 @@ service apparmor restart
""
],
"email_alert_to": "",
"sms_alert_to": ""
"sms_alert_to": "",
"port": "8081",
"ws_port": 8082
}
</pre>

Expand All @@ -222,13 +224,18 @@ rm mycrontab

## Secure your Server

* Glass runs on web port 3000 - if you're going to run this on a production server, make sure that you lock it down from the outside world if anyone can access it. Even if they don't have a password - vulnerabilities can surface at any point in the future and your system becomes a prime target
* Glass runs on web port 8081 - if you're going to run this on a production server, make sure that you lock it down from the outside world if anyone can access it. Even if they don't have a password - vulnerabilities can surface at any point in the future and your system becomes a prime target

### iptables (Recommended)
<pre>
iptables -A INPUT -p tcp --dport 3000 -s 127.0.0.0/8 -j ACCEPT
iptables -A INPUT -p tcp --dport 3000 -s x.x.x.x/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 3000 -j REJECT --reject-with icmp-port-unreachable
iptables -A INPUT -p tcp --dport 8081 -s 127.0.0.0/8 -j ACCEPT
iptables -A INPUT -p tcp --dport 8081 -s x.x.x.x/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 8081 -j REJECT --reject-with icmp-port-unreachable
</pre>

### ufw
<pre>
ufw allow proto tcp from any to any port 8081
</pre>

## Building dhcpd-pools (Optional)
Expand Down
8 changes: 4 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ app.use('/api/get_mac_oui_list/', require('./api/get_mac_oui_list'));
app.use('/api/get_glass_config/', require('./api/get_glass_config'));
app.use('/api/get_websocket_config/', require('./api/get_websocket_config'));

app.set('view engine', 'html');
//app.set('view engine', 'html');

/**
* Catch 404
Expand Down Expand Up @@ -148,11 +148,11 @@ app_timers.startLeasesPerMinuteCalculator();
* Websockets
*/
const WebSocket = require('ws');
const ws_port = glass_config.ws_port || 8080;
const ws_port = glass_config.ws_port || 8081;

console.log("[Glass Server] Websocket server starting on port: " + ws_port);

global.wss = new WebSocket.Server({port: ws_port});
global.wss = new WebSocket.Server({ port: ws_port });

wss.on('connection', function connection(ws) {
socket_clients++;
Expand Down Expand Up @@ -227,7 +227,7 @@ stale_connections_audit = function() {
if (ws.isAlive === false) return ws.terminate();

ws.isAlive = false;
ws.ping('', false, true);
ws.ping('');

socket_clients++;
});
Expand Down
Empty file modified bin/dhcpd-pools
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var http = require('http');
* Get port from environment and store in Express.
*/

var port = normalizePort(process.env.PORT || app.glass_config.port || '3000');
var port = normalizePort(process.env.PORT || app.glass_config.port || '8081');
var interface = app.glass_config.host || '0.0.0.0';
app.set('port', port);

Expand Down
3 changes: 2 additions & 1 deletion config/glass_config.json → config/glass_config.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
],
"email_alert_to": "",
"sms_alert_to": "",
"ws_port": 8080
"port": "8081",
"ws_port": "8082"
}
Loading