Passa ai contenuti principali

Linux CentOS 7 - Postfix configuration

Linux CentOS 7 - Postfix configuration


Configure system1 as a mail server and system2 as a null client.
From the null client, user alice can send mails to user bob on the mail server.

On system1 and system2

Install the packages:
# yum install -y postfix mailx

Enable and start the service:
# systemctl start postfix
# systemctl enable postfix

Adjust the firewall
firewall-cmd --permanent --add-service=smtp
firewall-cmd --reload


On system1

Configure the server

vim /etc/postfix/main.cf
myhostname = system1.example.com
mydomain = example.com
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
inet_interface = all
mynetworks = 192.168.189.0/24, 127.0.0.0/8
inet_protocols = ipv4

Check the configuration
postfix check

Restart the service
systemctl restart postfix

Add user bob
useradd bob

Check bob received alice's message

su - bob
mail
type 1

From alice@example.com  Sun Jun 23 21:57:45 2019
Return-Path: <alice@example.com>
X-Original-To: bob@example.com
Delivered-To: bob@example.com
Date: Sun, 23 Jun 2019 21:57:45 +0200
To: bob@example.com
Subject: test
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
From: alice@example.com
Status: R

hi bob, how are you?

& exit



On system2

Configure the null client
vim /etc/postfix/main.cf
myhostname = system2.example.com
mydomain = example.com
myorigin = $mydomain
mydestination =
inet_interface = loopback-only
relayhost = 192.168.189.143
mynetworks = 127.0.0.0/8 
inet_protocols = ipv4 
local_transport = error: local delivery disabled 


Check the configuration
postfix check

Restart the service
systemctl restart postfix

Add user alice
useradd alice

As user alice,  send an email to bob
su - alice
mail -s test bob@example.com
hi bob, how are you?
.
exit

Check the post queue
postqueue -p

Flush the post queue
postqueue  -f

Check the mail log in real time
tail -f /var/log/messages



Commenti

Post popolari in questo blog

Using Wallys Communications DR4018H access point Introduction WiFi Analyzer is an open-source app for Android, available for download from Google Play. It allows the user to optimize their WiFi network by examining surrounding WiFi networks, measuring their signal strength as well as identifying crowded channels. This application does not require access to internet, therefore it does not send any personal/device information to any other source and it does not receive any information from other sources. I installed it on my Samsung Galaxy smartphone and I tested the connection to the Wallys Communications DR4018H access point (see picture below) . The findings are described below. Procedure I linked the AP to my home router in the entrance hall of my apartment. The SSID is called “WIFIA” and the smartphone is connected. It receives a local IP address from the router directly connected to the AP.     The received power at abo...

Linux CentOS 7 - Mounting the iso file as a CD-ROM

Linux CentOS 7 - Mounting the iso file as a CD-ROM in a repo Mount the iso file as a CD-ROM in a repository. Provided your iso file contains the complete operative system, this allows you to disable the default repositories and mirrors and install all required packages without downloading them from the internet. In other words you can work off-line. On system1 and/or system2 Edit the repo file vim /etc/yum.repos.d/CentOS-CD.repo [CentOS-CD] name =  CD ROM baseurl = file:///media/CentOS gpgcheck = 0 enabled = 1 Mount the iso file as a CD-ROM in a repository. Make a mount point mkdir /media/CentOS Edit the fstab file /dev/cdrom     /media/CentOS   iso9660   loop 0 0 mont -a Verify df -Th it must return the /dev/loop0 disk yum repolist it must show the repositories contained in the iso file.

Linux CentOS 7 - Configuring a cache-only DNS

Linux CentOS 7 - Configuring a cache-only DNS Configure a cache only DNS server which forwards requests to the well known Google DNS server. On system1 Install the unbound package # yum install -y unbound Enable and start the service # systemctl enable unbound && systemctl start unbound Adjust the configuration file # vim /etc/unbound/unbound.conf interface: 0.0.0.0                       ## all interfaces access-control: 0.0.0.0/0 allow ## from all networks forward-zone      name: "."                              ## from any domain      forward-addr: 8.8.8.8           ## DNS server towards which all requests will be forwarded Check configuration  # unbound-checkconf Modify the DNS server on the interface configuration # vim /etc/sysconfig/network-scripts/ifc...