Oracle db connection checking

February 19th, 2012 No comments

If you get an error in Oracle db lookup first check the oracle db connection.

set the oracle path variables

export ORACLE_HOME=/home/oracle/libexec/oracle
export TNS_ADMIN=/home/oracle/conf/oracle

tnsping dbname
Tns ping output :-

-bash-3.2$ tnsping dbname

TNS Ping Utility for Linux: Version 9.2.0.4.0 - Production on 18-APR-2012 23:18:07

Copyright (c) 1997 Oracle Corporation.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = data.unimaxlin.com)(PORT = 1832))) (CONNECT_DATA = (SID = MINE)))
OK (10 msec)

Connect the db with sql plus and check the uptime and status.

sqlplus user@dbname
password : enter the password

SQL> select instance_name,startup_time,logins,status from gv$instance;
INSTANCE_NAME    STARTUP_T LOGINS     STATUS
---------------- --------- ---------- ------------
MINE             05-AUG-11 ALLOWED    OPEN
Did you like this? Share it:
Categories: Uncategorized Tags:

Missing Dependency: perl(URI) >= 1.17 is needed

September 8th, 2011 1 comment

root@bastian [~]# yum install subversion
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: centos.mirror.netriplex.com
* base: centos.mirror.netriplex.com
* extras: mirrors.igsobe.com
* updates: ftp.usf.edu
Excluding Packages in global exclude list
Finished
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package subversion.i386 0:1.6.11-7.el5_6.4 set to be updated
–> Processing Dependency: perl(URI) >= 1.17 for package: subversion
–> Finished Dependency Resolution
subversion-1.6.11-7.el5_6.4.i386 from updates has depsolving problems
–> Missing Dependency: perl(URI) >= 1.17 is needed by package subversion-1.6.11-7.el5_6.4.i386 (updates)

Packages skipped because of dependency problems:
subversion-1.6.11-7.el5_6.4.i386 from updates

Fix

wget http://mirror.centos.org/centos/5/os/i386/CentOS/perl-URI-1.35-3.noarch.rpm
rpm -Uvh perl-URI-1.35-3.noarch.rpm

Did you like this? Share it:
Categories: cpanel Tags:

Apache Killer , Range Header Ddos vulnerabilty mitigation

August 27th, 2011 No comments

A denial of service vulnerability has been found in the way the multiple overlapping ranges are handled by apache. It most commonly manifests itself when static content is made available with compression on the fly through mod_deflate – but other modules which buffer and or generate content in-memory are likely to be affected as well.

The attack can be done remotely and with a modest number of requests leads to very \
significant memory and CPU usage.

Active use of this tools has been observed in the wild.

There is currently no patch new version of apache which fixes this vulnerability. i am looking for apache to for the patch

Mitigation:
————

However are several immediate options to mitigate this issue until that time:

1) Use mod_headers to dis-allow the use of Range headers:

		RequestHeader unset Range 

Note that this may break certain clients – such as those used for
e-Readers and progressive/http-streaming video.

2) Use mod_rewrite to limit the number of ranges:

		RewriteCond %{HTTP:range} ^bytes=[^,]+(,[^,]+){0,4}$
		RewriteRule .* - [F]

3) Limit the size of the request field to a few hundred bytes. Note that while this
keeps the offending Range header short – it may break other headers; such as sizable
cookies or security fields.

		LimitRequestFieldSize 200

Note that as the attack evolves in the field you are likely to have
to further limit this and/or impose other LimitRequestFields limits.

See: http://httpd.apache.org/docs/2.2/mod/core.html#limitrequestfieldsize

3) Deploy a Range header count module as a temporary stopgap measure:

http://people.apache.org/~dirkx/mod_rangecnt.c

4) If your server (only) server static content then disable compression-on-the-fly
by:

	1)	removing mod_deflate as a loaded module and/or by removing any 
		AddOutputFilterByType/SetOutputFilter DEFLATE entries.

	2) 	Disable it with "BrowserMatch .* no-gzip"

See: http://httpd.apache.org/docs/2.0/mod/mod_deflate.html

http://httpd.apache.org/docs/2.2/mod/mod_deflate.html

5) Apply any of the current patches under discussion – such as:

http://mail-archives.apache.org/mod_mbox/httpd-dev/201108.mbox/%3cCAAPSnn2PO-d-C4nQt_
TES2RRWiZr7urefhTKPWBC1b+K1Dqc7g@mail.gmail.com%3e

Actions:
——–
Apache HTTPD users are advised to investigate wether they are vulnerable (e.g. allow
Range headers and use mod_deflate) and consider implementing any of the above
mitigations.

Planning:
——–

This advisory will be updated when a fix/patch or new release is available. A patch \
or new apache release for Apache 2.0 and 2.2 is expected in the next 96 hours. Note \
that, while popular, Apache 1.3 is deprecated.

Ref: http://marc.info/?l=apache-httpd-dev&m=131418828705324&w=2

Did you like this? Share it:
Categories: freebsd, nginx, wordpress Tags: ,

activecampaign rewrite rules for nginx webserver

July 27th, 2011 No comments

RewriteEngine On
RewriteBase /
# KB
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/kb

RewriteRule . /kb/index.php [L]

# KB DESKS WITHOUT SLASHES
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/desk/([^/]+)/kb$

RewriteRule (.*) $1/ [R=301,L]

# KB DESKS
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/desk/([^/]+)/kb

RewriteRule desk/([^/]+)/kb(.*) /kb$2 [L]


# HD DESKS WITHOUT SLASHES
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/desk/([^/]+)$

RewriteRule (.*) $1/ [R=301,L]


# HD DESKS
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/desk/([^/]+)

RewriteRule desk/([^/]+)(.*) $2 [L]


# HD
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]



see how i have configured it in nginx webserver

cd /usr/local/etc/nginx
touch  activecampaign_rewrite
vi activecampaign_rewrite

if ($uri ~ "^/desk/([^/]+)/kb/?$"){
        rewrite /(desk/[^/]+)/kb/? /$1/kb/index.php permanent;
        break;
}
if ($uri ~ "^/desk/([^/]+)/kb"){
        rewrite /desk/([^/]+)/kb(.*) /kb$2 last;
}
if ($uri ~ "^/desk/([^/]+)$"){
        rewrite /(.*) /$1/ permanent;
        break;
}
if ($uri ~ "^/desk/([^/]+)"){
        rewrite /desk/([^/]+)(.*) $2 last;
}
if (!-f $request_filename){
        set $rule_5 1$rule_5;
}
if (!-d $request_filename){
        set $rule_5 2$rule_5;
}
if ($rule_5 = "21"){
        rewrite /(.*) /index.php last;
}




and i include the file in nginx.conf

include activecampaign_rewrite;

Did you like this? Share it:

migrate media wiki from apache to nginx

July 19th, 2011 No comments
server {
    listen   80;
    server_name wiki.unimaxlin.com;
   
    location / {
        root   /home/wiki;
        index  index.html index.htm index.php;
         try_files $uri $uri/ /index.php;

    }
   
    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME  /home/wiki$fastcgi_script_name;
    }
}

from the source
scp -r /home/user/public_html/wiki/ to nginx server
grep $wgDBname LocalSettings.php
$wgDBname = “user_wikidb”

Dump the database

mysqldump user_wikidb > user_wikidb.sql

scp user_wikidb.sql to nginx server

grep $wgDBuser LocalSettings.php
$wgDBuser = “user_wiki212″
grep $wgDBpassword LocalSettings.php

$wgDBpassword = “bjewgvfewuk%^%”;

On the nginx server

Restore the database

mysql
create database user_wikidb;
log out

mysql user_wikidb < user_wikidb.sql

create the user and set the privliages

mysql>
create user ‘user_wiki212′@’localhost’ identified by ‘bjewgvfewuk%^%’;

grant all privliages on user_wikidb.* to ‘user_wiki212′@’localhost’;

Migrations completed

if you face a Unable to login – action cancaled again session hijacking error while trying to login with the user

create a temp dir on you document root

mkdir tmp
chmod 777

vi LocalSettings.php
session_save_path(“tmp”);
$wgCacheEpoch = max( $wgCacheEpoch, gmdate( ‘YmdHis’, @filemtime( __FILE__ ) ) );

it will fix the issue

Unable to login – action cancaled again session hijacking

Did you like this? Share it:
Categories: nginx Tags:

Open Suse firewall SuSEfirewall2 which is iptables

July 1st, 2011 No comments

I have tried to block a range of ips in open suse firewall but i cannot found iptables command in open suse box finally i found that we need to enable susefirewall2 for working with iptables

To start the firewall:

/sbin/SuSEfirewall2 on

Then iptables command will work in opensuse

iptables -L worked

If you want to temporarily disable your firewall:


/sbin/SuSEfirewall2 off

/etc/init.d/SuSEfirewall2_setup stop

firewall file in opensuse

nano /etc/sysconfig/SuSEfirewall2.

edit the file and reload the rules !!

blocked a range of ips in suse firewall

iptables -I INPUT -s 200.16.1.0/24 -j DROP
Did you like this? Share it:

duplicating mysql table

June 30th, 2011 No comments

My client need to create a duplicate table items , which is to be created a as items_dup in same database so i have take an mysql dump from and replaced the items string with items_dup using sed but it does n`t work so i have googled a lot but i can`t find a solution..

See what i did

take a mysqldump of that table and restore it in test db the rename it the again dump and store in orginal database

mysqlsump -f -p internal items > items.sql
Password:

mysql -f -p test < items.sql

mysql>use test;
mysql>rename table items to items_dup;

mysqldump test items_dup > items_dup.sql

the resotore it

mysql internal < items_dup.sql

Did you like this? Share it:

wp-admin return 500 error in freebsd

May 3rd, 2011 No comments

It seems to be caused by FreeBSD incorrectly thinking that the required files have been included as asked for in PHP using a require_once function.

Fix

require(dirname(dirname(__FILE__)) . '/wp-load.php');

[original line]
require_once(dirname(dirname(__FILE__)) . ‘/wp-load.php’);

/home/website/html/blog/wp-admin/admin-ajax.php

Fixed by changing require_once to require .

require(‘../wp-load.php’);

Did you like this? Share it:

WordPress redirection issues in nginx

April 21st, 2011 No comments

WordPress is designed for apache and i can see a lots of issues noticed with nginx . We can fix this issuew with nginx-compatabilty plugin from wordpress

permalinks will not work properly by default in nginx

http://wordpress.org/extend/plugins/nginx-compatibility

cd /wp-content/plugins/ 
wget http://downloads.wordpress.org/plugin/nginx-compatibility.0.2.5.zip
unzip nginx-compatibility.0.2.5.zip
Did you like this? Share it:
Categories: wordpress Tags:

Update a single port in freebsd

April 20th, 2011 No comments

I need to update nginx immediate from ports i know portssnap fetch will take some time to update the port tree so i have done a easy method to update a single port by a shortcut

web1.diesel 10:14 AM| /usr/ports/www/nginx]# head distinfo 
MD5 (nginx-0.8.53.tar.gz) = 717eaea1b34e8663849f64b9aa05a9da

I need to update it to 1.0.0

[web1.| /usr/ports/www/nginx]# head Makefile
# New ports collection makefile for: nginx
# Date created: 11 Oct 2004
# Whom: osa
#
# $FreeBSD: ports/www/nginx/Makefile,v 1.237 2010/10/28 09:45:30 osa Exp $
#

PORTNAME= nginx
PORTVERSION= 0.8.53
CATEGORIES= www

chnage it to

PORTVERSION= 1.0.0

[web1.| /usr/ports/www/nginx]# make makesum

which update the ports tree…..

Did you like this? Share it:
Categories: freebsd Tags: