Encrypting shell scripts
Sun, 01/16/2005 - 11:27 — himanshuDo you have scripts that contain sensitive information like passwords and you pretty much depend on file permissions to keep it secure? If so, then that type of security is good provided you keep your system secure and some user doesn't have a "ps -ef" loop running in an attempt to capture that sensitive info (though some applications mask passwords in "ps" output). There is a program called "shc" that can be used to add an extra layer of security to those shell scripts. SHC will encrypt shell scripts using RC4 and make an executable binary out of the shell script and run it as a normal shell script. This utility is great for programs that require a password to either encrypt, decrypt, or require a password that can be passed to a command line argument.
- himanshu's blog
- Login or register to post comments
- Read more
Redirect browser to use SSL
Fri, 04/30/2004 - 23:59 — sandipYou can redirect browser to use SSL secure port using .htaccess file with Rewrite Rules.
Create a .htaccess file with the below Rewrite rule.
Options +FollowSymLinks RewriteEngine On RewriteCond %{SERVER_PORT} !=443 RewriteRule ^ https://secure.yourdomain.com%{REQUEST_URI} [NS,R,L]
Perl Compatible Regular Expressions Manual
Tue, 04/13/2004 - 11:44 — sandipPCRE was originally written for the Exim MTA, but is now used by many high-profile open source projects, including Python, Apache, PHP, KDE, Postfix, Analog, and nmap. Other interesting projects using PCRE include Ferite, Onyx, Hypermail, and Askemos.
Paypal Shopping Cart
Thu, 01/22/2004 - 08:16 — sandipPaypal Shopping Cart - Paypal Shopping Cart is designed to accept PayPal payments. It supports multiple categories and products, custom total price calculation, discount pricing, image upload, HTML order page generator, and instant payment notification.
- sandip's blog
- Login or register to post comments
.htaccess, a primer...
Thu, 09/04/2003 - 10:48 — sandipThe Apache web server has a number of configuration options that are available to the server administrator. In a shared hosting environment, you don't have access to the main Apache configuration so you're stuck with the default configuration. However, it is possible to override some of the default settings by creating (or editing) a file named ".htaccess".
The .htaccess is a simple ASCII text file placed in your www directory or in a subdirectory of your www directory. You can create or edit this file in any text editor (such as NotePad) and then upload it to the directory for which you want to modify the settings. Be sure that the file is uploaded in ASCII (not BINARY) format, and be sure that the file permissions for the file are set to 644 (rw-r--r--). This allows the server to access the file, but prevents visitors from accessing the file through their web browser (a security risk.)
Commands in the .htaccess file affect the directory that it's placed in and all subdirectories. If you place the .htaccess file in your www directory, it will affect your entire web site. If you place it in a subdirectory of your www directory, it will affect only that directory plus and subdirectories of that directory.
Most .htaccess commands are designed to be placed on one line. If your text editor wraps lines automatically, you should disable that function before saving and uploading your file. Also, note that .htaccess commands are case-sensitive.
The information presented here may work and it may not, or it may work today and not tomorrow. Use it at your own risk.
Some of the things you can do with .htaccess include:
Customize Error Messages
If you want to override the server's error pages, you can use .htaccess to define your own messages. An example of the syntax is:
ErrorDocument 500 /error.html
Override SSI Settings
By default, only pages ending in the .shtml extension will parse server-side includes (SSI). You can override this restriction in your .htaccess file:
If you want to override the default server configuration so that SSI will work with .html documents, you can create a file named .htaccess and upload it (in ASCII mode) to your main www directory. Add the following lines to your .htaccess file:
AddType text/html .html AddHandler server-parsed .html
If you want both .html and .htm documents to parse SSI, create your .htaccess file with these lines:
AddType text/html .html AddHandler server-parsed .html AddHandler server-parsed .htm
Change Your Default Home Page
In order to browse your site by specifying the domain name only (e.g., http://www.yourdomain.com) instead of having to specify an exact page filename (e.g., http://www.yourdomain.com/file
There is also a default order of precedence for these names. So if you have both a file named index.cgi and a file named index.html in your directory, the server will display index.cgi because that name takes a higher precedence than index.html.
Using .htaccess, you can define additional index filenames and/or change the order of precedence. To define your index page as custom.html add the following line to your .htaccess file:
DirectoryIndex custom.html
This will cause the server to look for a file named custom.html. If it finds that file, it will display it. If it does not find that file, it will return a 404 Missing Page error.
To change the order of precedence, enter a DirectoryIndex command with multiple file names on the same line. The order in which the file names are listed (from left to right) determines the order of precedence. For example,
DirectoryIndex custom.html index.cgi index.php index.html
Enable Directory Browsing
This is the option that allows the contents of a directory to be displayed in the browser when the directory does not contain an index page.
For example, if you make an http call to a directory such as http://yourdomain.com/images/,
If you require this option on specific directories it is still available. You can reactivate it by adding the following line to your .htaccess file:
Options +Indexes
Once this is added, the directory will fully index again. (Note: Coversely "Options -Indexes" will prevent directory browsing.)
Preventing Directory Listing
Do you have a directory full of images or zips that you do not want people to be able to browse through? Typically a server is setup to prevent directory listing, but sometimes they are not. If not, become self-sufficient and fix it yourself:
- sandip's blog
- Login or register to post comments
- Read more