Skip to content

Provision & Setup Ubuntu Server 22.04

Prerequisites

  • VirtualBox installed.
  • Virtual Machine with Ubuntu 22.04 ISO Server has been configured and provisioned (the ISO should be attached to the new VM).
  • Windows Server 2025 with Active Directory Domain Services (ADDS) configured.

Network Topology

Base Layout
(Click to zoom)

Email Security Server Overview

Overview

An email server is a system designed to send, receive, store, and manage email communication for users. It uses protocols such as:

  • SMTP (Simple Mail Transfer Protocol) for sending emails
  • IMAP (Internet Message Access Protocol) or POP3 (Post Office Protocol) for receiving and managing email messages

We will configure Postfix as a Mail Transfer Agent (MTA) for sending and routing emails on Linux servers.

Email servers are less common today due to the rise of managed services like Gmail, Microsoft 365, and ProtonMail. However, setting up an email server provides insight into email security and infrastructure.

Security Implications

Running an email server introduces security risks:

  • Open Relay Exploitation – Spammers can misuse an open relay server.
  • Brute Force Attacks – Attackers attempt credential stuffing.
  • Spam and Phishing – Attackers may spoof domains for phishing campaigns.
  • Data Breaches – Poor security may expose sensitive emails.
  • Malware Delivery – Attachments may spread malware if unscanned.

Setup Security Server

Press Enter.

Base Layout
(Click to zoom)

Select language. Continue without updating.

Base Layout
(Click to zoom)
Base Layout
(Click to zoom)

Choose Ubuntu Server.

Base Layout
(Click to zoom)

Leave default Network configuration and Proxy Page empty.

Base Layout
(Click to zoom)

Leave “Mirror” configuration empty ➔ “Done”.

Base Layout
(Click to zoom)

Select "Use an entire disk"Done.

Base Layout
(Click to zoom)

Leave Storage Configuration as default.

Base Layout
(Click to zoom)

Arrow to continue.

Base Layout
(Click to zoom)

Configure hostname, username, and password.

Base Layout
(Click to zoom)

👉 Refer to the “Project Overview” guide for more information on default usernames and passwords.

Skip Ubuntu Pro, install OpenSSH Server → Done.

Base Layout
(Click to zoom)

Use the Tab key until selecting “Done”.

Base Layout
(Click to zoom)

Wait for installation, then reboot.

Base Layout
(Click to zoom)

Success!

Base Layout
(Click to zoom)

Connect Ubuntu Desktop to Active Directory

👉 Switch network from NAT Network to Bridged.

👉 Refer to VirtualBox guide for clipboard sharing.

Ubuntu can join Active Directory via Realmd + SSSD or Samba Winbind.

SSSD (System Security Services Daemon). Samba Winbind can also be used to join Linux systems if realmd / SSSD is not working.

❗ Currently realmd and SSSD integration do not work for Windows Server 2025 and Debian/Ubuntu-based systems.

About SSSD / Realmd

  • System Security Services Daemon (SSSD): A service on Linux systems that provides a central access point for identity management and authentication. When connecting a Linux system to Active Directory (AD), SSSD allows for the integration by acting as an intermediary between the Linux system and AD needing to know what files should be edited.
  • realmd: A tool that simplifies the process of joining Linux machines to AD domains. It automates the discovery, configuration, and enrollment of Linux systems in Active Directory, making it easier to integrate Linux systems into existing AD environments. Realmd is especially useful for administrators because it manages the complexities of setting up Kerberos, configuring LDAP settings, and ensuring proper authentication protocols.
  • realmd is a tool that automates domain joining and manages configurations for sssd, which provides caching, more flexible configuration options, and better performance.

About Samba Winbind

  • Samba Winbind: A component of the Samba suite that allows Linux systems to authenticate users against Windows Active Directory (AD) and integrate with Windows network environments. Is a more direct integration, especially useful for legacy systems and environments where tight compatibility with Windows protocols is necessary. It’s often preferred when working in older Windows Server environments or where native Samba compatibility is crucial.

Realmd + SSSD

  1. Open a terminal:
sudo apt update
  1. Edit time synchronization settings:
sudo nano /etc/systemd/timesyncd.conf
Base Layout
(Click to zoom)

Install required packages:

sudo apt install realmd sssd sssd-tools samba-common krb5-user packagekit libnss-sss libpam-sss adcli samba-common-bin
Base Layout
(Click to zoom)
  1. Discover the domain:
realm discover
Base Layout
(Click to zoom)
  1. Join the domain:
sudo realm join --verbose --user=Administrator corp.project-x-dc.com
  1. Verify the connection:
realm list

Samba Winbind

  1. Open a terminal:
sudo apt update

Install packages:

sudo apt -y install winbind libpam-winbind libnss-winbind krb5-config krb5-user samba-dsdb-modules samba-vfs-modules
Add CORP.PROJECT-X-DC.COM for the two Kerberos Authentication pages.

Base Layout
(Click to zoom)
Base Layout
(Click to zoom)
Base Layout
(Click to zoom)
  1. Move the existing SMB config:
mv /etc/samba/smb.conf /etc/samba/smb.conf.org
  1. Create a new configuration:
sudo nano /etc/samba/smb.conf

Add the following:

bash [global] kerberos method = secrets and keytab realm = CORP.PROJECT-X-DC.COM workgroup = CORP security = ads template shell = /bin/bash winbind enum groups = Yes winbind enum users = Yes winbind separator = + idmap config * : rangesize = 1000000 idmap config * : range = 1000000-19999999 idmap config * : backend = autorid

  1. Update NSS:
sudo nano /etc/nsswitch.conf

Add if needed.

Base Layout
(Click to zoom)
  1. On Ubuntu, every user that has an interactive logon to the system needs a home directory. For domain users, we need to set this before a user is able to successfully logon and start working.

Issue the following command: sudo pam-auth-update

Scroll down up to the point where it states:” Create home directory on login“. Use the space bar to select, tab to “OK” and hit enter.

Base Layout
(Click to zoom)

Kudos to Michael Waterman for the screenshot!

  1. Change DNS settings:

Change DNS settings to refer to AD: sudo nano /etc/resolv.conf

Base Layout
(Click to zoom)

Add corp.project-x-dc.com to /etc/hosts: sudo nano /etc/hosts

Base Layout
(Click to zoom)

👉 Change Network settings from Bridged ➔ NAT Network (project-x-network).

  1. Join the domain with Administrator: sudo net ads join -U Administrator

  2. Restart winbind: systemctl restart winbind

  3. Get Active Directory services information listing. net ads info

  4. List all available users.

wbinfo -u

Base Layout
(Click to zoom)
  1. Let’s create email-svr’s AD account in our Domain Controller. Go to Server Manager, then on the top right “Tools” ➔ “Active Directory Users and Computers”.
Base Layout
(Click to zoom)

Navigate to the “Users” folder. Right-click, then go to “New” ➔ “User”

Base Layout
(Click to zoom)

Add the following information. [email protected]

Base Layout
(Click to zoom)

Set email-svr’s password (@password123!).

👉 Refer to the “Project Overview” guide for more information on default usernames and passwords.

Base Layout
(Click to zoom)

Clear the winbind cache by restarting the service, then see the changes reflected. sudo systemctl restart winbind wbinfo -u

Base Layout
(Click to zoom)
  1. Login as email-svr (CORP+email-svr): sudo login
Base Layout
(Click to zoom)
  1. Issue an id command to view status: id

Success!

Base Layout
(Click to zoom)

Going back to the Server Manager, we should see “LINUX-CLIENT” under the “Computers” folder.

Base Layout
(Click to zoom)

📷 Take Snapshot!

Base Layout
(Click to zoom)