April 27, 2009

HTTP Status Codes

"

  • 100 Continue

  • 101 Switching Protocols

  • 102 Processing

  • 200 OK

  • 201 Created

  • 202 Accepted

  • 203 Non-Authoritative Information

  • 204 No Content

  • 205 Reset Content

  • 206 Partial Content

  • 207 Multi-Status

  • 226 IM Used

  • 300 Multiple Choices

  • 301 Moved Permanently

  • 302 Found

  • 303 See Other

  • 304 Not Modified

  • 305 Use Proxy

  • 306 (Unused)

  • 307 Temporary Redirect

  • 400 Bad Request

  • 401 Unauthorized

  • 402 Payment Required

  • 403 Forbidden

  • 404 Not Found

  • 405 Method Not Allowed

  • 406 Not Acceptable

  • 407 Proxy Authentication Required

  • 408 Request Timeout

  • 409 Conflict

  • 410 Gone

  • 411 Length Required

  • 412 Precondition Failed

  • 413 Request Entity Too Large

  • 414 Request-URI Too Long

  • 415 Unsupported Media Type

  • 416 Requested Range Not Satisfiable

  • 417 Expectation Failed

  • 418 I'm a teapot

  • 422 Unprocessable Entity

  • 423 Locked

  • 424 Failed Dependency

  • 425 (Unordered Collection)

  • 426 Upgrade Required

  • 500 Internal Server Error

  • 501 Not Implemented

  • 502 Bad Gateway

  • 503 Service Unavailable

  • 504 Gateway Timeout

  • 505 HTTP Version Not Supported

  • 506 Variant Also Negotiates

  • 507 Insufficient Storage

  • 510 Not Extended


see also : RFC2616 HTTP/1.1, RFC2324 HTCPCP/1.0

" status-code.com

April 23, 2009

WirelessKeyView - Recover lost wireless network key

"WirelessKeyView recovers all wireless network keys/passwords (WEP/WPA) stored in your computer by the 'Wireless Zero Configuration' service of Windows XP and by the 'WLAN AutoConfig' service of Windows Vista. It allows you to easily save all keys to text/html/xml file, or copy a single key to the clipboard.

" nirsoft.net

April 22, 2009

Vi: Undo

"u | Undo the latest change. U | Undo all changes on a line, while not having | moved off it (unfortunately). :q! | Quit vi without writing. :e! | Re-edit a messed-up file." unix.t-a-y-l-o-r.com

April 20, 2009

XUL: XUL Explorer

"XUL Explorer is a XULRunner application that provides an easy way to experiment with XUL. It’s a simple editor that can preview XUL inline or in a separate popup window. It has a list of code snippets (small fragments of XUL or JavaScript) that can be quickly inserted into the editor. The XUL can be loaded from and saved to files. A XUL validator and the Error Console are both available to help debug problems. The help menu provides access to XUL information on MDC. There is even simple “keyword” help lookup for XUL elements. " developer.mozilla.org

XUL: Passing arguments and displaying a dialog

"The following code demonstrates how to pass custom arguments to a dialog, process those arguments in the dialog, and return user-modified arguments to the caller. The code to open a dialog named mydialog.xul and pass it arguments:

var params = {inn:{name:"foo", description:"bar", enabled:true}, out:null};
window.openDialog("chrome://myext/content/mydialog.xul", "",
"chrome, dialog, modal, resizable=yes", params).focus();
if (params.out) {
// User clicked ok. Process changed arguments; e.g. write them to disk or whatever
}
else {
// User clicked cancel. Typically, nothing is done here.
}

mydialog.xul:














mydialog.js:

// Called once when the dialog displays
function onLoad() {
// Use the arguments passed to us by the caller
document.getElementById("name").value = window.arguments[0].inn.name;
document.getElementById("description").value = window.arguments[0].inn.description;
document.getElementById("enabled").checked = window.arguments[0].inn.enabled;
}

// Called once if and only if the user clicks OK
function onOK() {
// Return the changed arguments.
// Notice if user clicks cancel, window.arguments[0].out remains null
// because this function is never called
window.arguments[0].out = {name:document.getElementById("name").value,
description:document.getElementById("description").value,
enabled:document.getElementById("enabled").checked};
return true;
}
" developer.mozilla.org

April 14, 2009

Open Source Keystroke Launcher

"Launchy is a free windows and linux utility designed to help you forget about your start menu, the icons on your desktop, and even your file manager.

Launchy indexes the programs in your start menu and can launch your documents, project files, folders, and bookmarks with just a few keystrokes!" launchy.net

April 5, 2009

Apache virtual hosts quick and easy

"Step 1: Creating the index pages

Like already mentioned before, we have to create subdirectory and page index files first. Suse normaly stores the web pages in the following directory:

/srv/www/htdocs

We will use the same directory but will create a subdirectory for every virtual host.

mkdir /srv/www/htdocs/server_port80
mkdir /srv/www/htdocs/server_port8090
mkdir /srv/www/htdocs/server_www
mkdir /srv/www/htdocs/server_www1

You can later store you content in this directories. Let’s just create a single file called index.html that contains a message about the type of the server. An example file could look like this:










This is my webserver working on
Port 80.
Linux-Tip.net





Please change the content to your needs and save a modified index file in every subdirectory.

Step 2: Setup IP based virtual host

Suse stores the vhost configuration files in the following directory:

/etc/apache2/vhosts.d

During the start-up process, Apache will automatically use all files located in this directory for the final configuration.

You can easily create new vhost configuration files by using the template like this:

cd /etc/apache2/vhosts.d/
cp vhost.template vhost-port80.conf

This will copy the default template and will create a configuration file that we will later use for our IP-based virtual host running on port 80. I recommend using vi to edit the file. Please open it like this:

vi vhost-port80.conf

As you can see, the file has everything you need to setup a virtual host, but also includes a lot of explanations and comments. To get a slim file please delete it.

Here are the lines you should change for your Apache configuration:


VirtualHost – set IP address and port here
ServerAdmin - your webmaster’s email adress
DocumentRoot – path to your web page contend (see step1)
ErrorLog - path to the error log file
CustomLog - path to the access log file
UseCanonicalName - leave it to off in this case
ScriptAlias – if you like to run cgi scripts on your web page, this is the location.

The file could look like this:




ServerAdmin webmaster@myserver.comThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it
ServerName server.myserver.com
DocumentRoot /srv/www/htdocs/server_port80
ErrorLog /var/log/apache2/server_port80.log
CustomLog /var/log/apache2/access_port80.log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
ScriptAlias /cgi-bin/ "/srv/www/htdocs/server_port80/cgi-bin/"

AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all


Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all




If you like to run you web page on a different port, please use the following configuration file:


ServerAdmin webmaster@myserver.comThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it
ServerName server.myserver.com
DocumentRoot /srv/www/htdocs/server_port8090
ErrorLog /var/log/apache2/server_port8090.log
CustomLog /var/log/apache2/access_port8090.log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
ScriptAlias /cgi-bin/ "/srv/www/htdocs/server_port8090/cgi-bin/"

AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all


Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all



A web server normally listens on port 80. If you like to change this or to add port 8090, you have to hack the listen.conf file. Please see step 4 for more information.



Step 3: Setup a name-based virtual host

Create a new file using the default template similar to step2:

cd /etc/apache2/vhosts.d
cp vhost.template vhost-www.conf

Here are the important hacks you have to make:
ServerName – use name you would like to see in the URL
UseCanonicalName On

Remark:
With UseCanonicalName on Apache will use the ServerName and Port directives to construct the canonical name for the server. This name is used in
all self-referential URLs, and for the values of SERVER_NAME and SERVER_PORT in CGIs.

If you have more IP addresses for your server or if you like to use different ports, please change the following line:


VirtualHost 192.168.33.101:80

The file could look like this:




ServerAdmin webmaster@myserver.comThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it
ServerName www.myserver.com
DocumentRoot /srv/www/htdocs/server_www
ErrorLog /var/log/apache2/server_www.log
CustomLog /var/log/apache2/access_www.log combined
HostnameLookups Off
UseCanonicalName On
ServerSignature On
ScriptAlias /cgi-bin/ "/srv/www/htdocs/server_www/cgi-bin/"

AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all


Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all





Step 4: Hack the listen.conf file

The following file allows you to bind Apache to specific IP addresses and/or ports.

Please change the following lines here:

Listen - add the port or ports on which you would like to run you web pages
NameVirtualHost - this directive tells Apache on which IP address and, optionally, which port to listen for requests by clients containing the domain name in the HTTP header. The first argument can be a fully qualified domain name, but it is recommended to use the IP address. The second argument is the port and is optional. By default, port 80 is used and is configured via the Listen directive.

The file could look like this:

Listen 80
Listen 8090



Listen 443



NameVirtualHost 192.168.33.101:80


To trouble shot you configuration, you should run the following command from the linux console:

tail –f /var/log/messages

Please do not forget the restart Apache after changing the configuration using the following commands (watch for errors):

service apache2 restart

or

/etc/init.d/apache2 restart" linux-tip.net

April 2, 2009

Nagios - A Extensible Host and Service Monitoring

"7. Apache Security Preparation

Nagios has by default the authentication for the web interface activated.

That means after Nagios has been started and you try to access the web interface a login windows appears. Nagios has already a default user defined in the contacts.cfg (user: nagiosadmin) so we just have to create a apache password file where we store the password for it.

Do this with the following command and set the password to nagios:

# htpasswd2 -c /opt/nagios/etc/htpasswd.users nagiosadmin
Password: nagios

NOTE: LDAP can also be used for user authentication and requires just a view changes to the apache configuration. But the users still have to be defined in the contacts.cfg. LDAP is used just for verifying the password. I will cover this later.

NOTE: If you do not like to define every user in the contacts.cfg and security is not the case for you, you can modify the cgi.cfg and change all "authorized_for..." parameters to "authorized_for...=*". That will give all user that authenticate to the web server (or LDAP) all permissions even they do not exist in the contacts.cfg. After ny modification to the cgi.cfg restart Nagios.
8. Apache and Nagios Startup

So now all configurations are done and we can startup the applications.

During the Nagios installation an apache config file (nagios.conf) was placed in /etc/apache2/conf.d. So we first have to restart apache to activate that configuration.

# rcapache2 restart

After that we can start Nagios for the first time. In earlier version it was always a very good idea to do a configuration verify before restarting. Otherwise Nagios could be interrupted if there were errors in. In this new version now Nagios does this automatically when it is started or reloaded. If configuration errors were found the restart / reload operation is aborted and you get a information where the error is. Correct it and retry the operation.

As we use the default configuration and we made no mistakes Nagios should start up:

# /etc/init.d/nagios start

If you would like, add Nagios for automatic startup at system boot time:

# insserv nagios

9. Nagios Test

Now Nagios should be available at the following URL: http:///nagios

As you do have the authentication settings modified you should get an authentication window where you have to enter the user nagiosadmin with password nagios." novell.com