Thursday, August 23, 2018

Monitoring Audit Log Linux File Access, File Open , Changes and Data Modifications

Monitoring Audit Log Linux File Access, File Open, 
Changes and Data Modifications

Step -1

Create an audit policy watch rule.

[root@muthayammal ssh]# auditctl -w /etc/passwd -p war -k password-file

Step -2

finding audit log linux file open / file open detect  and modification / changes.

[root@muthayammal ssh]# ausearch -f /etc/passwd -i
----
time->Thu Aug 23 14:55:36 2018
type=PROCTITLE msg=audit(1535016336.242:81887): proctitle=67726570002D2D636F6C6F723D6175746F00736F6D657468696E67002F6574632F706173737764
type=PATH msg=audit(1535016336.242:81887): item=0 name="/etc/passwd" inode=134980183 dev=fd:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 objtype=NORMAL cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0type=CWD msg=audit(1535016336.242:81887):  cwd="/etc/ssh"type=SYSCALL msg=audit(1535016336.242:81887): arch=c000003e syscall=257 success=yes exit=3 a0=ffffffffffffff9c a1=7ffd11eb181d a2=0 a3=0 items=1 ppid=14653 pid=15174 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=4275 comm="grep" exe="/usr/bin/grep" key="password-file

Step -3

List running audit policy.

[root@muthayammal etc]# auditctl -l
-w /etc/passwd -p rwa -k password-file

Step -4

Delete Audit policy using below command.

[root@muthayammal etc]# auditctl -D -k password-file
No rules

Saturday, August 11, 2018

Centos (Linux) adding multiple IP addresses and adding NIC Routing

Centos (Linux) adding multiple IP addresses and adding NIC Routing


Step-1:-

NIC Interfaces config are as follow :

root#cd /etc/sysconfig/network-scripts

ETH0 :  (ifcfg-ens160)

TYPE="Ethernet"
NAME="ens160"
UUID="21a11fc4-899c-4d3c-bf55-82cb2b5b64ab"
ONBOOT="yes"
HWADDR="90:0C:29:fg:2B:44"
IPADDR=192.168.100.211
NETMASK=255.255.255.0
GATEWAY=192.168.100.1


ETH1 : (ifcfg-ens192)

TYPE="Ethernet"
IPADDR=103.58.120.120
NETMASK=255.255.255.240
GATEWAY=103.58.120.113
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
DNS1=103.58.200.2
DNS2=8.8.8.8
NAME="ens192"
ONBOOT="yes"
HWADDR="00:0c:29:ed:2b:11"
PEERDNS="yes"
PEERROUTES="yes"

Step-2:-

Add default External Geway address (Optional).

[root@localhost sysconfig]# cat /etc/sysconfig/network
GATEWAY=103.58.120.113

Step-3:-

Create Shell scripts adding both IP address gateway for simultaneous access.

root#vi /root/network.sh

#!/bin/sh

ip rule add from 103.58.120.112/28 pref 200 lookup 201
ip route add default via 103.58.120.113 dev ens192 table 201

ip rule add from 192.168.100.0/24 pref 200 lookup 202
ip route add default via 192.168.100.1 dev ens160 table 202

ip route flush cache

Reference Note:-

103.58.120.112/28 - Subnet
103.58.120.113 - Gateway

192.168.100.0/24 - Subnet
192.168.100.1 - Gateway

Step-4:-

Provide execute permission shell scripts.

root#chmod 755 /root/network.sh
root#chmod +x /root/network.sh

Step-5:-

Add shell script file path into init.d network file for auto adds the default gateway. if any node restart.

root#vi /etc/init.d/network

#! /bin/bash
#
# network       Bring up/down networking
#
# chkconfig: 2345 10 90
# description: Activates/Deactivates all network interfaces configured to \
#              start at boot time.
#
### BEGIN INIT INFO
# Provides: $network
# Should-Start: iptables ip6tables NetworkManager-wait-online NetworkManager
# Short-Description: Bring up/down networking
# Description: Bring up/down networking
### END INIT INFO

./root/network.sh

Step-6:-

Perform the restart command.

root#reboot

After successful Reboot the Linux system. It will accessible both IP address segments.

Reference other sites - https://serverfault.com/questions/567249/centos-multiple-nics-routing-issue

Gitlab Automation Project Showcase

My GitLab Projects Showcase 🚀 Welcome to my portfolio of GitLab projects. Each repository reflects my journey as an engineer, focusing...