Kamis, 21 Desember 2017

How To Buy The Farm Systems Inventory I.E. Ram, Disk, Cpu In Addition To Operating Systems Data Using Powershell Inward Domain.

Every System Administrator needs to hold Server Inventory together with operate yesteryear on it update, So hither is an automated script to delineate all the information using Powershell script. 

Let's re-create the script below together with salvage it equally Server_Inventory.PS1.
If y'all convey few servers y'all tin dismiss define mention manually or y'all tin dismiss read northward release of the organisation from a file.   


Create Pc.txt file equally inward below format

Server1 Server2 Server2 

Copy the Script together with Save as Server_Inventory.PS1.
#Define Systems Name or y'all tin dismiss read them from a file using ascendancy (Get-Content -Path D:\pc.txt) $pc = (Get-Content D:\PC.txt) #change this path amongst your .txt file $infocoll = @() foreach ($PCS inward $pc) {         #Here We tin dismiss role multiple ascendancy to become the data          $hostname = (Get-WmiObject -Class win32_processor -ComputerName $PCS).systemname          $HDDInfo = Get-WmiObject -Class win32_diskdrive -ComputerName $PCS | Measure-Object -Property size -Sum | % { [math]::Round(($_.sum / 1GB ), 2) }         $RamInfo = Get-WmiObject -Class win32_physicalmemory -ComputerName $PCS | Measure-Object -Property Capacity -Sum | % {[math]::Round(($_.sum / 1GB), 2)}         $Cdrive = Get-WmiObject -Class win32_logicaldisk -ComputerName $PCS |   where deviceid -EQ 'C:'          $CDrivePercentuse= (($Cdrive).size -($Cdrive).freespace)*100/($Cdrive).size         $CpuInfo = (Get-WmiObject -Class win32_processor -ComputerName $PCS).Name         $OSInfo = (Get-WmiObject -Class win32_operatingsystem -ComputerName $PCS).Name                 foreach($CPU inward $hostname)         { $infoObject = New-Object PSObject         #Define the Value to each objet y'all desire to add together into the .CSV file.          Add-Member -InputObject $infoObject -MemberType NoteProperty -Name "ServerName" -Value $hostname         Add-Member -InputObject $infoObject -MemberType NoteProperty -Name "HDD SIZE inward GB" -Value $HDDInfo         Add-Member -InputObject $infoObject -MemberType NoteProperty -Name "C Drive Use IN %" -Value $CDrivePercentuse         Add-Member -InputObject $infoObject -MemberType NoteProperty -Name "CPU Detail" -Value $CpuInfo         Add-Member -InputObject $infoObject -MemberType NoteProperty -Name "RAM Detail inward GB" -Value $RamInfo         Add-Member -InputObject $infoObject -MemberType NoteProperty -Name "O.S Name" -Value $OSInfo                 $infoObject         $infocoll += $infoObject                  }     }  # Export all the information to a .CSV file together with shop the somewhere else y'all want.  $infocoll | Export-Csv -Path "D:\Serverinvt.csv" -NoTypeInformation  

Run the Script together with y'all volition become output inward a CSV file equally inward the event below.




Thank y'all All!!



Sumber https://linuxhowtoguide.blogspot.com/

Selasa, 28 November 2017

How To Terminal Too Get-Go Service Using Powershell Until Service Condition Equal To Started Or Stopped

Powershell gives us functionality to halt or showtime service until either it's fully stopped or started. 
Lest re-create together with glue this script into notepad together with salve every moment stop-start-service.ps1 name. supervene upon service cite alongside the service cite y'all desire to restart. inward my case, I am restarting World broad spider web service.

@" =============================================================================== Title:               Start together with Stop Service  Description:         Stop, Start Requirements:        Windows Powershell  Author:              Amar Singh Date:                November 29, 2017 =============================================================================== "@   # Define Service Name $servicename = "w3svc"  #To halt the service Stop-Service $servicename -Verbose  do { Start-Sleep ten } until((Get-Service $servicename).Status -eq "stopped")   #To Start Service Start-Service $servicename -Verbose  produce { Start-Sleep ten } until ((Get-Service $servicename).Status -eq "running")   #To Validate service status Get-Service $servicename start-sleep 10














AT the cease of script compilation y'all drib dead the condition of service on your screen.

Thank you!!!



Sumber https://linuxhowtoguide.blogspot.com/

Kamis, 31 Agustus 2017

[Solved] Mistake 3167 (Hy000) The 'Information_Schema.Global_Variables' Characteristic Is Disabled Run Into The Documentation For 'Show_Compatibility_56'


You mightiness leave of absence the fault below during MySQL database restore to 5.7 in addition to the backup taken from MySQL 5.6 server.
ERROR 3167 (HY000): The 'INFORMATION_SCHEMA.GLOBAL_VARIABLES' characteristic is disabled; encounter the documentation for 'show_compatibility_56'
To solve this consequence allow follow the steps below:
Step 1:- Check MySQL compatibility
By default MySQL 5.7 doesn't allow to restore 5.6 databases. For this, We require to enable MySQL 5.6 compatibility. Let's banking concern lucifer this using ascendence below:
mysql> SHOW VARIABLES LIKE "%compatibility%"; +-----------------------+-------+ | Variable_name         | Value | +-----------------------+-------+ | show_compatibility_56 | Off    | +-----------------------+-------+ ane row inwards fix (0.00 sec) 

That agency yours MySQL 5.7 server doesn't conduct maintain enabled 5.6 database compatibility.
Step 2:- Enable MySQL 5.6 compatibility
Let's enable MySQL 5.6 compatibility in addition to hence nosotros tin restore the database to MySQL 5.7 server.
mysql> SET GLOBAL show_compatibility_56 = ON;
Now MySQL5.6 compatibility has been enabled in addition to you lot tin restore a database that backed upwards from MySQL 5.6 Server.
Step 3:-  Let's validate compatibility status:
Let's hitting ascendence below to banking concern lucifer condition whether it's enabled or not.
mysql> SHOW VARIABLES LIKE "%compatibility%"; +-----------------------+-------+ | Variable_name         | Value | +-----------------------+-------+ | show_compatibility_56 | ON| +-----------------------+-------+ ane row inwards fix (0.00 sec)

Compatibility has been enabled successfully. Now, you lot tin restore a database backup taken from MySQL5.6 server.


Sumber https://linuxhowtoguide.blogspot.com/

Kamis, 24 Agustus 2017

How To Configure/Run Multiple Php Version On Unmarried Linux Machine.

PHP: -
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used opened upwards source general-purpose scripting linguistic communication that is peculiarly suited for spider web evolution in addition to tin hold out embedded into HTML.

PHP is mainly focused on server-side scripting, in addition to therefore y'all tin practise anything whatever other CGI programme tin do, such equally collect shape data, generate dynamic page content, or post in addition to have cookies. But PHP tin practise much more.


There are iii original areas where PHP scripts are used:
  • Server-side scripting. This is the almost traditional in addition to original target champaign for PHP. You demand iii things to brand this work: the PHP parser (CGI or server module), a spider web server in addition to a spider web browser. You demand to run the spider web server, alongside a connected PHP installation. You tin access the PHP programme output alongside a spider web browser, viewing the PHP page through the server. All these tin run on your abode machine if y'all are only experimenting alongside PHP programming.
  • Command business scripting. You tin brand a PHP script to run it without whatever server or browser. You solely demand the PHP parser to work it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts tin besides hold out used for unproblematic text processing tasks.
  • Writing desktop applications. PHP is likely non the really best linguistic communication to practise a desktop application alongside a graphical user interface, but if y'all know PHP really well, in addition to would similar to work closed to advanced PHP features inward your client-side applications y'all tin besides work PHP-GTK to write such programs. You besides convey the might to write cross-platform applications this way. PHP-GTK is an extension for PHP, non available inward the original distribution.




























Prerequisites:- We demand next earlier rootage configuring multiple PHP. 
  • Linux Machine
  • One user alongside Sudoers privileges.
  • Working Internet on that machine.
Step 1-  Check Linux release
Before, We rootage configuring PHP nosotros demand to depository fiscal establishment fit our Linux Machine version. Use the dominance below to check.
[root@cent  ]# cat /etc/redhat-release CentOS unloose 6.8 (Final) 
In my electrical flow scenario, I am using CentOS 6.8 Final release. 
Step 2- Install Webserver (HTTPD).
We demand to install Web server httpd. allow work yum dominance to rootage the installation.
[root@cent  ]# yum install httpd
Start httpd service
[root@cent  ]# service httpd start
Step 3- Enable Name Virtual Host
In companionship to setup multiple Virtual Host, nosotros demand to enable NameVirtualHost inward the httpd.conf file.
[root@cent  ]# vi /etc/httpd/conf/httpd.conf
Let's uncomment next line.
# Use name-based virtual hosting. # NameVirtualHost *:80 # # NOTE: NameVirtualHost cannot hold out used without a port specifier 
Save in addition to Exit from the File.
Restart httpd service to apply changes.
[root@cent  ]# service httpd restart
Step 4- Enable port lxxx to allow access from outside.
In companionship to access the Web server from exterior nosotros demand to enable Port 80, let's work the dominance below.
[root@cent  ]# vi /etc/sysconfig/iptables 
Append this business to this file in addition to salve it.
-A INPUT -m field --state NEW -m tcp -p tcp --dport lxxx -j ACCEPT 
Restart iptables service to apply changes.
[root@cent  ]# service iptables restart iptables: Setting chains to policy ACCEPT: filter          [  OK  ] iptables: Flushing firewall rules:                         [  OK  ] iptables: Unloading modules:                               [  OK  ] iptables: Applying firewall rules:                         [  OK  ] 
Step 5- Install PHP5.3
I am going to install PHP version 5.3 in addition to PHP 5.6. let's follow the steps below to install both the version.
5A- Install PHP5.3 Version.
[root@cent  ]# yum install php php-cli php-common php-gd php-curl  =============================================================================================================================================================================================  Package                                        Arch                                       Version                                            Repository                                Size ============================================================================================================================================================================================= Installing:  php                                            x86_64                                     5.3.3-49.el6                                       base of operations                                     1.1 M  php-cli                                        x86_64                                     5.3.3-49.el6                                       base of operations                                     2.2 M  php-common                                     x86_64                                     5.3.3-49.el6                                       base of operations                                     530 k  php-gd                                         x86_64                                     5.3.3-49.el6                                       base of operations                                     111 k  Transaction Summary ============================================================================================================================================================================================= Install       four Package(s)  Total download size: 3.9 M Installed size: thirteen M Is this ok [y/N]: Y 
5B- Check PHP Version
[root@cent  ]# php -v PHP 5.3.3 (cli) (built: Mar 22 2017 12:27:09) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies 
PHP Version 5.3 has been installed alongside default repo.
Step 6- Install PHP5.6
PHP5.6 is non available inward default repo, For this, nosotros demand to add together an additional repository, Let's work the dominance below to install repo.
6A- Install additional repo:
you tin teach required repo equally per your OS from the next link.
[root@cent  ]# yum install http://rpms.remirepo.net/enterprise/remi-release-6.rpm  Dependencies Resolved  =============================================================================================================================================================================================  Package                                      Arch                                   Version                                           Repository                                       Size ============================================================================================================================================================================================= Installing:  remi-release                                 noarch                                 6.9-1.el6.remi                                    /remi-release-6                                  12 k  Transaction Summary ============================================================================================================================================================================================= Install       i Package(s)  Total size: 12 k Installed size: 12 k Is this ok [y/N]: y 
6B- Install PHP56 Version
[root@cent  ]# yum install php56  php56-php-cli php56-php-common php56-php-pear  php56-php-process  php56-php-xml  php56-php-gd
5C- Check PHP Version
[root@cent  ]# php56 -v PHP 5.6.31 (cli) (built: Jul  six 2017 07:38:45) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies 
Both the PHP Versions has installed successfully.
Step 7- Configure  Virtual Host for  PHP version 5.3
We are going to work PHP-CGI to execute both the PHP version simultaneously.
7A-  First, rename php.conf file if exist. 

[root@cent  ]# mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.bak
7B- Setup FastCGI for PHP version 5.3
 First, practise a folder nether Virtual host document root directory.
[root@cent  ]#  mkdir -p /home/php53/public/cgi-bin/
7C- Create FastCGI configuration file.

Let's discovery your php.ini for PHP version 5.3 in addition to PHP-CGI using discovery command.
To discovery php.ini
[root@cent  ]# find / -name php.ini /etc/php.ini /opt/remi/php56/root/etc/php.ini
To discovery php-cgi
[root@cent  ]# find / -name php-cgi /opt/remi/php56/root/usr/bin/php-cgi /usr/bin/php-cgi 
7C- Create FastCGI configuration file.
[root@cent  ]#  vi /home/php53/public/cgi-bin/php.fastcgi
Append next business equally per inward a higher identify finding. In my example for PHP 5.3 is the deault path.

#!/bin/bash PHPRC="/etc/php.ini" PHP_FCGI_CHILDREN=4 PHP_FCGI_MAX_REQUESTS=1000 export PHPRC export PHP_FCGI_CHILDREN export PHP_FCGI_MAX_REQUESTS exec /usr/bin/php-cgi 
Save in addition to Exit from the File.
7D- Make the script executable.
[root@cent  ]#  chmod +x /home/php53/public/cgi-bin/php.fastcgi
7E- Setup Virtual Host 
[root@cent  ]#  vi /etc/httpd/conf.d/php53.conf
Add next lines 

<VirtualHost *:80>     ServerAdmin asingh@ishir.com     DocumentRoot /home/php53/public/     ServerName php53.local     ErrorLog /home/php53/logs/error.log     CustomLog /home/php53/logs/access_log mutual         ScriptAlias /cgi-bin/ "/home/php53/public/cgi-bin/"     <Directory "/home/php53/public/">             Options +Indexes FollowSymLinks +ExecCGI             AddHandler php5-fastcgi .php             Action php5-fastcgi /cgi-bin/php.fastcgi             AllowOverride All             Order allow,deny             Allow from All     </Directory> </VirtualHost>  
Save in addition to Exit from the file.
7F- restart httpd.

[root@cent  ]#  service httpd restart
7G- Check PHP version.

[root@cent  ]# vi /home/php53/public/info.php
Append the next content.

<?php phpinfo(); ?> 
Save in addition to teach out from the file.
7H- Test PHP page. Hit the below URL to depository fiscal establishment fit php info.
http://php53.local/info.php
Step 8- Configure  Virtual Host for  PHP version 5.6:
Follow the steps below to configure FastCGI in addition to Virtual Host.
8A- Setup FastCGI for PHP version 5.6
First, practise a folder nether Virtual host document root directory.

[root@cent  ]#  mkdir -p /home/php56/public/cgi-bin/
8B- Create FastCGI configuration file.

[root@cent  ]#  vi /home/php56/public/cgi-bin/php.fastcgi
Append next line

#!/bin/bash PHPRC="/opt/remi/php56/root/etc/php.ini" PHP_FCGI_CHILDREN=4 PHP_FCGI_MAX_REQUESTS=1000 export PHPRC export PHP_FCGI_CHILDREN export PHP_FCGI_MAX_REQUESTS exec /opt/remi/php56/root/usr/bin/php-cgi  
Save in addition to Exit from the file.
8C- Make the script executable.

[root@cent  ]#  chmod +x /home/php56/public/cgi-bin/php.fastcgi
8d- Setup Virtual Host 

[root@cent  ]#  vi /etc/httpd/conf.d/php56.conf
Add next lines 

<VirtualHost *:80>     ServerAdmin asingh@ishir.com     DocumentRoot /home/php56/public/     ServerName php56.local     ErrorLog /home/php56/logs/error.log     CustomLog /home/php56/logs/access_log mutual         ScriptAlias /cgi-bin/ "/home/php56/public/cgi-bin/"     <Directory "/home/php56/public/">             Options +Indexes FollowSymLinks +ExecCGI             AddHandler php5-fastcgi .php             Action php5-fastcgi /cgi-bin/php.fastcgi             AllowOverride All             Order allow,deny             Allow from All     </Directory> </VirtualHost>  
Save in addition to Exit from the file.

8E- restart httpd.

[root@cent  ]#  service httpd restart
8F- Check PHP version.

[root@cent  ]# vi /home/php56/public/info.php
Append the next content.

<?php phpinfo(); ?> 

Save in addition to teach out from the file.
8G- Test PHP page- Hit the below URL to depository fiscal establishment fit php info.
http://php56.local/info.php

Both the PHP Version Configured successfully in addition to working equally expected.


Thank y'all for Reading this blog!!!

Sumber https://linuxhowtoguide.blogspot.com/

Senin, 17 Juli 2017

Step Past Times Stride Setting Upwards A Ship Server Debian-9.0: Postfix, Dovecot, Mysql As Well As Postfixadmin

Mail Server: - 

Building a Mail Server on Linux Machine using unlike packages that separately handgrip SMTP, POP too IMAP. Where you lot tin john create produce entire things including bundle installation configuration etc. 

Our Goal: -

  • Postfix: sends too receives post service via the SMTP protocol. It volition alone relay post service on to other post service servers if the e-mail is sent past times an authenticated user, but anyone tin john send post service to this server for local delivery.
  • Dovecot: Influenza A virus subtype H5N1 POP too IMAP server that manages local post service directories too allows users to log inward too download their mail. It also handles user authentication.
  • Postgrey: Greylists incoming mail, requiring unfamiliar deliverers to hold off for a piece too so resend. This is ane of the improve tools for cutting downwardly on spam.
  • Amavisd-new: a manager for organising diverse antivirus too spam checking content filters
  • Clam Antivirus: A improve tool to Scan Emails
  • SpamAssassin: for sniffing out spam inward emails.
  • Postfix Admin: Influenza A virus subtype H5N1 proficient spider web interface to create produce Domain, Mailbox, Alias etc.
  • RoundCube: Influenza A virus subtype H5N1 spider web post service customer tool. 


Install too Configure E-mail server:

Step 1: -  DNS Change
You convey to laid upwardly your DNS amongst an A tape that points to your post service server IP too an MX tape that points to the post service servers hostname.

A           tony.in                192.168.102.10 MX          mail.tony.in           192.168.102.10 
Step 2: -  Setup Hostname
We demand to setup hostname 
hostname mail.tony.in
Now laid the contents of /etc/hostname to live the hostname:
echo "mail.tony.in" /etc/hostname
And add together your hostname to the showtime line of /etc/hosts:
127.0.0.1    mail.tony.in    mail
Step 3: - Install LAMP Web Server:
We demand LAMP server to handgrip PostfixAdmin spider web interface too to create produce RoundCube spider web based e-mail client.
3A- Install Apache:-
root@mail:/home/amar# apt install apache2
3B- Install MySQL:
root@mail:/home/amar# apt install mysql-client mysql-server php-mysql
After installing  Mysql let's perform post installation task, run mysql_secure_installlation ascendancy to setup initial setting.
root@mail:/home/amar# mysql_secure_installation
Press enter button when inquire for electrical flow password too follow the education for other changes you lot may require.
3C- Install PHP:
root@mail:/home/amar# apt install php7.0 php7.0-mcrypt php7.0-curl php7.0-gd php7.0-mbstring php-apcu libapache2-mod-php7.0
Step 4: - Allow required Port through Firewall
We demand to allow next ports inward the firewall to communicate our server amongst the world.
  • 80 (HTTP) 
  • 25 (SMTP) 
  • 110 (POP3) 
  • 143 (IMAP) 
  • 465 (SMTPS) 
  • 993 (IMAPS) 
  • 995 (POPS)
Step 5: - Install Mail server
Please run the ascendancy below to install postfix too enter hostname mail.tony.in during installation procedure when asked.
5A- Postfix Install
root@mail:/home/amar# apt install postfix postfix-mysql  
5B- DoveCot Install
root@mail:/home/amar# apt install dovecot-core dovecot-mysql dovecot-imapd dovecot-pop3d
5C- Install all other packages including  postgrey, ClamAV  Antivirus and SpamAssassin
root@mail:/home/amar# apt install \ >   postgrey \ >   amavis \ >   clamav \ >   clamav-daemon \ >   spamassassin \ >   libdbi-perl \ >   libdbd-mysql-perl \ >   php7.0-imap \ >   postfix-policyd-spf-python
5D- Next, nosotros demand to install few optional packages that extend the abilities of the spam too virus detection, Use the ascendancy below.
root@mail:/home/amar# apt install \ >  pyzor \ >   razor \ >   arj \ >   cabextract \ >   lzop \ >   nomarch \ >   p7zip-full \ >   ripole \ >   rpm2cpio \ >   tnef \ >   unzip \ >   unrar-free \ >   zip \ >   zoo 
5E- Use OpenSSL to Create a Unique Diffie-Helman Group
openssl dhparam -out /etc/ssl/private/dhparams.pem 2048 chmod 600 /etc/ssl/private/dhparams.pem
Step 6: - Configure MySQL 
A few alterations to the default MySQL configuration in /etc/mysql/mariadb.conf.d/50-server.cnf are needed. Add the following:
root@mail:/home/amar# vi /etc/mysql/mariadb.conf.d/50-server.cnf
6A- Append next line relieve file too restart MySQL service.
user            = mysql pid-file        = /var/run/mysqld/mysqld.pid socket          = /var/run/mysqld/mysqld.sock port            = 3306 basedir         = /usr datadir         = /var/lib/mysql tmpdir          = /tmp lc-messages-dir = /usr/share/mysql sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION 
6B- Create a database:
Use ascendancy below to create a database too assign permission 
root@mail:/home/amar# mysql -u root -p Enter password: *******  MariaDB [(none)]> create database mail; Query OK, 1 row affected (0.00 sec)  MariaDB [(none)]> grant all on mail.* to 'mail'@'localhost' identified past times 'mailpassword'; Query OK, 0 rows affected (0.00 sec)  MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec)  
6C- Now Restart MySQL service
root@mail:/home/amar# systemctl restart mysql
Step 7: - Install  and Configure Postfix Admin:
Postfix Admin is installed equally follows. To start things off, download the bundle from Sourceforge, unpack it, displace it into a subdirectory of your webroot, too alter ownership to the www-data user:
root@mail:/home/amar# wget http://downloads.sourceforge.net/project/postfixadmin/postfixadmin/postfixadmin-3.0.2/postfixadmin-3.0.2.tar.gz root@mail:/home/amar# tar -xf postfixadmin-3.0.2.tar.gz root@mail:/home/amar# rm -f postfixadmin-3.0.2.tar.gz root@mail:/home/amar# mv postfixadmin-3.0.2 /var/www/html/postfixadmin root@mail:/home/amar# chown -R www-data:www-data /var/www/html/postfixadmin
7A- Let's brand the changes into config.inc.php

root@mail:/home/amar# vi /var/www/html/postfixadmin/config.inc.php
Make the highlighted changes inward the config.inc.php

<?php // Configuration options hither override those inward config.inc.php.   // You convey to laid $CONF['configured'] = true; before the // application volition run. $CONF['configured'] = true;    // Database connectedness details. $CONF['database_type'] = 'mysqli'; $CONF['database_host'] = 'localhost'; $CONF['database_user'] = 'mail'; $CONF['database_password'] = 'mailpassword'; $CONF['database_name'] = 'mail';  // Site Admin // Define the Site Admin's e-mail address below. // This volition live used to send emails from to create mailboxes too // from Send Email / Broadcast message pages. // Leave blank to send e-mail from the logged-in Admin's Email address. $CONF['admin_email'] = '';   
Save too Exit from File
7B- Now start browser too opened upwardly this URL: http://mail.tony.in/postfixadmin/setup.php
Troubleshooting: -You may get error:- Invalid query: Specified fundamental was likewise long; max fundamental length is one m bytes



7C- To cook higher upwardly mistake nosotros demand to brand changes into upgrade.php file
Open upgrade.php file using vi editor.
root@mail:/home/amar# vi /var/www/html/postfixadmin/upgrade.php

type syntax below too hitting enter- :%s/255/100/g  it disclose give-and-take 500 inward the file too supercede it amongst 100



7D- After making alter inward the file refresh url, if things goes weill you lot teach output equally follow

7E- Now displace into Setup password, what ever you lot demand too it volition give us Hash password that nosotros demand to relieve inward config.inc.php file

You volition run across Hash password equally inward higher upwardly icon demand to re-create it too add together inward confi.inc.php file

7F- Open confi.inc.php too add together this hash password inward forepart of $conf['setup_password'] line equally below
root@mail:/home/amar# vi /var/www/html/postfixadmin/config.inc.php
$CONF['setup_password'] = '29bef8ab87cb037af7efb8257a116469:e05ed5e6eecfa387324c4ba30f40e4d316a77685';
Save too Exit from the file.
7G- Create PostfixAdmin superAdmin login account

Super Admin concern human relationship has been setup successfully.
Troubleshooting: - You may teach an error "Admin is non a valid e-mail address!Email address" during admin concern human relationship setup 
This mistake volition hap when our domain is non getting resolved, To solve it let's brand too alter in config.inc.php file
Open config.inc.php file  and alter line equally below

$CONF['emailcheck_resolve_domain']='NO'
Save too Exit from file.

Step 8: - Create Domain too add together mailbox:
Let's Use created an admin user to login into postfix admin console:
User- admin@tony.in
password- created password above 
8A- Add Domain: 
Let's  add domain using steps below

8B- Add Domain: Add User mailbox
Follow the steps 1 -8 to add together mailbox
One mailbox amongst cite chinu@tony.in has been added successfully.
Step 8: - Create a User to Handle Virtual Mail Directories
We demand a User concern human relationship who tin john handgrip Virtual post service directories, So let's create a user using the ascendancy below:

root@mail:/home/amar# useradd -r -u 150 -g post service -d /var/vmail -s /sbin/nologin -c "Virtual maildir handler" vmail root@mail:/home/amar# mkdir /var/vmail root@mail:/home/amar# chmod 770 /var/vmail root@mail:/home/amar# chown vmail:mail /var/vmail 
Virtual Mail Directory "/var/vmail" using Group "mail" to allow other system's user to create produce the content.
Step 9: - Configure Dovecot
Dovecot volition create produce all the connectedness for POP too IMAP, local post service directory too have all incoming emails. Dovecot operate to handgrip authentication for SMTP connection. We also define MySQL database connectedness string so Dovecot tin john access all the information from MySQL Database-
9A- Enable Dovecote access to MySQL database
Dovecot volition access all the mailbox information including user authentication from Database, Let's brand changes inward the file - /etc/dovecot/dovecot-sql.conf.ext
Open dovecot-sql.conf.ext file too add together database access equally follow

root@mail:/home/amar# vi /etc/dovecot/dovecot-sql.conf.ext
Make the next changes equally highlighted below inward RED

# Database driver: mysql, pgsql, sqlite driver = mysql
# Examples: #   connect = host=192.168.1.1 dbname=users #   connect = host=sql.example.com dbname=virtual user=virtual password=blarg #   connect = /etc/dovecot/authdb.sqlite # connect = host=localhost dbname=mail user=mail password=mailpassword
# Default password scheme. # # List of supported schemes is inward # http://wiki2.dovecot.org/Authentication/PasswordSchemes # default_pass_scheme = MD5-CRYPT
# Define the enquiry to obtain a user password. # # Note that uid 150 is the "vmail" user too gid 8 is the "mail" group. # password_query = \   SELECT username equally user, password, '/var/vmail/%d/%n' equally userdb_home, \   'maildir:/var/vmail/%d/%n' equally userdb_mail, 150 equally userdb_uid, 8 equally userdb_gid \   FROM mailbox WHERE username = '%u' AND active = '1'
# Define the enquiry to obtain user information. # # Note that uid 150 is the "vmail" user too gid 8 is the "mail" group. # user_query = \   SELECT '/var/vmail/%d/%n' equally home, 'maildir:/var/vmail/%d/%n' equally mail, \   150 AS uid, 8 AS gid, concat('dirsize:storage=', quota) AS quota \   FROM mailbox WHERE username = '%u' AND active = '1'
Save too Exit from File.
9B- Make changes inward 10-auth.conf file
Dovecot volition read the SQL configuration files, nosotros demand to enable inward 10-auth.conf file lets brand changes using below command.
Open 10-auth.conf file and brand the changes equally follow
root@mail:/home/amar# vi /etc/dovecot/conf.d/10-auth.conf
Changes are equally follows:
# Disable LOGIN ascendancy too all other plaintext authentications unless # SSL/TLS is used (LOGINDISABLED capability). Note that if the remote IP # matches the local IP (ie. you're connecting from the same computer), the # connectedness is considered secure too plaintext authentication is allowed. disable_plaintext_auth = yes
# Space separated listing of wanted authentication mechanisms: #   evidently login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey #   gss-spnego # NOTE: See also disable_plaintext_auth setting. auth_mechanisms = evidently login
# User database specifies where mails are located too what user/group IDs # ain them. For single-UID configuration operate "static" userdb. # # <doc/wiki/UserDatabase.txt>   #!include auth-deny.conf.ext #!include auth-master.conf.ext   #!include auth-system.conf.ext # Use the SQL database configuration for authentication rather than # whatever of these others. !include auth-sql.conf.ext #!include auth-ldap.conf.ext #!include auth-passwdfile.conf.ext #!include auth-checkpassword.conf.ext #!include auth-vpopmail.conf.ext #!include auth-static.conf.ext
Save too Exit from the Files
9C- Tell Dovecot where demand to shop user's post service directory  Open 10-mail.conf file too brand the changes equally follows:
root@mail:/home/amar# vi /etc/dovecot/conf.d/10-mail.conf
Changes are equally follows:
# See doc/wiki/Variables.txt for total list. Some examples: # #   mail_location = maildir: /Maildir #   mail_location = mbox: /mail:INBOX=/var/mail/%u #   mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n # # <doc/wiki/MailLocation.txt> # mail_location = maildir:/var/vmail/%d/%n
# System user too grouping used to access mails. If you lot operate multiple, userdb # tin john override these past times returning uid or gid fields. You tin john operate either numbers # or names. <doc/wiki/UserIds.txt> mail_uid = vmail mail_gid = mail
# Valid UID hit for users, defaults to 500 too above. This is mostly # to brand certain that users can't log inward equally daemons or other organization users. # Note that denying root logins is hardcoded to dovecot binary too can't # live done fifty-fifty if first_valid_uid is laid to 0. # # Use the vmail user uid here. first_valid_uid = 150 last_valid_uid = 150 
Save too Exit From the file
9D- Change Certificates file path
Open 10-ssl.conf file too brand the changes equally follows:

root@mail:/home/amar# vi /etc/dovecot/conf.d/10-ssl.conf
Make the changes equally follows:
# SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt> ssl = yes 
# The generated snakeoil certificate: #ssl_cert = </etc/ssl/certs/ssl-cert-snakeoil.pem #ssl_key = </etc/ssl/private/ssl-cert-snakeoil.key # Purchased certificate: ssl_cert = </etc/ssl/certs/tony.in.crt ssl_key = </etc/ssl/private/tony.in.key
Save too Exit From the file
9E-Modify 10-master.conf 

root@mail:/home/amar# vi /etc/dovecot/conf.d/10-master.conf
 Make the changes equally follows:
service auth {   # auth_socket_path points to this userdb socket past times default. It's typically   # used past times dovecot-lda, doveadm, maybe imap process, etc. Users that convey   # total permissions to this socket are able to teach a listing of all usernames too   # teach the results of everyone's userdb lookups.   #   # The default 0666 agency allows anyone to connect to the socket, but the   # userdb lookups volition succeed alone if the userdb returns an "uid" acre that   # matches the caller process's UID. Also if caller's uid or gid matches the   # socket's uid or gid the lookup succeeds. Anything else causes a failure.   #   # To give the caller total permissions to lookup all users, laid the agency to   # something else than 0666 too Dovecot lets the essence enforce the   # permissions (e.g. 0777 allows everyone total permissions).   unix_listener auth-userdb {     agency = 0666     user = vmail     grouping = post service   }     unix_listener /var/spool/postfix/private/auth {     agency = 0666     # Assuming the default Postfix user too grouping     user = postfix     grouping = postfix   }
Save too Exit From the file
9F- Change postmaster setting 
root@mail:/home/amar# vi /etc/dovecot/conf.d/15-lda.conf
Changes equally follows:
# Address to operate when sending rejection mails. # Default is postmaster@<your domain>. postmaster_address = postmaster@tony.in
Save too Exit From the file
9G- Change mailbox directory permission
root@mail:/home/amar# chown -R vmail:dovecot /etc/dovecot root@mail:/home/amar# chmod -R o-rwx /etc/dovecot 
Step 10: - Configure Antivirus scan too SpamAssassin scan
Amavis, ClamAV, too SpamAssassin are the best tool to scan email, allow brand the changes equally follow to integrate these tools.

10A-  Add Users 
root@mail:/home/amar# adduser clamav amavis Adding user `clamav' to grouping `amavis' ... Adding user clamav to grouping amavis Done. root@mail:/home/amar# adduser amavis clamav Adding user `amavis' to grouping `clamav' ... Adding user amavis to grouping clamav Done. 
10B- Modify configuration file

root@mail:/home/amar# vi /etc/clamav/clamd.conf 

Changes equally follows:
# Needed to allow things to piece of work amongst Amavis, when both amavis too clamav # users are added to ane another's groups. AllowSupplementaryGroups true
10C- Turn on Amavis
root@mail:/home/amar# vi /etc/amavis/conf.d/15-content_filter_mode
Changes equally follow
use strict;   # You tin john modify this file to re-enable SPAM checking through spamassassin # too to re-enable antivirus checking.   # # Default antivirus checking agency # Please note, that anti-virus checking is DISABLED past times # default. # If You wishing to enable it, delight uncomment the next lines:   @bypass_virus_checks_maps = (    \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);   # # Default SPAM checking agency # Please note, that anti-spam checking is DISABLED past times # default. # If You wishing to enable it, delight uncomment the next lines:   @bypass_spam_checks_maps = (    \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);   1;  # ensure a defined return
Save too Exit From file
10D- Enable SpamAssassin
root@mail:/home/amar# vi /etc/default/spamassassin 
Changes equally follow
# Change to ane to enable spamd ENABLED=1  # Cronjob # Set to anything but 0 to enable the cron task to automatically update # spamassassin's rules on a nightly solid set down CRON=1
Save too Exit from file
10E- Enable Database Scan
SpamAssassin nether Amavis volition alone banking concern check post service that's determined to live arriving for local delivery. There are a duad of ways to state Amavis which mails are for local delivery, but hither we'll laid it upwardly to banking concern check the database laid upwardly past times Postfix Admin. Edit /etc/amavis/conf.d/50-user to await similar this:
root@mail:/home/amar# vi /etc/amavis/conf.d/50-user
Changes equally follows:
use strict;   # # Place your configuration directives here.  They volition override those inward # before files. # # See /usr/share/doc/amavisd-new/ for documentation too examples of # the directives you lot tin john operate inward this file #   # Three concurrent processes. This should fit into the RAM available on an # AWS micro instance. This has to tally the number of processes specified # for Amavis inward /etc/postfix/master.cf. $max_servers  = 3;   # Add spam information headers if at or higher upwardly that flat - this ensures they # are ever added. $sa_tag_level_deflt  = -9999;   # Check the database to run across if post service is for local delivery, too hence # should live spam checked. @lookup_sql_dsn = (     ['DBI:mysql:database=mail;host=127.0.0.1;port=3306',      'mail',      'mailpassword']); $sql_select_policy = 'SELECT domain from domain WHERE CONCAT("@",domain) IN (%k)';   # Uncomment to bump upwardly the log flat when testing. # $log_level = 2;   #------------ Do non modify anything below this line ------------- 1;  # ensure a defined return
Save too Exit from file

10E-
Next, brand certain the ClamAV database is upwardly to appointment past times running fresh clam. It should be:
root@mail:/home/amar# freshclam
10F- Restart services

root@mail:/home/amar# /etc/init.d/spamassassin restart 
root@mail:/home/amar# /etc/init.d/clamav-daemon restart
root@mail:/home/amar# /etc/init.d/clamav-daemon restart
root@mail:/home/amar# /etc/init.d/amavis restart


Step 11: - Configure Postfix
Postfix handles incoming post service via the SMTP protocol, too its configuration files have be set upwardly to allow it to integrate amongst the diverse other packages nosotros convey installed so far. At a high level, nosotros desire Postfix to mitt off incoming post service to the spam too virus checkers before passing it on to Dovecot for delivery, too to communicate amongst Dovecot inward gild to authenticate virtual users who are connecting over SMTP inward gild to send the email.



11A- Create next files to allow postfix access fo Database.


root@mail:/home/amar# vi /etc/postfix/mysql_virtual_alias_domainaliases_maps.cf
Add next lines
user = post service password = mailpassword hosts = 127.0.0.1 dbname = post service enquiry = SELECT goto FROM alias,alias_domain   WHERE alias_domain.alias_domain = '%d'   AND alias.address=concat('%u', '@', alias_domain.target_domain)   AND alias.active = 1 
/etc/postfix/mysql_virtual_alias_maps.cf
user = post service password = mailpassword hosts = 127.0.0.1 dbname = post service tabular array = alias select_field = goto where_field = address additional_conditions = too active = '1' 
/etc/postfix/mysql_virtual_domains_maps.cf
user = post service password = mailpassword hosts = 127.0.0.1 dbname = post service tabular array = domain select_field = domain where_field = domain additional_conditions = too backupmx = '0' too active = '1'  
/etc/postfix/mysql_virtual_mailbox_domainaliases_maps.cf
user = post service password = mailpassword hosts = 127.0.0.1 dbname = post service enquiry = SELECT maildir FROM mailbox, alias_domain   WHERE alias_domain.alias_domain = '%d'   AND mailbox.username=concat('%u', '@', alias_domain.target_domain )   AND mailbox.active = 1 
/etc/postfix/mysql_virtual_mailbox_maps.cf
user = post service password = mailpassword hosts = 127.0.0.1 dbname = post service tabular array = mailbox select_field = CONCAT(domain, '/', local_part) where_field = username additional_conditions = too active = '1' 
/etc/postfix/mysql_virtual_sender_login_maps.cf
user = post service password = mailpassword hosts = 127.0.0.1 dbname = post service enquiry = SELECT goto FROM alias WHERE address='%s'  
 /etc/postfix/header_checks
/^Received:/                 IGNORE /^User-Agent:/               IGNORE /^X-Mailer:/                 IGNORE /^X-Originating-IP:/         IGNORE /^x-cr-[a-z]*:/              IGNORE /^Thread-Index:/             IGNORE  
11B- Modify main.cf file

root@mail:/home/amar# vi /etc/postfix/main.cf

Changes equally follows
# See /usr/share/postfix/main.cf.dist for a commented, to a greater extent than consummate version   # The showtime text sent to a connecting process. smtpd_banner = $myhostname ESMTP $mail_name biff = no # appending .domain is the MUA's job. append_dot_mydomain = no readme_directory = no   # --------------------------------- # SASL parameters # ---------------------------------   # Use Dovecot to authenticate. smtpd_sasl_type = dovecot # Referring to /var/spool/postfix/private/auth smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes broken_sasl_auth_clients = yes smtpd_sasl_security_options = noanonymous smtpd_sasl_local_domain = smtpd_sasl_authenticated_header = yes   # --------------------------------- # TLS parameters # ---------------------------------   # The default snakeoil certificate. Comment if using a purchased # SSL certificate. smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key   # Uncomment if using a purchased SSL certificate. # smtpd_tls_cert_file=/etc/ssl/certs/example.com.crt # smtpd_tls_key_file=/etc/ssl/private/example.com.key   # The snakeoil self-signed certificate has no demand for a CA file. But # if you lot are using your ain SSL certificate, so you lot in all probability convey # a CA certificate bundle from your provider. The path to that goes # here. # smtpd_tls_CAfile=/etc/ssl/certs/ca-bundle.crt   # Ensure we're non using no-longer-secure protocols. smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3   smtp_tls_note_starttls_offer = yes smtpd_tls_loglevel = 1 smtpd_tls_received_header = yes smtpd_tls_session_cache_timeout = 3600s tls_random_source = dev:/dev/urandom #smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache #smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache   # Note that forcing operate of TLS is going to displace breakage - most post service servers # don't offering it too so delivery volition fail, both incoming too outgoing. This is # unfortunate given what diverse governmental agencies are upwardly to these days. # # Enable (but don't force) all incoming smtp connections to operate TLS. smtpd_tls_security_level = may # Enable (but don't force) all outgoing smtp connections to operate TLS. smtp_tls_security_level = may   # See /usr/share/doc/postfix/TLS_README.gz inward the postfix-doc bundle for # information on enabling SSL inward the smtp client.   # --------------------------------- # TLS Updates relating to Logjam SSL attacks. # See: https://weakdh.org/sysadmin.html # ---------------------------------   smtpd_tls_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA smtpd_tls_dh1024_param_file = /etc/ssl/private/dhparams.pem   # --------------------------------- # SMTPD parameters # ---------------------------------   # Uncomment the adjacent line to generate "delayed mail" warnings #delay_warning_time = 4h # volition it live a permanent mistake or temporary unknown_local_recipient_reject_code = 450 # how long to proceed message on queue before render equally failed. maximal_queue_lifetime = 7d # max too minute fourth dimension inward seconds betwixt retries if connectedness failed minimal_backoff_time = 1000s maximal_backoff_time = 8000s # how long to hold off when servers connect before receiving balance of information smtp_helo_timeout = 60s # how many address tin john live used inward ane message. # effective stopper to majority spammers, accidental re-create inward whole address listing # but may limit intentional post service shots. smtpd_recipient_limit = 16 # how many mistake before dorsum off. smtpd_soft_error_limit = 3 # how many max errors before blocking it. smtpd_hard_error_limit = 12   # This adjacent laid are of import for determining who tin john send post service too relay post service # to other servers. It is real of import to teach this correct - accidentally producing # an opened upwardly relay that allows unauthenticated sending of post service is a Very Bad Thing. # # You are encouraged to read upwardly on what precisely each of these options accomplish.   # Requirements for the HELO disceptation smtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname, permit # Requirements for the sender details. Note that the gild matters. # E.g. run across http://jimsun.linxnet.com/misc/restriction_order_prelim-03.txt smtpd_sender_restrictions = permit_mynetworks, reject_authenticated_sender_login_mismatch, permit_sasl_authenticated, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit # Requirements for the connecting server smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl # Requirement for the recipient address. Note that the entry for # "check_policy_service inet:127.0.0.1:10023" enables Postgrey. smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service unix:private/policy-spf, check_policy_service inet:127.0.0.1:10023, permit smtpd_data_restrictions = reject_unauth_pipelining # This is a novel selection equally of Postfix 2.10, too is required inward add-on to # smtpd_recipient_restrictions for things to piece of work properly inward this setup. smtpd_relay_restrictions = reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service unix:private/policy-spf, check_policy_service inet:127.0.0.1:10023, permit   # require proper helo at connections smtpd_helo_required = yes # waste matter spammers fourth dimension before rejecting them smtpd_delay_reject = yes disable_vrfy_command = yes   # --------------------------------- # General host too delivery information # ----------------------------------   myhostname = mail.tony.in myorigin = /etc/hostname # Some people run across issues when setting mydestination explicitly to the server # subdomain, piece leaving it empty to a greater extent than oft than non doesn't hurt. So it is left empty here. # mydestination = mail.example.com, localhost mydestination = # If you lot convey a dissever spider web server that sends outgoing post service through this # mailserver, you lot may desire to add together its IP address to the space-delimited listing inward # mynetworks, e.g. equally 10.10.10.10/32. mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all mynetworks_style = host   # This specifies where the virtual mailbox folders volition live located. virtual_mailbox_base = /var/vmail # This is for the mailbox location for each user. The domainaliases # map allows us to brand operate of Postfix Admin's domain alias feature. virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf, mysql:/etc/postfix/mysql_virtual_mailbox_domainaliases_maps.cf # too their user id virtual_uid_maps = static:150 # too grouping id virtual_gid_maps = static:8 # This is for aliases. The domainaliases map allows us to brand # operate of Postfix Admin's domain alias feature. virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf, mysql:/etc/postfix/mysql_virtual_alias_domainaliases_maps.cf # This is for domain lookups. virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf # Used inward conjunction amongst reject_authenticated_sender_login_mismatch to # verify that the sender is sending amongst their ain address, or amongst ane # of the aliases mapped to that address. smtpd_sender_login_maps = mysql:/etc/postfix/mysql_virtual_sender_login_maps.cf   # --------------------------------- # Integration amongst other packages # ---------------------------------------   # Tell postfix to mitt off post service to the Definition for dovecot inward master.cf virtual_transport = dovecot dovecot_destination_recipient_limit = 1   # Use amavis for virus too spam scanning content_filter = amavis:[127.0.0.1]:10024   # Settings for checking SPF to cutting downwardly spam. policy-spf_time_limit = 3600s   # --------------------------------- # Header manipulation # --------------------------------------   # Getting rid of unwanted headers. See: https://posluns.com/guides/header-removal/ header_checks = regexp:/etc/postfix/header_checks enable_original_recipient = no # getting rid of x-original-to

Save too leave of absence from file
11C- Modify master.cf

root@mail:/home/amar# vi /etc/postfix/master.cf
Changes equally follows

# Postfix master copy procedure configuration file.  For details on the format # of the file, run across the master(5) manual page (command: "man v master" or # on-line: http://www.postfix.org/master.5.html). # # Do non forget to execute "postfix reload" afterwards editing this file. # # ========================================================================== # service type  somebody unpriv  chroot  wakeup  maxproc ascendancy + args #               (yes)   (yes)   (no)    (never) (100) # ========================================================================== smtp      inet  n       -       y       -       -       smtpd #smtp      inet  n       -       y       -       1       postscreen #smtpd     overstep  -       -       y       -       -       smtpd #dnsblog   unix  -       -       y       -       0       dnsblog #tlsproxy  unix  -       -       y       -       0       tlsproxy   # SMTP amongst TLS on port 587. Currently commented. #submission inet n       -       y       -       -       smtpd #  -o syslog_name=postfix/submission #  -o smtpd_tls_security_level=encrypt #  -o smtpd_sasl_auth_enable=yes #  -o smtpd_enforce_tls=yes #  -o smtpd_client_restrictions=permit_sasl_authenticated,reject_unauth_destination,reject #  -o smtpd_sasl_tls_security_options=noanonymous    # SMTP over SSL on port 465. smtps     inet  n       -       y       -       -       smtpd   -o syslog_name=postfix/smtps   -o smtpd_tls_wrappermode=yes   -o smtpd_sasl_auth_enable=yes   -o smtpd_tls_auth_only=yes   -o smtpd_client_restrictions=permit_sasl_authenticated,reject_unauth_destination,reject   -o smtpd_sasl_security_options=noanonymous,noplaintext   -o smtpd_sasl_tls_security_options=noanonymous   #628       inet  n       -       y       -       -       qmqpd pickup    unix  n       -       y       sixty      1       pickup cleanup   unix  n       -       y       -       0       cleanup qmgr      unix  n       -       n       300     1       qmgr #qmgr     unix  n       -       n       300     1       oqmgr tlsmgr    unix  -       -       y       1000?   1       tlsmgr rewrite   unix  -       -       y       -       -       trivial-rewrite bounce    unix  -       -       y       -       0       bounce defer     unix  -       -       y       -       0       bounce delineate     unix  -       -       y       -       0       bounce verify    unix  -       -       y       -       1       verify level     unix  n       -       y       1000?   0       level proxymap  unix  -       -       n       -       -       proxymap proxywrite unix -       -       n       -       1       proxymap smtp      unix  -       -       y       -       -       smtp relay     unix  -       -       y       -       -       smtp #       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5 showq     unix  n       -       y       -       -       showq mistake     unix  -       -       y       -       -       mistake retry     unix  -       -       y       -       -       mistake discard   unix  -       -       y       -       -       discard local     unix  -       n       n       -       -       local virtual   unix  -       n       n       -       -       virtual lmtp      unix  -       -       y       -       -       lmtp anvil     unix  -       -       y       -       1       anvil scache    unix  -       -       y       -       1       scache # # ==================================================================== # Interfaces to non-Postfix software. Be certain to examine the manual # pages of the non-Postfix software to disclose out what options it wants. # # Many of the next services operate the Postfix pipe(8) delivery # agent.  See the pipe(8) human being page for information most ${recipient} # too other message envelope options. # ==================================================================== # # maildrop. See the Postfix MAILDROP_README file for details. # Also specify inward main.cf: maildrop_destination_recipient_limit=1 # maildrop  unix  -       n       n       -       -       piping   flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} # # ==================================================================== # # Recent Cyrus versions tin john operate the existing "lmtp" master.cf entry. # # Specify inward cyrus.conf: #   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4 # # Specify inward main.cf ane or to a greater extent than of the following: #  mailbox_transport = lmtp:inet:localhost #  virtual_transport = lmtp:inet:localhost # # ==================================================================== # # Cyrus 2.1.5 (Amos Gouaux) # Also specify inward main.cf: cyrus_destination_recipient_limit=1 # #cyrus     unix  -       n       n       -       -       piping #  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user} # # ==================================================================== # Old illustration of delivery via Cyrus. # #old-cyrus unix  -       n       n       -       -       piping #  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user} # # ==================================================================== # # See the Postfix UUCP_README file for configuration details. # uucp      unix  -       n       n       -       -       piping   flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) # # Other external delivery methods. # ifmail    unix  -       n       n       -       -       piping   flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) bsmtp     unix  -       n       n       -       -       piping   flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient scalemail-backend unix  -   n   n   -   2   piping   flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension} mailman   unix  -       n       n       -       -       piping   flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py   ${nexthop} ${user}   # The adjacent 2 entries integrate amongst Amavis for anti-virus/spam checks. amavis      unix    -       -       y       -       three       smtp   -o smtp_data_done_timeout=1200   -o smtp_send_xforward_command=yes   -o disable_dns_lookups=yes   -o max_use=20 127.0.0.1:10025 inet    n       -       y       -       -       smtpd   -o content_filter=   -o local_recipient_maps=   -o relay_recipient_maps=   -o smtpd_restriction_classes=   -o smtpd_delay_reject=no   -o smtpd_client_restrictions=permit_mynetworks,reject   -o smtpd_helo_restrictions=   -o smtpd_sender_restrictions=   -o smtpd_recipient_restrictions=permit_mynetworks,reject   -o smtpd_data_restrictions=reject_unauth_pipelining   -o smtpd_end_of_data_restrictions=   -o mynetworks=127.0.0.0/8   -o smtpd_error_sleep_time=0   -o smtpd_soft_error_limit=1001   -o smtpd_hard_error_limit=1000   -o smtpd_client_connection_count_limit=0   -o smtpd_client_connection_rate_limit=0   -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters    # Integration amongst Dovecot - mitt post service over to it for local delivery, too # run the procedure nether the vmail user too post service group. dovecot      unix   -        n      n       -       -   piping   flags=DRhu user=vmail:mail argv=/usr/lib/dovecot/dovecot-lda -d $(recipient)   # Integration amongst the SPF banking concern check package. policy-spf  unix  -       n       n       -       -       spawn      user=nobody argv=/usr/bin/policyd-spf 

Step 12- Restart all the services:

root@mail:/home/amar# service postfix restart root@mail:/home/amar# service spamassassin restart root@mail:/home/amar# service clamav-daemon restart root@mail:/home/amar# service amavis restart root@mail:/home/amar# service dovecot restart
Step 13- Test Mail Server:
Use setting below to configure your Email Client.

Use higher upwardly settings to configure E-mail Client. 

Step 14- Setup SPF (Sender Policy Framework):
Example 1 Allow post service from all hosts listed inward the MX records for the domain:
v=spf1 mx -all
Example 2 Allow post service from a specific host:

v=spf1 a:mail.example.com -all

Add the SPF policy agent to Postfix:
Install next bundle first.
# apt install postfix-policyd-spf-python postfix-pcre
1- If you lot are using SpamAssassin to filter spam, you lot may desire  edit to
/etc/postfix-policyd-spf-python/policyd-spf.conf to alter the HELO_reject and Mail_From_rejectsettings to False
root@mail: # vi /etc/postfix-policyd-spf-python/policyd-spf.conf
Your file looks similar below:
debugLevel = 1 TestOnly = 1  HELO_reject = False Mail_From_reject = False  PermError_reject = False TempError_Defer = False  
Save too leave of absence from file
2- Edit /etc/postfix/master.cf and add together the next line
policyd-spf  unix  -       n       n       -       0       spawn     user=policyd-spf argv=/usr/bin/policyd-spf
Save too leave of absence from file
3-Edit  /etc/postfix/main.cf and add together the next line to increase postfix agent policy timeout
policyd-spf_time_limit = 3600
4- Edit /etc/postfix/main.cfand change smtpd_recipient_restrictions list
smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service unix:private/policy-spf, check_policy_service inet:127.0.0.1:10023, permit 
Save too leave of absence from file
5-Restart Postfix
root@mail: # systemctl restart postfix 

!!!Our E-Mail Server has been configured successfully!!!


Sumber https://linuxhowtoguide.blogspot.com/