Posts

Showing posts from May, 2020

snmp agent in Ubuntu

Step: 1 Install the snmp package. # apt-get install snmpd Step: 2 Before continue the configuration, take backup of the original snmp configuration file. # mv /etc/snmp/snmpd.conf  /etc/snmp/snmpd.conf.bkp Step: 3 Create a new configuration file # vim /etc/snmp/snmpd.conf rocommunity  abcdefgh syslocation  "Tech Support" syscontact  support@drbdtest.com Step: 4 Check and confirm that below mentioned configuration into your machine also.. # vim /etc/default/snmpd export MIBS= SNMPDRUN=yes SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf' Step: 5 Restart the snmp service. # /etc/init.d/snmpd restart #snmp

MySQL Data Replication in Ubuntu 18.04..4 LTS

For this configuration, we have setup below mentioned nodes: Master Node IP : 192.168.1.101 Slave Node IP         : 192.168.1.102 [ Step:01 ] Install MySQL on the Master server: #sudo apt-get update #sudo apt-get install mysql-server Install MySQL on the Slave server: #sudo apt-get update #sudo apt-get install mysql-server [ Step:02 ] ON MASTER NODE #vi sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf bind-address            = 192.168.1.101 server-id              = 1 log_bin                = /var/log/mysql/mysql-bin.log #sudo systemctl restart mysql #sudo mysql CREATE USER 'replica'@'192.168.1.102' IDENTIFIED BY '123456'; GRANT REPLICATION SLAVE ON *.* TO 'replica'@'192.168.1.102'; SHOW MASTER STATUS\G mysql> SHOW MASTER STATUS\G *************************** 1. row ***************************       ...

Raid Concepts

Image
Below attached video provides good concept for raid on linux. Ref: https://youtu.be/nxkXNZlJDJc

Create Local Repository in RHEL/CentOS

Step: 01 Extract/copy packages from RHEL DVD to local directory. #cp /run/media/sharif/<RHEL DVD name>/Packages/* /home/sharif/Desktop/PACK/ Step: 02 Create a repo file in yum.repos.d and add followings. #vim /etc/yum.repos.d/localrepo.repo [localrepo] name=Sharif Repository baseurl=file:///home/sharif/Desktop/PACK/ gpgcheck=0 enabled=1 Step: 03 Create repo database.  #createrepo -v /home/sharif/Desktop/PACK/ Step: 04 Do followings. #yum repolist all #yum clean all #yum update Now our repository is ready to use. Try installing something.

NFS Server in Ubuntu 16.04.4 LTS

For this setup, we have two machines as follows: Host : 192.168.1.150 Client : 192.168.1.200 Step 1 — Downloading and Installing the Components On Host Machine #sudo apt-get update #sudo apt-get install nfs-kernel-server On Client Machine #sudo apt-get update #sudo apt-get install nfs-common Step 2 — Creating the Share Directories on the Host Example 1: Exporting a General Purpose Mount On Host Machine #sudo mkdir /var/nfs/general -p #ls -la /var/nfs/general #sudo chown nobody:nogroup /var/nfs/general Example 2: Exporting the Home Directory Step 3 — Configuring the NFS Exports on the Host Server On Host Machine #sudo nano /etc/exports directory_to_share    client(share_option1,...,share_optionN) /var/nfs/general 192.168.1.200(rw,sync,no_subtree_check) /home        192.168.1.200(rw,sync,no_root_squash,no_subtree_check) #sudo systemctl restart nfs-kernel-server Step 4 — Creating the Mount Points on the Client ...

Restricting what users can send mail to off-site destinations

How can I configure Postfix in a way that some users can send mail to the internet and other users not. The users with no access should receive a generic bounce message. Please don't discuss whether such access restrictions are necessary, it was not my decision. Postfix has support for per-user restrictions. The restrictions are implemented by the SMTP server. Thus, users that violate the policy have their mail rejected by the SMTP server. Like this: 554 <user@remote>: Access denied The implementation uses two lookup tables. One table defines what users are restricted in where they can send mail, and the other table defines what destinations are local. It is left as an exercise for the reader to change this into a scheme where only some users have permission to send mail to off-site destinations, and where most users are restricted. The example assumes DB/DBM files, but this could also be done with LDAP or SQL. /etc/postfix/main.cf:     smtpd_recipient_restrict...

Protecting internal email distribution lists [Postfix]

We want to implement an internal email distribution list. Something like all@our.domain.com, which aliases to all employees. My first thought was to use the aliases map, but that would lead to "all" being accessible from the "outside", and this is not desired... :-) Option:01 Postfix can implement per-address access controls. What follows is based on the SMTP client IP address, and therefore is subject to IP spoofing. /etc/postfix/ main.cf : smtpd_recipient_restrictions = ... check_recipient_access hash :/etc/postfix/access ...the usual stuff... /etc/postfix/access: all@example.com permit_mynetworks ,reject # postmap /etc/postfix/access Remarks: This rule only permits my_networks user to send mail to  all@example.com email address. All outsiders will be rejected. Option:02 In the general case you need two lookup tables: one table that lists destinations that need to be protected, and one table that lists domains ...

How to install/uninstall Zimlets In Zimbra 8

TO INSTALL: First go to file location: /opt/zimbra/zimlets Then type su zimbra zmzimletctl install zimlet_archive_name.zip zmzimletctl deploy zimlet_archive_name.zip zmzimletctl enable zimlet_archive_name TO UNINSTALL/REMOVE: su zimbra cd /opt/zimbra/zimlets zmzimletctl disable zimlet_name zmzimletctl undeploy zimlet_name OTHER NOTES: To get a list of all installed Zimlets zmzimletctl listZimlets Ref: https://blog.devget.net/misc/how-to-installuninstall-zimlets-in-zimbra-8/

Configure IPTables firewall for Zimbra mail server

DROP all chain ################## First, because we control both the INPUT and OUTPUT, we need to set the chains to DROP. This, in my opinion, is necessary. Because my method is all DROP and only ACCEPT the necessary ports. ############################################# ### CHANGE CHAIN'S DEFAULT POLICY TO DROP ### ############################################# -P INPUT DROP -P FORWARD DROP -P OUTPUT DROP Secure SSH port ################### I changed the SSH port from port 22 to port 2222, of course you should not leave the SSH port by default. Next, I only allow SSH from the WAN IP in my office. This restricts outside hackers from accessing the server. Change 192.168.100.10 to your WAN IP. ############################ ##### WHITE LIST IP SSH #### ############################ ### ALLOW SSH FROM OFFICE's IP ### -A INPUT -m tcp -p tcp -s 192.168.100.10/32 --dport 2222 -j ACCEPT -A OUTPUT -m tcp -p tcp -d 192.168.100.10/32 --sport 2222 -j ACCEPT Against ba...

Zimbra Chat Problem

Problem: Continuous notification of below message: Unknown command sent to server. ZxChatRequest Solution: #mv /opt/zimbra/lib/ext/openchat/zal.jar /tmp #cp -rp /opt/zimbra/lib/ext/zimbradrive/zal.jar /opt/zimbra/lib/ext/openchat/zal.jar #su - zimbra $zmmailboxdctl restart Ref: https://forums.zimbra.org/viewtopic.php?t=67565#p295423

How To Configure DNS Server On Ubuntu 18.04 / Ubuntu 16.04

Prerequisites 1. A Ubuntu machine (18.04.4 LTS) 2. IP Address 192.168.1.210 3. Hostname  (ns1.example.com) sudo apt update Install DNS Server The package name for the DNS server on Ubuntu is  bind9  and is available in the base repository. Use the  apt  command to install the  bind9  package. sudo apt install -y bind9 bind9utils bind9-doc dnsutils Configure DNS Server The  /etc/bind/  directory is the main configuration directory of the DNS server, and it holds configuration files and zone lookup files. Global configuration file is  /etc/bind/named.conf . You should not use this file for your local DNS zone rather you can use  /etc/bind/named.conf.local  file. Create Zones Let us begin by creating a forward zone for your domain. sudo nano /etc/bind/named.conf.local Forward Zone The following is the forward zone entry for the  example.com  domain in the  named.conf.l...

Smokeping: Password Protecting

In this post, we will be looking at how to password protect Smokeping. As you may know, Smokeping pages are usually not password protected and can be viewed by anyone by defauly. Limit the view to a limited number of users, either of the following ways are possible- Using the web server configuration file to set passwords Using htaccess to set passwords According to Apache, using .htaccess should be avoided whenever possible, as .htaccess may hamper the web server performance ( Source ). Apache recommends using the web server configuration files for setting up passwords. Here's how it's done. (I am using an Ubuntu Server) Phase 1:  Creating the password file. mkdir /etc/apache2/passwd htpasswd -c /etc/apache2/passwd/passwords username The  -c  is used to create a new user. This parameter can be omitted to change the password of an existing user. Phase 2:  Modifying Smokeping Directives vim /etc/apache2/conf.d/smokeping ### Modify th...