Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 1abbe4f

Browse files
closed #40 - by default pi doesn't connect to the public internet (#42)
1 parent 84b1740 commit 1abbe4f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

raspberry-pi/image-setup/firstboot.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sudo systemctl enable ssh
88
sudo apt-get update -y
99
sudo apt-get upgrade -y
1010
# install programs
11-
sudo apt-get install expect git zsh python3-pip python3-venv -y
11+
sudo apt-get install expect git zsh ufw python3-pip python3-venv -y
1212
# change default shell for root and pi users
1313
sudo chsh -s /bin/zsh pi
1414
sudo chsh -s /bin/zsh
@@ -27,7 +27,7 @@ cat <<EOT >script.exp
2727
set timeout -1
2828
spawn sudo ./adafruit-pitft.sh
2929
match_max 100000
30-
expect -exact "SELECT 1-7: "
30+
expect -exact "SELECT 1-8: "
3131
send -- "1\r"
3232
expect -exact "SELECT 1-4: "
3333
send -- "1\r"
@@ -83,5 +83,13 @@ echo "export PATH=\"/root:$PATH\"" >>/root/.zshrc
8383
echo "gui.py" >>/root/.zshrc
8484

8585

86+
# block all internet access other than incomming ssh from local network
87+
# outgoing isn't blocked by default, we don't want updates unless we explicitly disable the firewall
88+
ufw default deny outgoing
89+
# allow local ssh
90+
ufw allow from 192.168.1.0/24 to any port 22
91+
# enable ufw, will auto start on boot
92+
echo "y" | sudo ufw enable
93+
8694
# tell pi to restart after one minute. This is needed for the ssh changes to work and for the adafruit screen drivers
8795
sudo shutdown -r 1

0 commit comments

Comments
 (0)