PrettyPrint

lundi 16 novembre 2015

Davmail - Use your favorite client mail with MS Exchange

Many companies are using MS Exchange as mail server, with it's client MS Outlook. And when you are in heterogeneous operating system environment or when you're not fan of Outlook, it become difficult to connect another mail client like Thunderbird on MS Exchange's proprietary protocols like Webdav and OWA.
Fortunately, it exist a Libre Software called DavMail, that I use since 2 years with Thunderbird at work.

The main features can be seen on the picture below (source: DavMail website):
Davmail can be run as server or local mode; we will use the local mode configuration, with the latest version 4.7.0 and the email client Thunderbird.

Installation
Prerequisite: Java (jre)
-Download davmail package for Linux installation:
$ wget -O /tmp/davmail.tar.gz http://downloads.sourceforge.net/project/davmail/davmail/4.7.0/davmail-linux-x86_64-4.7.0-2408.tgz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fdavmail%2Ffiles%2Fdavmail%2F4.7.0%2F&ts=1447659863&use_mirror=liquidtelecom

-Extract the package:
$ tar xzvpf /tmp/davmail.tar.gz -C /opt

-Create a link, to facilitate upgrade:
$ ln -sf /opt/davmail-linux-x86_64-4.7.0-2408 /opt/davmail

-Launch davmail:
$ nohup /opt/davmail/davmail.sh &  #You can automate this

- Configure davmail to act as gateway for your Exchange server:

-Configure Thunderbird:
File > New > Existing email account

Click on "Manual config" button
 -Accept to not use encryption, for local configuration It's not an issue because of the local communication between Thunderbird and DavMail


Configure automatic launching
$gnome-session-properties


It's all folk!!!

You can also configure calendar, directory (address book) and more; go the davmail's documentations  website: http://davmail.sourceforge.net/



mercredi 16 septembre 2015

Get HBA WWN on CentOS Linux

New server with FC-HBAs, witch have to be connect to a SAN-Fabric ?


Get WWPN (Word Wide Port Name)
2 HBA, with 2 ports represent by a host number.

# lspci | grep HBA
05:00.0 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
05:00.1 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
08:00.0 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
08:00.1 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)

#cat /sys/class/fc_host/host*/port_name
0x500143802421ff25
0x500143802421ff27
0x500143802422010d
0x500143802422010f

$grep '0x' /sys/class/fc_host/host*/port_name 
/sys/class/fc_host/host3/port_name:0x500143802421ff25
/sys/class/fc_host/host4/port_name:0x500143802421ff27
/sys/class/fc_host/host5/port_name:0x500143802422010d
/sys/class/fc_host/host6/port_name:0x500143802422010f

Get  Fabric WWNN (Node Name)

# grep '0x' /sys/class/fc_host/host*/fabric_name 
/sys/class/fc_host/host3/fabric_name:0x100000051ec624f6
/sys/class/fc_host/host4/fabric_name:0x100000051ecc4c2a
/sys/class/fc_host/host5/fabric_name:0x100000051ecc4c2a
/sys/class/fc_host/host6/fabric_name:0x100000051ec624f6

After the zoning, we can get the remote node/port name of equipment with who we can communicate:
#cat /sys/class/fc_remote_ports/rport-*/node_name

Parallelize Rsync


1- Sync the directory tree
rsync -a -f"+ */" -f"- *" source/ destination/
2- Parallise rsync (Multiple thread)
cd $SOURCEDIR; find . -type f | xargs -n1 -P$THREADS -I% rsync -az % /$DESTDIR/%


lundi 1 juin 2015

Install and configure a simple Syslog Server CentOS/Rhel

Syslog is a protocol that transports system and application events over the network. It's the default protocol used to log events on Unix/Linux systems and most network equipments. It's also used as server to centralize all events and audit messages of a network, to facilitate their analysis and report. The syslog protocol is documented in the RFC 5424.
The most important attributes for syslog messages are the facility, this is the type of program (24 types) and the severity level (8 levels). The informations contents in each messages are the date, the hostname and the message event itself.
The goal of this paper is to develop a simple centralized syslog server, and it will not discuss of the security part (may be on another paper).

Syslog implementation package have different name depend on the distribution. On Rhel/CentOS 5 --> sylsog, and Rhel/CentOS 6 --> rsyslog. In this paper I use Rhel/CentOS 6, but you can adapt it on the version 5 by replace rsyslog by sylog.

Server: syslog.intra.local
Client: client.intra.local

Step 1: Install rsyslog
Already install on most systems. If not:
[root@syslog]#yum install rsyslog

Step 2: Configure the rsyslog server
Update the file /etc/rsyslog.conf
[root@syslog]#vim /etc/rsyslog.conf

#Turn rsyslog to listen over port 514 on udp (Uncomment or add this line)
$ModLoad imudp$UDPServerRun 514
#Configure the file path for each facility (Your are not obliged to configure all facilities):
kern.* /var/log/kern.log #kernel messages
user.* /var/log/user.log #user-level messages
mail.* /var/log/mail.log #mail system
daemon.* /var/log/daemon.log #system daemons
auth.* /var/log/auth.log #security/authorization messages
syslog.* /var/log/syslog.log #messages generated internally by syslogd
lpr.* /var/log/lpr.log #line printer subsystem
news.* /var/log/news.log #network news subsystem
uucp.* /var/log/uucp.log #UUCP subsystem
9.* /var/log/clock.log #clock daemon
authpriv.* /var/log/authpriv.log #security/authorization message
sftp.* /var/log/ftp.log #FTP daemon
12.* /var/log/ntp.log #NTP subsystem
13.* /var/log/audit.log #log audit
14.* /var/log/alert.log #log alert
cron.* /var/log/cron.log #clock daemon
local0.* /var/log/local0.log #local use 0 (local0)
local1.* /var/log/local1.log #local use 1 (local1)
local2.* /var/log/local2.log #local use 2 (local2)
local3.* /var/log/local3.log #local use 3 (local3)
local4.* /var/log/local4.log #local use 4 (local4)
local5.* /var/log/local5.log #local use 5 (local5)
local6.* /var/log/local6.log #local use 6 (local6)
local7.* /var/log/local7.log #local use 7 (local7)

Step 3: Configure firewall and start rsyslog daemon
Restart the rsylog's daemon:
[root@syslog]#service rsyslog restart
[root@syslog]#iptables -I INPUT 2 -p udp --dport 514 -j ACCEPT #it will open 514/udp for all network
[root@syslog]#service iptables save

Step4: Configure the rsyslog client
Open the rsyslog daemon file configuration:
[root@client]#vim /etc/rsyslog.conf
Add this : *.*   @syslog.intra.local

Step5: Test
For testing, we will use "logger", a shell command interface to send messages to the syslog system.
use: logger -p facility.level "message"

[root@client]#logger -p user.info "This is a test"

on server:
[root@syslog]#tail -1 /var/log/user.log
Jun  1 14:16:05 client root: This is a test

It's all folk!!


With this configuration, all events from all host that send messages on the syslog server will be in one file, for each facility. This is not pratical for searching. We can use rsyslog templates, to organize logs as /var/log/IP_HOST/*.log.
Everyone is not comfortable with the command line, to facilitate searching, reporting and send alerts; for that, we need a more sophisticated tools. On another paper, I will show how to install and configure GraylogIt's an entreprise and open source platform for collecting, indexing, and analyzing both structured and unstructured data from almost any source.