Posts

Showing posts from July, 2017

Creating Menu Lists using Bash script while loop case statement example

Image
Introduction Creating interactive menus in Bash scripts can be a fun and useful way to automate tasks and provide a user-friendly interface. In this guide, we will create a simple menu using a while loop and case statement. The menu will allow users to perform various actions such as displaying a blog URL, entering a name, age, and hobbies, or quitting the script. We'll also use color to enhance the menu display. Prerequisites To run the Bash script, ensure you have a Unix-like system with Bash installed. You can run the script from the terminal. Bash Script with While Loop and Case Statement The display color for echo command Red color RED='\033[0;31m'   Blue color BLUE='\033[0;34m' No color NC='\033[0m' Read from standard input and write to standard output and files tee -a /tmp/log__$DATE  To run bash script [huupv@huupv ~]$ ./menu_list  The display as below:  Menu Lists  1) My blog  2) Your name  3) How old are you? ...

zimbra ldap reset last login time

Image
How to change last login time for all accounts in zimbra ldap. I'm running scripts on zimbra ldap with zimbra account. To use zimbra  8.6 The explain scripts zimbra ldap reset last login time File /tmp/email the contain accounts email, you want change last login time. cat /tmp/email The output as bellow huupv01@mail.huuphan.com huupv02@mail.huuphan.com when you running script, then zimbraLastLogonTimestamp change the last login the current date DATE=$(date +%Y%m%d) The output as bellow 20170726 For example huupv01@mail.huuphan.com with zimbraLastLogonTimestamp : 20170511135742.260Z to changed zimbraLastLogonTimestamp : 20170726000000.000Z My scripts zimbra ldap reset last login time #!/bin/bash #HuuPV rm -f /tmp/account_DN DATE=$(date +%Y%m%d) LDAP_HOST=$(/opt/zimbra/bin/zmlocalconfig ldap_host | cut -d\ '' -f3) LDAP_PASSWORD=$(/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_password | cut -d\ '' -f3) LDAP_USERDN=$(/opt/zimbra/bin/zmlocalcon...

CentOS/RHEL Use yum Command To Downgrade Upgrade or Rollback Updates

Use yum Command To Downgrade Upgrade or Rollback Update. How to downgrade the package? How to upgrade the package? How to rollback update the package?. I'm running commands with root account. You may reading link below : How to reset root password on centos 7 Generate and Verify Files with MD5 Checksum in Linux use inotify-tools on centos awk useful commands examples How to  Downgrade Upgrade package use yum command The basic syntax Downgrade package yum downgrade package1 yum downgrade package1 package2 showing multiple versions of a package yum --showduplicates list package For example How to Downgrade php-fpm 7.0.21 roll-back php-fpm 5.3.3 yum downgrade php-fpm The output as bellow Resolving Dependencies --> Running transaction check ---> Package php-fpm.x86_64 0:7.0.20-1.el6.remi will be a downgrade --> Processing Dependency: php-common(x86-64) = 7.0.20-1.el6.remi for package: php-fpm-7.0.20-1.el6.remi.x86_64 ---> Package php-fpm.x86_64 0:7.0...

How To Install Wordpress with nginx on CentOS 6

Image
How To Install Wordpress with nginx on CentOS 6. In this posts, the tutorial to install and configure mysql, wordpress and nginx on centos 6 step by step. I'm running account huupv as "root" privilege . Links to below you maybe likes: How to install php7 on centos 6 How to install and configure redmine on centos 6 How to owncloud 9 install ssl certificate centos 7 How To Install the BIND DNS Server on CentOS 6 KeepAlived IP Failover on CentOS & Red Hat To release version on your server cat /etc/redhat-release The output as bellow CentOS release 6.9 (Final) To update server sudo yum update To install epel-release sudo yum install epel-release To install nginx sudo yum install nginx sudo /etc/init.d/nginx start sudo yum install php-fpm php-mysql php-gd To install and configure mysql sudo yum install mysql-server sudo /etc/init.d/mysqld restart sudo /usr/bin/mysql_secure_installation To add user and database for WP_HuuPV on Mysql mysql -u root -p...

How to configure ntp client server

Image
CentOS / Red Hat Configure ntp(Network time protocol) client server synchronised. NTP client ----> NTP server (192.16.1.10) To configure ntp on ntp server To configure allow port 123 on IPtables firewalls cat /etc/sysconfig/iptables The output as bellow -A INPUT -p tcp -m state --state NEW --dport 123 -j ACCEPT -A INPUT -p udp -m state --state NEW --dport 123 -j ACCEPT To configure ntp.conf file restrict 127.0.0.1 restrict 192.16.1.0 netmask 255.255.255.0 nomodify notrap restrict 172.235.0.0 netmask 255.255.0.0 nomodify notrap restrict -6 ::1 server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst server 3.centos.pool.ntp.org iburst server 0.asia.pool.ntp.org server 1.asia.pool.ntp.org server 2.asia.pool.ntp.org server 3.asia.pool.ntp.org To configure ntp on ntp client To configure allow port 123 on IPtables firewalls cat /etc/sysconfig/iptables The output as bellow -A OUTPUT -d 192.16.1.10/32 -m state --stat...

zimbra mail server security fail2ban

Image
zimbra mail server security with fail2ban. How to configure fail2ban for prevent "brute force attack" zimbra 8.6 on centos. How to improve zimbra mail server security with fail2ban . I'm running commands as root account. Links to below you maybe likes: zimbra custom spamassassin rules How to create auto Bcc for Recipient mails for Zimbra 8.6 How to add spam filters on zimbra 8.6 How to create auto Bcc for sender mails for Zimbra 8.6 list accounts that has not logged in for the last x days in zimbra To install fail2ban yum install fail2ban nano To backup file cp /etc/fail2ban/action.d/iptables-allports.conf /etc/fail2ban/action.d/iptables-allports.conf.backup cp /etc/fail2ban/filter.d/zimbra.conf /etc/fail2ban/filter.d/zimbra.conf.backup cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf.backup To create zimbra.conf file cat /etc/fail2ban/filter.d/zimbra.conf The content as below # Fail2Ban configuration file # # Author: # # $Revision: 1 $ # [Def...

Generate and Verify Files with MD5 Checksum in Linux: A Complete Guide

Introduction Learn how to generate and verify MD5 checksums in Linux with step-by-step instructions. This comprehensive guide will help you ensure file integrity using MD5 checksums, complete with practical examples. File integrity is a crucial aspect of managing data on any Linux system. Whether you're handling sensitive information, distributing software, or simply ensuring that your files haven't been tampered with, MD5 checksums offer a straightforward solution. An MD5 checksum is a 128-bit character string that acts as a unique fingerprint for a file. In this guide, we will cover how to generate and verify MD5 checksums for your files, including creating a sample directory with files for practical demonstration.   What is an MD5 Checksum? An MD5 checksum is a 32-character hexadecimal number generated by the MD5 (Message-Digest Algorithm 5) cryptographic hash function. This checksum is used to verify the integrity of files, ensuring that they have not been altered or corr...

zimbra Qualys A+

Introduction Ensuring the security and compliance of your Zimbra email system is essential for protecting sensitive information and maintaining trust with users. Qualys, a leading provider of security assessments, offers tools to help identify and remediate vulnerabilities within your Zimbra infrastructure.  In this article, we will explore how to use Qualys to assess and enhance the security of your Zimbra email system, providing you with a step-by-step guide to safeguard your organization's communications. zimbra Qualys A+ How to zimbra A+ in the Qualys SSL Labs Security Test. To help system zimbra security hardening. Let's go labs. in my post,i use zimbra account ( su - zimbra)  Zimbra without Proxy ( zimbra mailbox+zimbra ldap+zimbra MTA) Tune the cipher list ( you to check zimbraSSLExcludeCipherSuites before run command) zmprov mcf +zimbraSSLExcludeCipherSuites TLS_DHE_RSA_WITH_AES_128_CBC_SHA   zmprov mcf +zimbraSSLExcludeCipherSuites TLS_DHE_RSA_WITH_AES_12...

zimbra reject authenticated sender login mismatch

Image
Introduction Ensuring the integrity of your email system involves implementing strict security measures to prevent unauthorized access. One common issue administrators face is the mismatch between authenticated sender logins and their email addresses, which can lead to potential security vulnerabilities. In this article, we will guide you through the steps to configure Zimbra to reject authenticated sender login mismatches, enhancing the overall security of your email system. zimbra reject authenticated sender login mismatch How To Improvement Sender Must Login/Enforcing a Match Between From Address and sasl username on Zimbra 8.6  To check zimbraMtaSmtpdRejectUnlistedSender and zimbraMtaSmtpdRejectUnlistedRecipient enable on server zimbra mta? zmprov gacf | egrep zimbraMtaSmtpdRejectUnlistedSender zmprov gacf | egrep zimbraMtaSmtpdRejectUnlistedRecipient The output as bellow zimbraMtaSmtpdRejectUnlistedSender: no zimbraMtaSmtpdRejectUnlistedRecipient: no To enabled zimbraMt...

Mastering conditional expression bash script

Image
Introduction Learn how to use conditional expressions in Bash scripts with this comprehensive guide. From basic examples to advanced usage, this article covers everything you need to know to master conditional expressions in Bash scripting. Conditional expressions in Bash scripting are crucial for creating powerful and flexible scripts. Whether you are checking the existence of a file, comparing strings, or evaluating numeric conditions, mastering conditional expressions will make your scripts more robust and versatile. This article will take you through the basics to advanced concepts, complete with examples to illustrate each point. Understanding Conditional Expressions Conditional expressions allow Bash scripts to make decisions and execute different commands based on those decisions. These expressions evaluate to true or false, determining the flow of script execution. Basic Conditional Expressions File Tests File tests are used to check the status of files and directories. Here a...