A procedure to create a reasonably safe server host with GUI (Xubunutu).
You might find it useful, if you need:
- A bare-bone installation (E.g., without open-office or a browser) but with all the creature-comfort of a graphical desktop, sound, GUI network setup, etc (not lots of etc)
- Smaller attack surface
For a laptop secure storage, I like the 1T SSD 970pro, made by a well known Korean company.
This drive supports the OPAL2 encryption standard. Just make sure you actually turn the FDE (Full Disk Encryption) On.
-
Install Ubuntu 22.04 server:
I like to configure my own partitions, but this is just me. Also, I like the main partition (/home) to be xfs. YMMV. Details instructionsBefore you continue, make sure networking is working
-
You may perform the rest of the steps below automatically using Ansible. Copy the repository to the remote machine and execute
cd ansible; ./INSTALL
-
Install Xubuntu core and misc packages:
This will add Graphical desktop and related utilities, W/O any applications.
After the server is up, run:sudo apt update sudo apt install net-tools build-essential sudo apt install xubuntu-core^ # Notice the ^ at the end of the line
Note: we are using 'xubuntu-core' and not 'xubuntu-desktop' to discourage use of the host for 'personal productivity' tasks, such as browsing the Internet or using Office.
-
Disable IPv6
At /etc/default/grub, replace the line:
GRUB_CMDLINE_LINUX_DEFAULT=""
with:
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"
and then runupdate-grub
-
Install Iptables
sudo apt remove --purge ufw
sudo apt install iptables-persistent
See appendix A for the rules file -
Optional: disable CUPS
systemctl disable cups.service
-
Optional: autologin
As root, create the file /etc/lightdm/lightdm.conf.d/70-autologin.conf with the contents:
[SeatDefaults] autologin-user=YOUR-USER-NAME
-
Minor: Remove un-needed folders
rmdir Public Templates Videos Music Documents
-
Enable network manager (NM is not active by default on a server, which is the base we use)
First try the following:
-
As root, edit the file
/etc/netplan/00-installer-config.yaml
: Add the linerenderer: NetworkManager
after the linenetwork:
Those should be the first 3 lines of the file after the edit:network: renderer: NetworkManager version: 2
-
As root, run:
netplan generate
andnetplan apply
Note: This will eliminate any predefined network connections Note: Make sure you perform this step AFTER installing the Xubuntu-core sw (as this installs network-manager)`
If the above did not work, try the following:
Source: []https://askubuntu.com/questions/71159/network-manager-says-device-not-managed
- sudo nano /etc/NetworkManager/NetworkManager.conf
change the line
managed=false
tomanaged=true
- Backup and then edit
/etc/network/interfaces
to contain EXACTLY:
auto lo
iface lo inet loopback
- Surprisingly, Network Manager wont actually control wired connections w/o the below steps:
su cd /etc/NetworkManager/conf.d/ mv 10-globally-managed-devices.conf orig_10-globally-managed-devices.conf touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
- Restart Network Manager:
sudo service network-manager restart
-
-
Adjust the desktop:
- Turn off the screen-saver
- Turn off the power-manager control of the display
- Turn off the blank-display on no-activity
Tip: get the values to change by using watch-xfce-xfconf
-
Turn off the systemd networkd-wait-online service
This service will cause the PC to wait ~2 minutes at boot time, if not all networks are connected
systemctl disable systemd-networkd-wait-online.service
Shalom Mitz - shalommmitz
This project is licensed under the MIT License - see the LICENSE file for details.
Nothing in this repository is new or original. I did not add references, but almost all the commands below have been googled - you can google them too.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
#-A INPUT -m state --state NEW -m tcp -p TCP --dport 7777 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -j REJECT --reject-with icmp-port-unreachable
COMMIT
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -j REJECT
-A OUTPUT -j REJECT
-A FORWARD -j REJECT
COMMIT