Hello World
A “hello world” program has become the traditional first program that many people learn. Here’s i’ll show you how to print “Hello World” in A web page.
Using HTML
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML> <HEAD> <TITLE> Hello World </TITLE> </HEAD> <BODY> <P>hello world</P> </BODY> </HTML>
Postfix smtp outgoing load balancing
I got good workaround for balancing smtp outgoing from postfix mailing list archives(not using expensive real load balancer). suppose we have 4 smtp servers for outgoing email, and we need to configure/load balance like this:
+------------+
| |
+----------> smtp backend a -------->| |
| | |
clients --------> smtp lb -----> smtp backend b -------->| Intenet |
| | |
+----------> smtp backend c -------->| |
| |
+------------+
Here’s the configuration :
Sumatera shaken by earthquake
gethostbyname() vs getaddrinfo()
In IPv4 environment(usually) we used to call function gethostbyname() to do DNS lookups.then the information is load into a struct hostent.
#include <netdb.h> struct hostent *gethostbyname(const char *name); struct hostent { char *h_name; /* official name of host */ char **h_aliases; /* alias list */ int h_addrtype; /* host address type */ int h_length; /* length of address */ char **h_addr_list; /* list of addresses from name server */ }; #define h_addr h_addr_list[0] /* address, for backward compatibility */
So, the easiest way to get information from gethostbyname() call is by extracting hostent structure.
Using VIM as stream editor
vmware ESXi 4 + centos 5.3 guest OS + zimbra
I’ve been playing around with Zimbra opensource edition on my development server. Zimbra is a full-featured, open source collaboration suite forĀ email, group calendaring, contacts, and web document management and authoring. web interface is equipped with AJAX and it is compatible with clients such as Outlook, Apple Mail, and Novell Evolution so that mail, contacts, and calendar items can be synchronised from these to the ZCS server. It also can be synchronized to many mobile devices. ZCS makes use of many existing open source projects such as Postfix, MySQL, and OpenLDAP.
In this experiment i was using Zimbra 64bit_x86 opensource edition
DNs setting
mail.domain.tld. A 192.168.1.2 domain.tld. MX 10 mail.domain.tld.
Download the installer
# wget http://h.yimg.com/lo/downloads/6.0.1_GA/zcs-6.0.1_GA_1816.RHEL5_64.20090911174852.tgz
Extract the installer tarball, make sure we have enough space.
# tar xvzf 6.0.1_GA/zcs-6.0.1_GA_1816.RHEL5_64.20090911174852.tgz # cd zcs-6.0.1_GA_1816.RHEL5_64.20090911174852
Querying Visitor IP address
There are many ways, scripting/language to obtain remote IP address of the user who is browsing our website.
PERL
#!/usr/bin/perl use CGI; print "Content-type: text/plain; charset=iso-8859-1\n\n"; my $q = new CGI; print "<b>Your Remote IP Address :" . $q->remote_host() . "</b>";
PHP
<?php echo "<b>Your Remote IP Address :" . $_SERVER['REMOTE_ADDR'] . "</b>"; ?>
Setup Google Apps For your Personal eMail
I was realy surprised on how easy it was to set up hosting using google apps. Fisrt of all, all we need is just go here and fill out the application.
if you’re using it for family, private user or non-profit organisation google apps is freely to use. Of course we can Upgrade to Google Apps Premier Edition for bigger storage at 25 GB per user.
The first step of the application is to enter your domain name, if you already have one. Or you can buy a new domain name through Google which automatically sets everything up for you.
Securing MySQL traffic with stunnel
To encrypt a connection between a mysql client and a mysql server, run two instances of stunnel, one on client site and other on MySQL remote site
Here’s steps how to do it
# wget http://www.stunnel.org/download/stunnel/src/stunnel-4.27.tar.gz # rpmbuild -ta stunnel-4.27.tar.gz # rpm -ivh /usr/src/redhat/RPMS/stunnel-4.27-1.i386.rpm
Create stunnel.pem cert on server site
# openssl genrsa -out privkey.pem 2048 # openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095 # cat privkey.pem cacert.pem >> /etc/stunnel/stunnel.pem
Set the proper permissions on the resulting private key:
# chmod 0400 /etc/stunnel/stunnel.pem
Set the proper ownership of the stunnel chroot dir
# chown nobody:nobody /var/run/stunnel