Friday, 24 September 2010

LogBot

Oh yeah today i tried setting bot  for the irc channel i use . This bot is to log the chats in the channel . Finally i used  http://www.jibble.org/logbot/ and it worked fine in my windows machine with default configuration tokens but when i tried it in Linux box which uses different Access control than my windows box , failed with the password incorrect error . Then i saw there was no token for password in the default config file. So i did some basic debugging by adding print statement in the code to understand the flow of the code using 'System.out.println' and found password was passed as null.But the irc server i tried to connect needs password ,so i added a token called password='password' and passed it to the connect method and it worked fine. Even in windows the password is passed as null but this worked, maybe in the server-side there might be a configuration which says password not required if the request is from particular network.  After this i had another problem the log file was displayed in the raw HTML format .Then i installed php in the Linux machine and configured Apache to load the php module because the Log bot application places the required php files in the log directory which processes the log file and displays it in a proper format.

LoadModule php5_module modules/libphp5.so

Also need to instruct apache to process the php files before sending it to client.

AddType application/x-httpd-php .php

Now the bot is running fine and logging the chats date-wise

But I want the logs to be only viewed by my team ,so i used the Apache to do this work for me using Apache's Authentication directive and configured LDAP authentication in it.

<Directory "/var/www/html">

AuthBasicProvider ldapAuthName "Enter password to access the logs ."

AuthType Basic

AuthzLDAPAuthoritative on

AuthLDAPurl "ldap://xxx.xxx.xxx.xxx:xxx/DC=xxx,DC=xxx,DC=xxx,DC=xxx?sAMAccountName?sub"

AuthLDAPBindDN cn=ldapauth1,ou=MiscAccounts,dc=xxx,dc=xxx,dc=xxx,dc=xxx

AuthLDAPBindPassword  password

AuthGroupFile /etc/httpd/conf/groups

Require group madhu_grp

</Directory>



cat /etc/httpd/conf/groups

madhu_grp: madhu mike michael

Only the members in madhu_grp can access the log by providing their valid LDAP credentials.

No comments:

Post a Comment