Tuesday, May 26, 2015

Permission denied, please try again on AIX7 WPAR

Created a new WPAR like this:

mkwpar -A -s -l -n aix7-a
chfs -a size=5G /wpars/aix7-a/home
chfs -a size=20G /wpars/aix7-a/opt
chfs -a size=5G /wpars/aix7-a/tmp
chwpar -N address=172.16.80.36 netmask=255.255.0.0  interface=en0 aix7-a

Tried to login after the WPAR was booted using SSH

bash-4.2# ssh 172.16.80.36
root@172.16.80.36's password:
Permission denied, please try again.
root@172.16.80.36's password:

This happens because the newly created WPAR's root doesn't have a password or maybe it just resets it.
Here's what you do


clogin aix7-a

bash-4.2# passwd root
Changing password for "root"
root's New password:
Enter the new password again:


Now ssh to the WPAR should work.

Monday, May 4, 2015

Testing X-Forwarded-For on HAProxy.

1) Configure your front-end server in HAProxy and enable X-Forwarded-For

frontend virtual_cluster_server
   mode http
   bind 10.156.209.110:80 transparent
   option httplog clf
   log global
   option forwardfor

2) Configure your httpd.conf in Apache Server to log the "X-forwarded-host" header. Ensure you have lines like this:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{X-Forwarded-For}i\" \"%{User-Agent}i\"" combined

customLog logs/access_log combined

Note:
1) For sake of simplicity, I have changed the "combined" format for access_log.
2) You could do something similar for individual virtual hosts, inside the definitions.

3) Access your haproxy URL and you'd see a line logged like below for your client-IP

172.16.10.2 - - [04/May/2015:06:37:42 -0400] "GET /api/service.php HTTP/1.1" 200 6 "-" "10.112.202.162" "curl/7.37.1"

You can see that it has displayed the value of X-Forwarded-For in the logs which happens to be my client IP.