You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable automatic updates so you don't have to manually install them.
146
+
147
+
sudo apt-get install unattended-upgrades
148
+
sudo dpkg-reconfigure -plow unattended-upgrades
149
+
150
+
## 2.5 Disable root account
151
+
System admins should not frequently log in as root in order to maintain server security. Instead, you can use sudo execute that require low-level privileges.
152
+
153
+
To disable the root account, simply use the -l option.
154
+
155
+
sudo passwd -l root
156
+
157
+
If for some valid reason you need to re-enable the account, simply use the -u option.
158
+
159
+
sudo passwd -u root
160
+
161
+
## 2.6 Secure Shared Memory
162
+
One of the first things you should do is secure the shared memory used on the system. If you're unaware, shared memory can be used in an attack against a running service. Because of this, secure that portion of system memory.
163
+
164
+
Edit /etc/fstab
165
+
166
+
sudo nano /etc/fstab
167
+
168
+
Insert the following line to the bottom of the file and save/close. This sets shared memory into read-only mode.
169
+
170
+
tmpfs /run/shm tmpfs ro,noexec,nosuid 0 0
171
+
172
+
Reboot the node in order for changes to take effect.
173
+
174
+
sudo reboot
175
+
176
+
Check with this command. (ro, nosuid,noexec = read-only, no setuid, no execute)
177
+
178
+
mount | grep /run/shm
179
+
180
+
## 2.7 Install Fail2ban
181
+
Fail2ban is an intrusion-prevention system that monitors log files and searches for particular patterns that correspond to a failed login attempt. If a certain number of failed logins are detected from a specific IP address (within a specified amount of time), fail2ban blocks access from that IP address.
182
+
183
+
sudo apt-get install fail2ban -y
184
+
185
+
Edit a config file that monitors SSH logins.
186
+
187
+
sudo nano /etc/fail2ban/jail.local
188
+
189
+
Add the following lines to the bottom of the file.
190
+
Whitelisting IP address tip: The ignoreip parameter accepts IP addresses, IP ranges or DNS hosts that you can specify to be allowed to connect. This is where you want to specify your local machine, local IP range or local domain, separated by spaces.
191
+
192
+
193
+
[sshd]
194
+
enabled = true
195
+
port = 22
196
+
filter = sshd
197
+
logpath = /var/log/auth.log
198
+
maxretry = 3
199
+
# whitelisted IP addresses
200
+
# ignoreip = <list of whitelisted IP address, your local daily laptop/pc>
201
+
202
+
Save/close file.
203
+
Restart fail2ban for settings to take effect.
204
+
205
+
sudo systemctl restart fail2ban
206
+
207
+
## 2.8 Configure your Firewall
208
+
The standard UFW firewall can be used to control network access to your node. With any new installation, ufw is disabled by default. Enable it with the following settings.
209
+
210
+
By default, deny all incoming and outgoing traffic
211
+
212
+
sudo ufw default deny incoming
213
+
sudo ufw default allow outgoing
214
+
215
+
Allow ssh access
216
+
217
+
sudo ufw allow ssh
218
+
219
+
Allow p2p ports
220
+
221
+
sudo ufw allow 13000/tcp
222
+
sudo ufw allow 12000/udp
223
+
224
+
Allow eth1 port
225
+
226
+
sudo ufw allow 30303/tcp
227
+
sudo ufw allow 30303/udp
228
+
229
+
Allow tezos node P2P and RPC connections
230
+
231
+
sudo ufw allow 9732/tcp
232
+
233
+
Enable firewall
234
+
235
+
sudo ufw enable
236
+
237
+
Check status
238
+
239
+
sudo ufw status verbose
240
+
241
+
Might want to enable ufw logging
242
+
243
+
sudo ufw logging on
244
+
245
+
>Note It is dangerous to open 3000 / 9090 for Grafana or Prometheus on a VPS/cloud node.
246
+
247
+
## 2.9 Verify Listening Ports
248
+
If you want to maintain a secure server, you should validate the listening network ports every once in a while. This will provide you essential information about your network.
0 commit comments