Monday, March 24, 2014

Upgrade to CentOS 6.5 from CentOS 6.4/6.3/6.2/6.1/6.0


1)  yum clean all

2) yum update glibc* yum* rpm* python* 3) yum update
4) init 6
5) cat /etc/redhat-release

Tuesday, March 11, 2014

How To Disconnect Non-Mapped UNC Path “Drives” in Windows

Have you ever browsed over to another PC on your network using “network neighborhood”, and then connected to one of the file shares? Without a drive letter, how do you disconnect yourself once you’ve done so?
Really confused as to what I’m talking about? Let’s walk through the process. First, imagine that you browse through and connect to a share, entering your username and password to gain access.
image

The problem is that you stay connected, and there’s no visible way to disconnect yourself. If you try and shut down the other PC, you’ll receive a message that users are still connected. So let’s disconnect!
Open up a command prompt, and then type in the following:
net use


This will give you a list of the connected drives, including the ones that aren’t actually mapped to a drive letter. To disconnect one of the connections, you can use the following command:
net use /delete \\server\sharename
For example, in this instance we’d disconnect like so:
net use /delete \\192.168.1.205\root$


Now when you run the “net use” command again, you’ll see that you’ve been properly disconnected.


If you wanted to actually connect to a share without mapping a drive letter, you can do the following:
net use /user:Username \\server\sharename Password 

Monday, September 30, 2013

Enabling Desktop Alerts in Outlook when using IMAP

Microsoft Outlook does not support desktop alerts as standard when using the IMAP protocol for email.  To enable desktop alerts a rule needs to be set in Outlook.  Please follow the instructions below to enable in Outlook.
Outlook 2003
  1. Start Outlook
  2. Go to Tools -> Rules and Alerts
  3. Select New Rule
  4. Select Start from a blank rule
  5. Select Check Messages when they arrive
  6. Click Next
  7. Click Next
  8. Select Yes to apply the rule to every message
  9. Select the checkbox for "display a Desktop Alert"
  10. Select Finish
  11. Select OK
Outlook 2007
  1. Start Outlook
  2. Go to Tools -> Rules and Alerts
  3. Select New Rule
  4. Select Check Messages when they arrive
  5. Click Next
  6. Click Next
  7. Select Yes to apply the rule to every message
  8. Select the checkbox for "display a Desktop Alert"
  9. Select Finish
  10. Select OK

Friday, August 30, 2013

Samba Restrict File Sharing To Particular Users or Network Addresses

hosts allow: Samba Configuration
Open your smb.conf file and add the following line to [share]
[share]
  hosts allow = 192.168.2. 127.0.0.1
valid users: Samba Configuration
Open your smb.conf file and add the following line to [share]
[share]
  valid users = user1 user2 @group1 @group2
read only & write only: Samba Configuration
You can also set read and write access to set of users with the read list and write list directives.
[share]
     read only = yes
     write list = user1 user2 @group1 @group2
Examples
Make [sales] share read only but allow user tom and jerry to write it:
[sales]
     comment = All Printers
     path = /nas/fs/sales
     read only = yes
     write list = tom jerry
You can also configure iptables to allow access to the Samba server

Thursday, August 15, 2013

Lightsquid : Monitoring SQUID users


Install LightSquid to generate Squid Log Report.

In Redhat 6.4

[1]Install LightSquid
[root@prox ~]# 
yum --enablerepo=epel -y install lightsquid lightsquid-apache 
  
# install from EPEL
[root@prox ~]# 
vi /etc/httpd/conf.d/lightsquid.conf
<Directory /usr/share/lightsquid/cgi>
     DirectoryIndex index.cgi
     Options ExecCGI
     AddHandler cgi-script .cgi
     AllowOverride None
     
# IP address you permit

     Order Deny,Allow
     Deny from all
     Allow from 127.0.0.1 10.0.0.0/24
</Directory>
[root@prox ~]# 
/etc/rc.d/init.d/httpd restart 

Stopping httpd: [ OK ]
Starting httpd: [ OK ]
# generate log report

[root@prox ~]# 
/usr/sbin/lightparser.pl
# log report is generated every day by cron
[2]Access to "http://(server's hostname or IP address)/lightsquid/" with web browser


IN Redaht 5

1. Download the lightsquid from “http://lightsquid.sourceforge.net/”
2. Install apache and start it
3. Copy the lightsquid folder to any web location like ” /var/www/html/”
4. Add an entry like as below in httpd.conf
#vi /etc/httpd/conf/httpd.conf   
 <Directory "/var/www/html/lightsquid">
   AddHandler cgi-script .cgi
   AllowOverride All
   deny from all
   allow from <my ip>
   </Directory>
Configuring lightsquid
A. Switch to lightsquid directory and check necessary perl libraries are present.
[root@rc-009 lightsquid]# perl check-setup.pl
LightSquid Config Checker, (c) 2005-9 Sergey Erokhin GNU GPL
LogPath   : /var/log/squid
reportpath: /var/www/html/lightsquid/report
Lang      : /var/www/html/lightsquid/lang/eng
Template  : /var/www/html/lightsquid/tpl/base
Ip2Name   : /var/www/html/lightsquid/ip2name/ip2name.simple
all check passed, now try ac
cess to cgi part in browser
[root@rc-009 lightsquid]#
Pls note you may need to install perl “CGI” and “GD” library. GD is an optional to enable graph support. Sometime you may get error as follows,
Can’t locate CGI.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
Solution is
[root@rc-009 lightsquid]# perl -MCPAN -e shell
Terminal does not support AddHistory.
cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support available (try 'install Bundle::CPAN')
cpan> install CGI
cpan> install GD
B. Set the scheduler to parse the squid log file.
a. Open the “lighsquid.cfg ” file and verify the squid log path is correctly set. You may also change the certain values as you wish like to get best graph size change the value to “$graphmaxall=3.50*(1024*1024*1024);” etc.
  $logpath             ="/var/log/squid";
b. Set the cronjob as follows
#crontab -l
        */50 * * * * /usr/bin/perl /var/www/html/lightsquid/lightparser.pl >/dev/null 2>&<code>
<strong>C. Customize the User-IP mapping file</strong>
      You need to  add all the users entry inside the "realname.cfg" file 
       Eg: < IP>    <User name >
      <code>[root@rc-009 lightsquid]# grep "Liju"  realname.cfg
      192.168.0.14    Liju
You may also create groups by editing group.cfg. Add the entry like this
#cat  group.cfg
           Liju      01 SysAdmin
           Arun    01   SysAdmin
           Jacob  02    Support 
           Tom   02         Support
That’s it. Try to run the parser to get first report.
/usr/bin/perl /var/www/html/lightsquid/lightparser.pl
Now it’s your turn to keep eye on user’s activity. Access the lightsquid over the ip ie http://squidserver ip/lightsquid

Thanks 



Monday, April 29, 2013

How To Block File Uploads Using Squid ACL’s


This article explains how to block someone from uploading files to a website such as Gmail or Hotmail using Squid with a simple shell script. The key feature of this process is that because we’re using an ACL, we can apply this rule to groups of users and computers as we would any other ACL.

Install Squid:
apt-get install squid
Edit the squid configuration file “/etc/squid/squid.conf” to look like the following:
acl all src all
http_port 3128
access_log /var/log/squid/access.log squid

external_acl_type request_body %{Content-Length} /usr/bin/upload.sh
# 1MB max upload
acl noupload external request_body 1024000

http_access deny !noupload
http_access allow all
Now create your script file:
touch /usr/bin/upload.sh
chmod 755 /usr/bin/upload.sh
Add the following content to your new script file “/usr/bin/upload.sh”:
#!/bin/sh
while read size limit; do
  if [ "${size}" -gt "${limit}" ]; then
    echo ERR
  else
    echo OK
  fi
done
Now start (restart) Squid:
/etc/init.d/squid start

Wednesday, April 3, 2013

Installation & Configuration in OTRS @ REDHAT/CENTOS



Hi   Today we are going to discuss OTRS  installation and configuration in REDHAT/CENOS

Download noarch.rpm from http://www.otrs.com/en/open-source/get-otrs/software-download/

Prerequisites

Before installing OTRS, we have to do couple of prerequisites first

Install and enable EPEL repository.

First go to the EPEL repository download page. Download the latest EPEL rpm and install it as shown below.
# wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -Uvh epel-release-6-8.noarch.rpm
Log in as root user and Install Mysql server using the following command:
yum install mysql-server
Start mysql service as shown below:
service mysqld start
chkconfig mysqld on
By default, Mysql root user is blank. So let us setup the root user password as shown below:
mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
 SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): -----> Press Enter
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] y -----> Enter Y and press Enter
 New password: -----> Enter the new password
 Re-enter new password: -----> Enter password again
 Password updated successfully!
 Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
 to log into MySQL without having to have a user account created for
 them.  This is intended only for testing, and to make the installation
 go a bit smoother.  You should remove them before moving into a
 production environment.

Remove anonymous users? [Y/n] y -----> Press Enter
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
 ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y -----> Press Enter
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
 access.  This is also intended only for testing, and should be removed
 before moving into a production environment.

Remove test database and access to it? [Y/n] y -----> Press Enter
 - Dropping test database...
 ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
 will take effect immediately.

Reload privilege tables now? [Y/n] y -----> Press Enter
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
 installation should now be secure.

Thanks for using MySQL!
MySQL has been installed successfully with default options. In order to work properly with OTRS, we have to add the following directives into the my.cnf file.
Edit file /etc/my.cnf,
vi /etc/my.cnf
Add the following lines under the [mysqld] section:
max_allowed_packet=20M
query_cache_size=32M
Save and close the file.
Next, restart mysql service using the following command:
service mysqld restart
Next, Install httpd package with command:
yum install httpd
Start httpd service, and make it to start automatically on every reboot.
service httpd start
chkconfig httpd on

Download OTRS

Go to the OTRS download page and download the latest version.
wget http://ftp.otrs.org/pub/otrs/RPMS/rhel/6/otrs-3.3.6-01.noarch.rpm
The above will download and save the OTRS rpm file in the current directory. Install it using command:
yum install otrs-3.3.6-01.noarch.rpm
The above command will install otrs package along with all required packages.
Finally, restart httpd service one more time after installing OTRS.
service httpd restart
During OTRS installation, keep attention on the installer. It will display the web installer URL for OTRS.
Look at the following screenshot.
root@server:~_001

Install Additional PERL modules

Before proceeding to configure OTRS, you should install additional perl modules. Run the following command to know the required modules by OTRS:
/opt/otrs/bin/otrs.CheckModules.pl
Sample output:
o Crypt::Eksblowfish::Bcrypt.......Not installed! (optional - For strong password hashing.)
 o Crypt::SSLeay....................ok (v0.57)
 o Date::Format.....................ok (v2.22)
 o DBI..............................ok (v1.609)
 o DBD::mysql.......................ok (v4.013)
 o DBD::ODBC........................Not installed! (optional - Required to connect to a MS-SQL database.)
 o DBD::Oracle......................Not installed! (optional - Required to connect to a Oracle database.)
 o DBD::Pg..........................Not installed! (optional - Required to connect to a PostgreSQL database.)
 o Encode::HanExtra.................Not installed! (optional - Required to handle mails with several Chinese character sets.)
 o GD...............................Not installed! (optional - Required for stats.)
 o GD::Text.......................Not installed! (optional - Required for stats.)
 o GD::Graph......................Not installed! (optional - Required for stats.)
 o IO::Socket::SSL..................ok (v1.31)
 o JSON::XS.........................Not installed! (optional - Recommended for faster AJAX/JavaScript handling.)
 o List::Util::XS...................ok (v1.21)
 o LWP::UserAgent...................ok (v6.05)
 o Mail::IMAPClient.................Not installed! (optional - Required for IMAP TLS connections.)
 o IO::Socket::SSL................ok (v1.31)
 o ModPerl::Util....................ok (v2.000004)
 o Net::DNS.........................ok (v0.65)
 o Net::LDAP........................ok (v0.40)
 o Net::SSL.........................ok (v2.84)
 o PDF::API2........................Not installed! (optional - Required for PDF output.)
 o Compress::Zlib.................ok (v2.021)
 o Text::CSV_XS.....................Not installed! (optional - Recommended for faster CSV handling.)
 o Time::HiRes......................ok (v1.9721)
 o XML::Parser......................ok (v2.36)
 o YAML::XS.........................Not installed! (required - Please install this module - )
As you see in the above output, some perl modules are missing. Install them all at once or one by one as shown below.
yum install "perl(Crypt::Eksblowfish::Bcrypt)" "perl(DBD::ODBC)" "perl(DBD::Oracle)" "perl(DBD::Pg)" "perl(Encode::HanExtra)" "perl(GD)" "perl(GD::Text)" "perl(GD::Graph)" "perl(JSON::XS)" "perl(Mail::IMAPClient)" "perl(PDF::API2)" "perl(Text::CSV_XS)" "perl(YAML::XS)"

If it is not working your can install through perl promt:

Before make sure 

# yum install make gcc gd gd-devel

# perl -MCPAN -e shell;

cpan[15]> help

cpan[15]>  install YAML::XS

Now, check again for any missing modules.
/opt/otrs/bin/otrs.CheckModules.pl
Sample output:
o Crypt::Eksblowfish::Bcrypt.......ok (v0.009)
 o Crypt::SSLeay....................ok (v0.57)
 o Date::Format.....................ok (v2.22)
 o DBI..............................ok (v1.609)
 o DBD::mysql.......................ok (v4.013)
 o DBD::ODBC........................ok (v1.48)
 o DBD::Oracle......................Not installed! (optional - Required to connect to a Oracle database.)
 o DBD::Pg..........................ok (v2.15.1)
 o Encode::HanExtra.................ok (v0.23)
 o GD...............................ok (v2.44)
 o GD::Text.......................ok (v0.86)
 o GD::Graph......................ok (v1.44)
 o IO::Socket::SSL..................ok (v1.31)
 o JSON::XS.........................ok (v2.27)
 o List::Util::XS...................ok (v1.21)
 o LWP::UserAgent...................ok (v6.05)
 o Mail::IMAPClient.................ok (v3.34)
 o IO::Socket::SSL................ok (v1.31)
 o ModPerl::Util....................ok (v2.000004)
 o Net::DNS.........................ok (v0.65)
 o Net::LDAP........................ok (v0.40)
 o Net::SSL.........................ok (v2.84)
 o PDF::API2........................ok (v2.019)
 o Compress::Zlib.................ok (v2.021)
 o Text::CSV_XS.....................ok (v0.85)
 o Time::HiRes......................ok (v1.9721)
 o XML::Parser......................ok (v2.36)
 o YAML::XS.........................ok (v0.38)
If everything seems good, proceed to web installer.

Begin OTRS Web installer

OTRS development team has made a simple way web based installer to make the installation lot easier.
Open up the web browser and navigate to http://ip-address/otrs/installer.pl.
The following screen will appear. Click Next to continue.
Configuring the database

The simple way - Using the web installer (works only with MySQL)

If you use MySQL as the database back-end, you can use the OTRS web installer: http://localhost/otrs/installer.pl .
When the web installer starts, please follow the next steps to setup your system:
1. Check out the information about the OTRS offices and click on next to continue (see Figure below).
Figure: Welcome screen.
2. Read the GNU Affero General Public License (see Figure below) and accept it, by clicking the corresponding button at the bottom of the page.
Figure: GNU Affero General Public License.
3. Provide the username and password of the administrator, the DNS name of the computer which hosts OTRS and the type of database system to be used. After that, check the settings (see Figure below).
Figure: Database initial settings.
You will be notified if the check was successful. Press OK to continue (see Figure below).
Figure: Notification for successful check.
4. Create a new database user, choose a name for the database and click on 'Next' (see Figure below).

Warning

It is never a good idea to use default passwords. Please change the default password for the OTRS database!
Figure: Database settings.
If the database and its user were successfully created, you will get a setup notification, as shown in Figure. Click 'Next' to go to the next screen.
Figure: Notification indicating successful database setup.
5. Provide all the required system settings and click on 'Next' (see Figure below).
Figure: System settings.
6. If you want, you can provide the needed data to configure your inbound and outbound mail, or skip this step by pressing the right button at the bottom of the screen (see Figure below).
Figure: Mail configuration.
7. Restart the OTRS service now to use the new configuration settings as shown in the script below.
linux:~ # rcotrs restart-force
Shutting down OTRS
 Disable /opt/otrs/bin/otrs.PostMaster.pl ... done.
no crontab for otrs
 Shutting down cronjobs ... failed!
Shutting down OTRS (completely)
 Shutting down Apache ... done.
 Shutting down MySQL ... done.
                                                                     done
Starting OTRS (completely)
 Starting Apache ... done.
 Starting MySQL ... done.
Starting OTRS
 Checking Apache ... done.
 Checking MySQL ... done.
 Checking database connect... (It looks Ok!).
 Enable /opt/otrs/bin/otrs.PostMaster.pl ... done.
 Checking otrs spool dir...  done.
 Creating cronjobs (source /opt/otrs/var/cron/*) ... done.

  -->> http://linux.example.com/otrs/index.pl <<--
                                                                     done
                                                                     done
linux:~ #
Script: Restarting the OTRS service.
Congratulations! Now the installation of OTRS is finished and you should be able to work with the system (see Figure below). To log into the web interface of OTRS, use the address http://localhost/otrs/index.pl from your web browser. Log in as OTRS administrator, using the username 'root@localhost' and the password 'root'. After that you can configure the system for your needs.




Thanks :- http://doc.otrs.org/3.1/en/html/manual-installation-of-otrs.html

For Troubleshooting

Suppose a package perl package as missing  like

YAML::XS.........................Not installed! (required - use "perl -MCPAN -e shell;" - )

Run   perl -MCPAN -e shell;

use   h for help

update all perl package

install YAML::XS   -> For installing yaml::XS pakage