Set it up iptables so the server can run without sudo

This commit is contained in:
Kelvin Ly 2018-09-27 21:44:03 -04:00
parent 0750c4afe3
commit 8ca27d3df2
2 changed files with 21 additions and 3 deletions

View File

@ -7,10 +7,12 @@ sudo apt-get -y install iptables-persistent
mkdir -p ~/go
cat "export PATH=$PATH:/usr/lib/go-1.10/bin" >> ~/.bashrc
cat "export GOPATH=~/go" >> ~/.bashrc
echo "export PATH=$PATH:/usr/lib/go-1.10/bin" >> ~/.bashrc
echo "export GOPATH=~/go" >> ~/.bashrc
sudo cp rules.v4 /etc/iptables/rules.v4
source ~/.bashrc
go get -u gopkg.in/russross/blackfriday.v2
go get -u https://github.com/shurcooL/github_flavored_markdown
go get -u github.com/shurcooL/github_flavored_markdown
go get -u github.com/sevlyar/go-daemon

16
rules.v4 Normal file
View File

@ -0,0 +1,16 @@
# Generated by iptables-save v1.6.0 on Fri Sep 28 01:39:23 2018
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [1:60]
:OUTPUT ACCEPT [2:120]
:POSTROUTING ACCEPT [2:120]
-A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8000
COMMIT
# Completed on Fri Sep 28 01:39:23 2018
# Generated by iptables-save v1.6.0 on Fri Sep 28 01:39:23 2018
*filter
:INPUT ACCEPT [4281:16446101]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [3022:338342]
COMMIT
# Completed on Fri Sep 28 01:39:23 2018