Steps to speed up Eclipse

November 8, 2011 · Posted in java, linux · Comment 

I found an interesting link which helped me to speed up the eclipse loading time. Let me know if that helped you.

Access AWS with Putty

July 22, 2011 · Posted in linux · Comment 

When accessing EC2 amazon cloud, you would receive a .pem file to login to the shell. Putty does not use .pem file and you would need to convert that file to .ppk file which putty uses. In order to convert it, you would need to download puttygen.exe from the website. Run the program and follow the following steps:

  1. Click “Conversions” on the menu and select “Import key”
  2. Browse to the .pem file
  3. Click “Save private key” button
  4. You would get a warning that you are saving the key without a passphrase. Please ignore it and click “Yes”
  5. Save the .ppk file

On putty:

  1. Select the session you created and click “Load”
  2. Open “SSH->Auth” from the tree on the left
  3. Under “Private key file for authentication” browse to the recently created .ppk file
  4. Save the session and you are ready

Integrate Apache 2 with Tomcat 6

January 18, 2010 · Posted in apache, general web, java, linux · Comment 

I have been trying to configure apache/tomcat is such a way that apache comes on the front-end so that I can have all the features of apache like URL rewriting, virtual hosts, PHP etc. and forward only certain requests to tomcat whose only job should be running servlets.

I have CentOS installed on my server with Apache 2 installed through yum and the goal was to install the binaries for Tomcat 6 and make them talk to each other. After some googling, the best tutorial I found to configure tomcat through mod_jk was found here. I have attached the PDF of the instructions here.
After following the steps, I was easily able to create a worker and configure apache to forward the request to /examples to tomcat.
The next issue was how to configure virtual hosts so that I can host multiple websites, some handled by apache and others through tomcat. Following is the snippet of httpd.conf setting that needs to be updated to enable virtual hosting.


NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
<VirtualHost *:80>

ServerAdmin webmaster@lalitmehta.com
ServerName www.lalitmehta.com
ErrorLog logs/lalitmehta.com-error_log
CustomLog logs/lalitmehta-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin info@saiyam.com
ServerName rsspile.com
#   No need of DocumentRoot
ErrorLog logs/rsspile.com-error_log
CustomLog logs/rsspile.com-access_log common
JkMount /rss ajp13
JkMount /rss/* ajp13
</VirtualHost>


I do have two questions though:
1. since mod_jk.so is available for download for Linux, what advantage you get by compiling Apache and mod_jk from source? Most of the websites mention the need to compile the source. Let me know :)
2. How do I enable SSL on my server with the above configuration?

Increase maximum limit of open files per user

January 15, 2010 · Posted in linux · Comment 

If you want to increase the limit of open files for the current session, simply run

ulimit -n 2048

If you want to increase it by default, edit /etc/security/limits.conf and add

*    hard     nofile     2048
*    soft     nofile     2048

or if you want to increase it only for a certain user, set it as

userlogin    hard     nofile     2048
userlogin    soft     nofile     2048

Force SSL on apache

July 10, 2009 · Posted in apache, linux · Comment 

mod rewrite should be enabled on apache. Add the following to your apache config file.

#########################################
#### XXX: BEGIN EDIT FOR MOD_REWRITE ####
#### This is intended to force HTTPS ####
#### for all inbound HTTP requests ####

####
# This module (mod_rewrite) simply tells Apache2 that all connections to
# port 80 need to go to port 443 – SSL – No exceptions
####


LoadModule rewrite_module modules/mod_rewrite.so


RewriteEngine on

####
# The line below sets the rewrite condition for mod_rewrite.so.
# That is, if the server port does not equal 443, then this condition is true
####

ReWriteCond %{SERVER_PORT} !^443$

####
# The line below is the rule, it states that if above condition is true,
# and the request can be any url, then redirect everything to https:// plus
# the original url that was requested.
####

RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

#### XXX: END EDIT FOR MOD_REWRITE ####

Linux Disable Hardware Beep Sound For Terminal

July 8, 2009 · Posted in linux · Comment 
  • If you are using xterm, open ~/.xsession file
    $ cd
    $ vi .xession
    Append the following line:
    xset b off
    Save and close the file.
  • If you are using bash shell, open ~/.inputrc file
    $ cd
    $ vi .inputrc
    Append following line:
    set bell-style none
    Save and close the file.
  • If you want to turn off beep for VIM text editor, open vim config file ~/.vimrc
    $ cd
    $ vi .vimrc
    Append following line
    set vb
    Save and close the file.

Remove .svn folders

July 8, 2009 · Posted in linux · Comment 

In order to clean up the SVN checkout, you can do

#deletes all .svn files/folders
find . -name ".svn" -exec rm -rf {} \;

OR

#deletes all .svn folders
find . -name ".svn" -type d -exec rm -rf {} \;

TOP 25 Most Dangerous Programming Errors

January 13, 2009 · Posted in general web, linux, Windoze · 2 Comments 
  1. CWE-20:Improper Input Validation
  2. CWE-116:Improper Encoding or Escaping of Output
  3. CWE-89:Failure to Preserve SQL Query Structure
  4. CWE-79:Failure to Preserve Web Page Structure
  5. CWE-78:Failure to Preserve OS Command Structure
  6. CWE-319:Cleartext Transmission of Sensitive Information
  7. CWE-352:Cross-Site Request Forgery
  8. CWE-362:Race Condition
  9. CWE-209:Error Message Information Leak
  10. CWE-119:Failure to Constrain Operations within the Bounds of a Memory Buffer
  11. CWE-642:External Control of Critical State Data
  12. CWE-73:External Control of File Name or Path
  13. CWE-426:Untrusted Search Path
  14. CWE-94:Failure to Control Generation of Code
  15. CWE-494:Download of Code Without Integrity Check
  16. CWE-404:Improper Resource Shutdown or Release
  17. CWE-665:Improper Initialization
  18. CWE-682:Incorrect Calculation
  19. CWE-285:Improper Access Control
  20. CWE-327:Use of a Broken or Risky Cryptographic Algorithm
  21. CWE-259:Hard-Coded Password
  22. CWE-732:Insecure Permission Assignment for Critical Resource
  23. CWE-330:Use of Insufficiently Random Values
  24. CWE-250:Execution with Unnecessary Privileges
  25. CWE-602:Client-Side Enforcement of Server-Side Security

Full story

oracle XE “cannot access http://127.0.0.1:8080/apex”

December 26, 2008 · Posted in linux, oracle · Comment 

I had installed oracle XE on CentOS and was not able to connect to web admin for past two days. Finally after a long two days of search, found this.

Thanks!

Delete all iptables rules

February 5, 2008 · Posted in linux · Comment 

Enter the following to delete iptables completely

# iptables -F
# iptables -t nat -F
# iptables -t mangle -F
# iptables -X

Next Page »

  • Calendar

    February 2012
    M T W T F S S
    « Jan    
     12345
    6789101112
    13141516171819
    20212223242526
    272829