Wednesday, October 30, 2013

iMacri tips

VERSION BUILD=7030862
SIZE X=1360 Y=768
TAB T=1
URL GOTO=http://www.lexisnexis.com/hottopics/lnacademic/?shr=t&sfi=AC00NBEasySrch
FRAME F=2
TAG POS=1 TYPE=A ATTR=TXT:Power<SP>Search
TAG POS=1 TYPE=TEXTAREA FORM=NAME:searchForm ATTR=ID:terms CONTENT=acorda<SP>Pharmaceuticals<SP>stock<SP>offering
TAG POS=1 TYPE=SELECT FORM=NAME:searchForm ATTR=ID:dateSelector1 CONTENT=%from
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:searchForm ATTR=ID:fromDate1 CONTENT=1/1/2000
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:searchForm ATTR=ID:toDate1 CONTENT=1/1/2010
DS CMD=LDOWN X=223 Y=413 CONTENT=
DS CMD=LUP X=223 Y=413 CONTENT=
DS CMD=KEY X=223 Y=413 CONTENT=business<SP>wire
WAIT SECONDS=2
DS CMD=LDOWN X=223 Y=431 CONTENT=
DS CMD=LUP X=223 Y=431 CONTENT=
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:searchForm ATTR=VALUE:Search

Friday, October 18, 2013

Parse error: syntax error, unexpected T_VARIABLE in \ /usr/local/apache/htdocs/stat/config.inc.php on line 25

Error:
Parse error: syntax error, unexpected T_VARIABLE in  \
/usr/local/apache/htdocs/stat/config.inc.php on line 25


Solution:

put a ";" at the end of hostfile var

A basic template for website Search Engine Optimisation

Here are some basic tips on optimising your site for Google and other search engines.

Use keywords:

  • in your META keywords (128 characters max)

  • in your META description (keep keyword close to the left but in a fill sentence).

  • in the page title at the far left but possibly not as the first word

  • in the first portion of the page (first sentence of the first full paragraph)

  • in an H3 or larger tag heading

  • in bold in the lower half of the page (anywhere but the first usage on page)

  • in italic in the lower half of the page (anywhere but the first usage on page)

  • in the URL (directory name, filename or domain name). Do not duplicate the keyword in the URL

  • in an image filename useed on the page

  • in image ALT attribute

  • in image TITLE attribute

  • in link TITLE attribute

  • in the filename of your external CSS javascript files

  • in a link to a site that has a PageRank of 8 or better




Other optimisation tips:

  • Use "last modified" headers if you can

  • Validate your HTML. Google's parser will miss parts of web pages if they contain simple HTML errors

  • Wherever possible keep the page as .html or .htm extension

  • Keep the HTML below 20K. 5-15K is the ideal range

  • Keep the ratio of text to HTML very high. Text should outweight HTML by significant amounts

Password protecting a directory in Webmin

rmally we use .htaccess and .htpassword files for setting up password protection for accessing certain pages/folders/directories.

In Webmin, there is an option called "Password protecting a directory" set up for you.

Below are the easy steps to password protect a directory using Webmin:

1) login in to the Webmin interface

2) Main menu -> choose "Others" -> choose "Protected Web Directories" -> "Add protection for a new diretcory"
3) in settings:

Directory path: select the path/directory which you want to protect
File containing users: if any, or choose automatically

File containing groups: if any, or choose None

Password encryption: choose the encryption type

Authentication realm: the name will appear in login box, ex: "Admin Area"

Users to allow: put the username you want to setup in "Only Users:" field

4) click the "Create" button

5) in the next page, you can add/edit password for this user, then click submit/save button. It's done!

Saturday, October 12, 2013

Wednesday, October 2, 2013

Squid as a transparent proxy over ssl https



Setting up squid as a transparent proxy is fairly an easy job. If we Google for “how to set up squid as a transparent proxy” Google renders a lots of links for our reference. But it is commonly seen that when we are using transparent proxy we are unable to connect to https connection like Gmail and many more sites which https protocol for security concern. Sites which use http protocol can easily open.

Let’s understand first how squid proxy works in transparent mode. While setting up squid as a transparent proxy we can forward the entire request coming from port 80 to squid server’s port i.e. 3128 by default. When we talk about port 80 it means http protocol. What if we request for Gmail who uses https protocol and this protocol by default send request to port 443 of squid’s port, and we iptable firewall rules to forward traffic from port 80 to port 3128 and we forget about port 443 which is used by https protocol and squid is http proxy server. Now many folks may think it’s easy and forward all traffic coming from port 443 to squid port 3128.  No it won’t work.  Because https connection establishes a secure connection over the network and for that it uses certificate and public key private key pairs. And first of all I thanks God for RSA and DSA algorithm as it is not so easy to decrypt data which is encrypted by use of this algorithm. Squid proxy is a middle man who changes packets header and route traffic to internet world. So what we have to do is to create certificate and public key private key pair for internal network which can be used by squid client and squid server and later squid server can route your traffic to internet world. To yield faster results it is better to sign certificate from CA. self signed certificates are little bit slowing the connection. As in a transparent mode encryption and decryption done twice so it may yields result slow so I advised you to keep patience.

Steps are:

  1. iptables  -t nat -A PREROUTING -i eth0  -p tcp --dport 80 -j REDIRECT --to-port 3128

  2. iptables  -t nat -A PREROUTING  -i eth0 -p tcp --dport  443 -j REDIRECT --to-port 3130


Certificate and public key private key generation.

  1. openssl genrsa -des3 -out server. Key 1024

  2. openssl req -new –key -out server.csr

  3. openssl req -new -key server. Key -out server.csr


Steps to remove passphrase

  1. cp server. Key server. Key.old

  2. openssl rsa -in server. Key.org -out server. Key


Create server certificate

Openssl x509 -req -days 365 -in  server.csr -sign.key -out server.crt

Now make some changes to squid.conf file

  1. http_port 3128 transparent

  2. https_port 3130 transparent cert=/”path to server.crt” key=/”path to server.key”.


Another easy way to create certificates and public key private key pair is using genkey utility. In order to use that you have crypto-utils package install on your machine.

Steps are:

  1. #yum -y install crypto-utils

  2. genkey -days 365 squidserver.hostname.com

  3. Hit next.

  4. Select number of bits for data encryption. Default is 1024. This command will generate random bits.

  5. Generate the certificate.

  6. I will suggest you to never used passphrase for key, because if u assigns passphrase to key then along with public key we need to share passphrase.

  7. Certificate and key are stored at /etc/pki/tls/certs/ and /etc/pki/tls/private/

  8. In squid.conf make necessary change like this


http_port 3128 transparent

https_port 3130 transparent cert=/etc/pki/tls/certs/squidserver.hostname.com.crt key=/etc/pki/tls/private/squidserver.hostname.com.key.

In order to run it in a proper way the desired way that we want we also need to configure BIND DNS for local intranet along with forwarders ON and in forwarder we need to define ISP IP Address. At Client side must define both gateway and DNS (In my Env it is Proxy server.)

How to Stop WordPress Asking for FTP details to Upgrade Plugins


  1. First, we need to see what user Apache is running under. Type the following into a New file in any text editor. Save As whoami.php in the /var/www directory (or wherever you set Apache to serve files from):
    <?php echo(exec("whoami")); ?>


  2. Open this file in a browser (for instance, localhost/whoami.php). It should reveal who the user is

  3. This tells you that the web server is running under the user webuser.

    You can now give that user recursive ownership (all subfolders) of your WordPress installation using the command:

    chown -hR webuser:webuser /var/mydomain.com/public_html/wordpress/

Tuesday, October 1, 2013

pfSense: Editing /conf/config.xml file

The ISP's internet conenction runs on port expecting a 10MB Full-duplex device to be plugged into it. The WAN interface on our PFSense box is a 10/100 NIC, which when uplinked without making any configuration changes, I found that I was only getting about 25% of the capacity I was expecting. The only way to force the WAN interface to 10MB/Full-duplex is via the /conf/config.xml file. There are two way to edit this… one is using vi from SSH.

To enable SSH do this from the PFSense web-interface:
Click System>Advanced>Secure Shell, Enable Secure Shell

Even if you prefer to use the PFSense web-interface to edit your config.xml file (make a backup copy first), the shell came in handy a few times throughout my configuration process. The other option to edit the config file is using the editor in the PFSense web-interface.

The editor is available here:
Diagnostics>Edit File. The Load/Save path is “/conf/config.xml”.

Scroll down until you find the tag. Then remove the lines that start with <media/> and <mediaopt/> and replace them with ones that say this:

<media>10baseT/UTP</media>
<mediaopt>full-duplex</mediaopt>

Then click Save. You can check to see if this took effect by clicking Status, Interfaces. The WAN interface should now read “10baseT/UTP ”. This change should take effect immediately – if not, give the box a reboot (Diagnostics>Reboot System).

Configure IP Phone in Packet tracer

http://www.youtube.com/watch?v=6rQakFGMZRM