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/

Sabtu, 08 Juli 2017

Step Past Times Pace Deed Lvm ( Vg-Volume Grouping , Pv-Physical Voulme As Well As Lv- Logical Volume) To Approximately Other Linux Organisation

LVM Move: - We tin motility entire LVM Volume grouping to approximately other Linux System. 
It may require when yous are going to upgrade your electrical flow OS to the latest or at that spot is approximately lawsuit alongside electrical flow Server hardware or going to role novel server hardware.



Why Move LVM: -
1- There is approximately hardware lawsuit alongside electrical flow server
2- We convey novel Server hardware
3- Current OS is onetime version

Prerequisites:- 
1- Influenza A virus subtype H5N1 user alongside sudoers access over onetime System
2- user alongside sudoers privileges over novel System
Move LVM: - We need to perform next steps to motility LVM

My Current scenario as follows:
VG Name:  VG01






PV Name:  /dev/sdb1 in addition to /dev/sdc1 







LV Name:  LV01 in addition to LV02 








 Note: -first, brand certain no i is accessing the file on the active book inwards the book grouping nosotros are going to move.
Step 1: -  Unmount LV logical volume
Before, nosotros commence moving LVM necessitate to unmount let's role below ascendence to unmount LV
root@Server16: # umount /mnt/FLV
Step 2: - Make VG inactive 
Now nosotros necessitate to brand VG inactive, role below command.
root@Server16: # vgchange -a n VG01 
Step 3: - Export Volume Group
root@Server16: # vgexport VG01 Volume grouping VG01 is exported Cannot procedure book grouping VG01
After exporting VG, the Physical Volume volition exhibit upward equally beingness exported book grouping when yous volition execute command pvscan.








Step 4: - Shutdown System in addition to unplugged disk
After System Shutdown unplugged both the disk. Let's role init 0 ascendence to shutdown system.

Step 5: - Plugged disk to novel organization in addition to ability it on 
After putting both the disk to the novel system, I am going to ability it on in addition to volition exhibit yous how to import Volume Group.
Disk , VG in addition to LV details equally follows:

























Step 6: - VG Import 
After putting all the disk to novel organization nosotros necessitate to import Volume Group, let's role below ascendence to Import VG using ascendence vgimport

root@US16: # vgimport VG01   Volume grouping "VG01" successfully imported 

Step 7: - Activate Volume Group
After successful import of VG, We necessitate to active Volume Group using ascendence below
root@US16: # vgchange -a y VG01   ii logical volume(s) inwards book grouping "VG01" instantly active
Step 8: - Create mountain point 
Now Volume Group has successfully import in addition to activated, let's practise mountain betoken then nosotros tin mountain in addition to commence using Logical Volume.
root@US16: # mkdir /mnt/lvm1 root@US16: # mkdir /mnt/lvm2 
Mount betoken successfully created.
Step 9: - Mount Logical Volume
root@US16: # mount /dev/VG01/LV01 /mnt/lvm1/ 
Step 10:  Check onetime information of LV01 Logical Volume
Volume Group Import has done successfully, in addition to Logical Volume mounted equally well.
let's cheque existing information inwards the mounted LV.










Volume Group has successfully Imported to novel organization in addition to working equally expected. We tin brand fstab entry to mountain Logical Volume permanently.
Step 11: - Make Fstab entry to mountain LV permanently
Let's role below ascendence to mountain it permanently.
root@US16: # vi /etc/fstab
Append trouble below inwards the goal of fstab file
/dev/VG01/LV01  /mnt/lvm1       ext4    errors=remount-ro 0     0
Your fstab file looks similar below


















Step 12: - Use ascendence mountain -a to apply changes
After making alter inwards fstab file nosotros necessitate to restart organization to apply changes, merely nosotros tin role ascendence mountain -a to apply changes without restart system.
root@US16: # mount -a
Logical Volume has been successfully mounted permanently.

!!!That's all close VG Moving!!!! Thank yous then much for reading.


Sumber https://linuxhowtoguide.blogspot.com/

Jumat, 24 Maret 2017

How To Install As Well As Configure Pnp4nagios Bulk+Npcd Trend Amongst Nagios4.X Centos 7.X

PNP4NAGIOS:-

Pnp4Nagios plant alongside Nagios to generate the graph of services that are beingness monitored yesteryear Nagios server. With the handle of Pnp4Nagios, nosotros tin meet the graph anytime whenever needed,  It tape graph for all the configured services, We tin sentiment usage similar CPU, RAM, Disk Space etc.

Prerequisites:  

1- RRDTOOL, rrdtool-perl
2- Perl
3- Php-gd
4- perl-time-HiRes

Step 1-  Installation
To Install prerequisites run below command
[root@localhost  ]# yum install rrdtool perl-Time-HiRes rrdtool-perl php-gd

Once prerequisites installation done, download pnp4nagios.
Step 2- Download PNP4Nagios, Extract in addition to Install
[root@localhost  ]# wget https://sourceforge.net/projects/pnp4nagios/files/PNP-0.6/pnp4nagios-0.6.25.tar.gz
Once download transcend finished, extract packet using ascendancy below
[root@localhost  ]# tar zxfv pnp4nagios-0.6.25.tar.gz
Go to the Extracted directory in addition to configure it.
[root@localhost  ]# cd pnp4nagios-0.6.25
Configure pnp4nagios in addition to install using ascendancy below
[root@localhost pnp4nagios]# ./configure [root@localhost pnp4nagios]# brand all [root@localhost pnp4nagios]# brand fullinstall

Enable NPCD service to starting fourth dimension at kick fourth dimension in addition to starting fourth dimension it now.
[root@localhost  ]# chkconfig --add npcd && chkconfig --level 35 npcd on

Let's reboot httpd service.
[root@localhost  ]# systemctl restart httpd

Step 2- Let's depository fiscal establishment lucifer PNP4Nagios installation.

Open browser in addition to type URL:- 192.168.102.11/pnp4nagios/











































After successful PNP4Nagios installation, you lot volition transcend the window similar above.

Step 3- Let's rename install.php to install.php-bak
[root@localhost  ]# mv  /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php-bak

Step 4-  Make the required changes inward Nagios configuration to integrate PNP4Nagios to generate graph.

Make the changes inward nagios.cfg configuration file.
[root@localhost  ]# vi /usr/local/nagios/etc/nagios.cfg
Change the Process_performance_data=1 in addition to append below mentions line.
# Bulk / NPCD mode process_performance_data=1 service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECH$ service_perfdata_file_mode=a service_perfdata_file_processing_interval=15 service_perfdata_file_processing_command=process-service-perfdata-file  host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$ host_perfdata_file_mode=a host_perfdata_file_processing_interval=15 host_perfdata_file_processing_command=process-host-perfdata-file
Save in addition to leave of absence from file.
Now brand the required changes inward command.cfg file
[root@localhost  ]# vi /usr/local/nagios/etc/objects/commands.cfg
Go to the terminate of file in addition to append the crimson business below in addition to comment all the dark line.
# 'process-host-perfdata' ascendancy Definition #define command{ #       command_name    process-host-perfdata #       command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out #       }   # 'process-service-perfdata' ascendancy Definition #define command{ #       command_name    process-service-perfdata #       command_line    /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out #       }  # 'process-host-perfdata' ascendancy Definition define command{ command_name process-host-perfdata command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$$ }  # 'process-service-perfdata' ascendancy Definition define command{ command_name process-service-perfdata command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$$ }  define command{ command_name process-service-perfdata-file command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$ }  define command{ command_name process-host-perfdata-file command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$ }   

Let's brand alter inward template.cfg file 
[root@localhost  ]# vi /usr/local/nagios/etc/objects/templates.cfg
Append the crimson business inward the below of file.
# PNP4NAGIOS # define host { hollo host-pnp action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_ register 0 }  define service { hollo srv-pnp action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$ register 0 
Save in addition to Exit from file

Now brand the alter inward the host configuration fiel
[root@localhost  ]# vi /usr/local/nagios/etc/objects/localhost.cfg

Append the next lines inward the terminate of file.
# Define a host for the local machine  define host{         purpose                     linux-server,host-pnp            ; Name of host template to purpose                                                         ; This host Definition volition inherit all variables that are defined                                                         ; inward (or inherited by) the linux-server host template definition.         host_name               localhost         alias                   localhost         address                 127.0.0.1         } 

# Define a service to "ping" the local machine
define service{
        purpose                             local-service,srv-pnp         ; Name of service template to use
        host_name                       localhost
        service_description             PING
        check_command                   check_ping!100.0,20%!500.0,60%
        }
Save in addition to leave of absence from file.

All the configuration changed completed successfully.

Step 5-  Now restart httpd, Nagios in addition to Npcd service using ascendancy below.
[root@localhost  ]# systemctl restart httpd && systemctl restart nagios && systemctl restart npcd

Step 6- Verify integration of PNP4Nagios

Open Nagios server URL:-  http://192.168.102.11/nagios/

After successful integration of PNP4nagios you lot transcend a graph symbol for each service similar inward below image:







And you lot volition meet graph for private service icon similar below:























Congratulation!!! Installation in addition to Integration of PNP4Nagios alongside Nagios server completed successfully done alongside Bulk+NPCD mode.


Sumber https://linuxhowtoguide.blogspot.com/

Jumat, 17 Maret 2017

How To Install Nagios 3.X On Centos 6.7 End Release

What Is Nagios Core:-

Nagios Core is an Open Source organization together with network monitoring application. It watches hosts together with services that yous specify, alerting yous when things become bad together with when they instruct better.

System Requirments:-

1- Linux machine (In my illustration I am using Centos 6.7)
2- HTTPd, PHP amongst gd together with CGI.

Nagios Installation:-

 Step 1- 
Add repository showtime to install Nagios
[root@odoo  ]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm warning: /var/tmp/rpm-tmp.2nIBRS: Header V3 RSA/SHA256 Signature, fundamental ID 0608b895: NOKEY Preparing...                ########################################### [100%]    1:epel-release           ########################################### [100%] [root@odoo  ]# 

[root@odoo  ]# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm Retrieving http://rpms.famillecollet.com/enterprise/remi-release-6.rpm warning: /var/tmp/rpm-tmp.f5McIF: Header V4 DSA/SHA1 Signature, fundamental ID 00f97f56: NOKEY Preparing...                ########################################### [100%]    1:remi-release           ########################################### [100%] 

 Step 2- Complete installation & configuration part:

Run yum update
[root@odoo  ]# yum update
Install HTTPd server
[root@odoo  ]# yum install httpd
Install PHP
[root@odoo  ]# yum install php php-cli php-gh php-common

Install Nagios
[root@odoo  ]# yum install nagios nagios-plugins-all nagios-plugins-nrpe nrpe
Check Nagios version
[root@odoo  ]# nagios -v
Enable httpd together with Nagios service to laid about car during organization boot or restart
[root@odoo  ]# chkconfig httpd on && chkconfig nagios on
Start httpd & Nagios service
[root@odoo  ]# service httpd laid about && service nagios start
Open Port fourscore through iptables
[root@odoo  ]# vi /etc/sysconfig/iptables
Modify config file similar below
# Firewall configuration written past times system-config-firewall # Manual customization of this file is non recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m field --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m field --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -m field --state NEW -m tcp -p tcp --dport fourscore -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT 

Save together with kicking the bucket from file & restart iptables service
[root@odoo  ]# service iptables restart
 Step 3- Setup Nagios login details
 Set Nagios user get upwards together with password
[root@odoo  ]# htpasswd -c /etc/nagios/passwd nagiosadmin New password: ******* Re-type novel password:  ****** Adding password for user nagiosadmin 

 Step 4- Validate authentication & installation.
Check Nagios login using URL below















After successful authentication, yous volition instruct the window similar below.













!!!!!!!! Installation of Nagios completed successfully !!!!!!!!


Sumber https://linuxhowtoguide.blogspot.com/

Kamis, 02 Februari 2017

How To Install As Well As Configure Magento Alongside Nginx Ubuntu 16.04 Lts

Magento:

Magento is the well-nigh pop content administration organisation for e-commerce websites. It is used past times small-scale businesses as well as large enterprise companies alike, as well as tin live enhanced past times thousands of extensions as well as themes. Magento uses the MySQL database system, the PHP programming language, as well as parts of the Zend Framework.


Requirement: 
We required a dedicated server atleast 2GB of Ram alongside Ubuntu 16.04 LTS installed LAMP Stack.
1- Nginx
root@Server16: # apt install nginx

2- PHP

root@Server16: # apt install php7.0-fpm

Other required PHP extensions:
root@Server16: # apt-get install php7.0-mysql php7.0-zip php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache  php7.0-pspell   php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext php7.0-soap
3- MySQL
root@Server16: # apt install mysql-server

Step 1: Download as well as extract Magento

Download Magento from below mentioned URL:
root@Server16: # wget https://github.com/OpenMage/magento-mirror/archive/magento-1.9.zip
Use ascendency below to extract zip file
root@Server16: # unzip -d /var/www/html/ magento-1.9.zip
Where  

unzip                                        This is a command
-d                                              Extract file into specific directory 
/var/www/html                       Path where Zip volition live extract 

Now rename the folder alongside a uncomplicated call using the ascendency below:
root@Server16: # mv /var/www/html/magento-mirror-magento-1.9/ /var/www/html/magento 

Change Permission using ascendency below:
root@Server16: # chown -R www-data:www-data /var/www/html/magento 

Step 2: Create Server Blocks (Virtual Host) as well as enable it.

Let's configure Nginx Server block using ascendency below:

root@Server16: # vi /etc/nginx/sites-available/magento.conf

And add together the syntax below:

# Default server configuration # server {         brain 80;         brain [::]:80;          # SSL configuration         #         # brain 443 ssl default_server;         # brain [::]:443 ssl default_server;         #         # Note: You should disable gzip for SSL traffic.         # See: https://bugs.debian.org/773332         #         # Read upwards on ssl_ciphers to ensure a secure configuration.         # See: https://bugs.debian.org/765782         #         # Self signed certs generated past times the ssl-cert parcel         # Don't purpose them inwards a production server!         #         # include snippets/snakeoil.conf;          root /var/www/html/magento;          # Add index.php to the listing if y'all are using PHP         index index.php index.html index.htm index.nginx-debian.html;          server_name magento.lan;          place / {                 # First campaign to serve asking every minute file, as well as thus                 # every minute directory, as well as thus autumn dorsum to displaying a 404.                 try_files $uri $uri/ =404;         }  place   .php/ {         rewrite ^(.*.php)/ $1 last;         }           # overstep the PHP scripts to FastCGI server listening on 127.0.0.1:9000         #         place   \.php$ {                 include snippets/fastcgi-php.conf;         #         #       # With php7.0-cgi alone:         #       fastcgi_pass 127.0.0.1:9000;         #       # With php7.0-fpm:                 fastcgi_pass unix:/run/php/php7.0-fpm.sock;         }          # deny access to .htaccess files, if Apache's document root         # concurs alongside nginx's i         #         place   /\.ht {                 deny all;         } }   

Save as well as Exit from file

Now Create a link of Server blocks using ascendency below:
root@Server16: # ln -s /etc/nginx/sites-available/magento.conf /etc/nginx/sites-enabled/magento.conf

Check Nginx configuration as well as restart service:
root@Server16: # nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf exam is successful 
Restart Nginx Using ascendency below
root@Server16: # systemctl restart nginx.service 

Step 3: Create a database as well as assign permission:

Let's Create a database as well as assign permission:
Create Database
mysql> practice database magento;
Create User
mysql> practice user magento@localhost identified past times 'magento';
Assign Perrmission
mysql> grant all privileges on magento.* to magento@'localhost' identified past times 'magento';
Reload permisson
mysql> even out privileges;

Step 4: Finish Magento Installation 

Open browser  hitting domain call as well as follow the pedagogy to complete installation process.


Accept the license agreement























Select Location, TimeZone as well as Default Currency type



















Fill Database Configuration detail, Admin spider web access URL as well as session shop options





































Fill Magento Admin login access details:






























All set, afterwards completing all the steps y'all volition larn the window similar below.

















Magento has been installed successfully, Now y'all tin get-go working alongside Admin panel using link below

http://magento.lan/index.php/admin/

And y'all Frontend volition live looking similar this 




















!!!That's ALL!!!!






Sumber https://linuxhowtoguide.blogspot.com/