Archive for May, 2007

Postfix + ClamAV + MailScanner in OpenSuse 10.2

Friday, May 11th, 2007

1) Install the anti virus software (Clamav) –> (here) http://rpm.pbone.net/
rpm -ivh clamav-db-0.88.2-1.i386.rpm
rpm -ivh clamav-devel-0.88.2-1.i386.rpm
rpm -ivh clamav-server-0.88.2-1.i386.rpm
rpm -ivh clamav-0.88.2-1.i386.rpm

/etc/init.d/clamd start

2. Once the anti-virus is install then we need to install the MailScanner software the RPM along with the source files can be found at
http://www.sng.ecs.soton.ac.uk/mailscanner/downloads.shtml

Now get ready to install the mailscanner, this is going to take a long time.

gzip -d MailScanner-4.46.2-2.rpm.tar.gz
tar -xvf MailScanner-4.46.2-2.rpm.tar
cd MailScanner-4.46.2-2
./install.sh

3. In your MailScanner.conf file in /etc/MailScanner, there are 5 settings you need to change. The settings are:

Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = postfix

4. You will need to ensure that the user “postfix” can write to

/var/spool/MailScanner/incoming and /var/spool/MailScanner/quarantine

chown postfix:postfix /var/spool/MailScanner/incoming
chown postfix:postfix /var/spool/MailScanner/quarantine

5. Edit file MailScanner.conf
Virus Scanners = clamav

6. Edit virus.scanners.conf
clamav /usr/lib/MailScanner/clamav-wrapper /var/lib/clamav

7. Now we need to edit the postfix main.cf file, go all the way to the bottom of the file and add the following
header_checks = regexp:/etc/postfix/header_checks

8. In the file /etc/postfix/header_checks add this line:
/^Received:/ HOLD

9. Set the servers to run on startup and then start them

chkconfig MailScanner on
chkconfig postfix on
chkconfig clamd on

/etc/init.d/Mailscanner start
/etc/init.d/postfix start
/etc/init.d/clamd start

Enjoy

Ninad

Missing DNS zone ?

Thursday, May 10th, 2007

If you are facing issue related to missing DNS zone with cpanel update do the following:

/scripts/perlinstaller Compress::Raw::Zlib
/scripts/perlinstaller –force Scalar::Util

This should fix the issue.

Enjoy

Ninad

zlib installation

Thursday, May 10th, 2007

wget http://www.zlib.net/zlib-1.2.3.tar.gz
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
make install

Enjoy

Ninad

Unable to see the mailing lists option in cpanel ?

Wednesday, May 9th, 2007

Please make sure that you have enable mailman on the WHM > Server setup > Tweak setting.

Call a Web Service with ASP.Net Ajax without writing client-side scripts

Wednesday, May 9th, 2007

In my previous post I wrote about how we can simply call a Web Service with ASP.Net Ajax. In this post I will do the same but with ASP.Net Ajax script definition. With ASP.Net Ajax script definition markup we can use markup to hook up to controls events, invoke methods etc without writing any client-side script code.
Note: This post will use the same Web Service from the previous post.

When we want to use ASP.Net Ajax script we add the script to our code with a <script> element. The ASP.Net Ajax script is a markup language that uses simple XML. The root element for writing ASP.Net Ajax script is the <page>. Into the <page> element we add our components:

<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<components>
<textBox id="myTextBox" />
</components>
</page>
</script>
The code above declare TextBox with the id “myTextBox”. The id is the value of the id for a <input type=”text”> element that exists on our page. The code above do nothing at the moment, more than only initialize a TextBox object. The Web Service that we are going to call in this post has a method that takes on argument of type string:
[WebMethod]
public string MyMethod(string value)
{
return value;
}

Instead of writing client-side script to pass a value from a textbox into the Web Service method, we can use Atlas script to bind a control to the method’s argument. So when the Web Service method will be executed, the value of a textbox will be automatically past as an argument to our Web Service method. We can also make sure a control on the page will be updated with the return value of the Web Service method without writing client-side script. The following ASP.Net Ajax script will specify a Web Service method and bind a TextBox’s Text property to the Web Service method’s argument, value, and bind the return value of the Web Service to another binding, in this case to the “resultsBinding” that is the id of a binding for a label control:

<serviceMethod
id="myService"
url="MyWebService.asmx"
methodName="MyMethod">
<bindings>
<binding
dataContext="myTextBox"
dataPath="text"
property="parameters"
propertyKey="value" />
</bindings>
<completed>
<invokeMethod
target="resultsBinding"
method="evaluateIn" />
</completed>
</serviceMethod>

To specify a Web Service method, we use the <serviceMethod> element, we also give the method an id, the URL to the Web Service and the Web Service method we want to call. By using the element <bindings> and <binding>, we can bind a “component” another controls. In the code above we specify that we want to bind the “myTextBox” control’s Text property to the Web Service method’s parameter with the name “value”. So when we call our specified Service method, the value of the myTextBox’s Text property will be passed to the ‘value’ argument of the Web Service method. The <binding> element has different set of attributes to specify the binding. In this case we use “dataContext” that specify the id of the control that is the source, “dataPath” that is the name of the property of the specified “dataContext” that should be called to get a value from the “dataContext”. The “property” attributes species the member of the main component that should have the value from the “dataContext”. In this case the <serviceMethod> object’s Parameters. The last attribute we use is the “propertyKey”, we use this attribute to specify the name of the argument of the Web Service method, where the “dataContext” value should be passed to.

Note: The <serviceMethos>’s Parameters property will be called and add the value from the “dataContext” with the “propertyKey” as the key to help the object to know which argument of the Service method the value should be passed to.

To specify a method that should be executed when the Web Service is done, we use the <completed> element. By using the <invokeMethod> element, we specify a method that should be called when the Web Service is completed with the execution of its method. The <invokeMethod> element points to another binding, “resultsBinding”, which should be executed. The “resultsBinding” is added to a label control on the page, whoch task is to display the return value of the Web Service method:

<label id="results">
<bindings>
<binding
id="resultsBinding"
dataContext="myService"
dataPath="result"
property="text"
automatic="false" />
</bindings>
</label>

As you can see in the code above, we bind the Label control “results” to the Service Method. As you can see the “dataContext” for the Label control is the <serviceMethod> we specified earlier, “myService”. The “dataPath” is set to the result of the specified Service method. The result value is mapped to the “test” property of the label control. We also set the “automatic” attribute of the binding to false to make sure it will not automatically set the “text” property. Instead we make sure the binding is executed when the Web Service is completed with its execution. As you probably remember, it was done with the <invokeMethod> element added to the <comepleted> element of the <serviceMethod>.

No when we have bind the “myTextBox” value to the Web Service method’s argument and the result value from the Web service to a label, we also need to specify the our specified Service method should be execute from somewhere. We can do that by adding the <invokeMethod> element to a button control’s “click” event:

<button id="myButton">
<click>
<invokeMethod
target="myService"
method="invoke" />
</click>
</button>

The code above will invoke the ”myService” Service method when the click event of the button is pressed.

Here is the whole example:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">

<title></title>

<atlas:scriptmanager runat="server" id="scriptManager">
<services>
<atlas:servicereference path="~/MyWebService.asmx" />
</services>
</atlas:scriptmanager>
</head>

<body>
<form id="Form1" runat="server">
<div>
Enter value: <input id="myTextBox" type="text" /><br />
<input id="myButton" type="button" value="Execute" />
</div>
</form>

<label id="results"></label>

<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<components>

<textBox id="myTextBox" />

<serviceMethod
id="myService"
url="MyWebService.asmx"
methodName="MyMethod">
<bindings>
<binding
dataContext="myTextBox"
dataPath="text"
property="parameters"
propertyKey="value" />
</bindings>
<completed>
<invokeMethod
target="resultsBinding"
method="evaluateIn" />
</completed>
</serviceMethod>

<button id="myButton">
<click>
<invokeMethod
target="myService"
method="invoke" />
</click>
</button>

<label id="results">
<bindings>
<binding
id="resultsBinding"
dataContext="myService"
dataPath="result"
property="text"
automatic="false" />
</bindings>
</label>

</components>
</page>
</script>
</body>
</html>

By using the ASP.Net Ajax script markup we don’t need to learn how to code client-client-side script, such as Javascript, instead we learn how to write ASP.Net Ajax script in a markup language. Some client-side script can be difficult to write, we need for example learn how to call and use the DOM (document object model) and also how to write script that should work for different browsers etc. But by using the ASP.Net Ajax script markup we can now easy bound controls to each other and call methods etc without worry about writing client-side script that should be compatible with other browser etc.

Regards,
Sachin D.

Dictionary Attack

Wednesday, May 9th, 2007

To fight with Dictionary Attack ConfigServer Services has developed a good solution.

They have developed a dictionary attack ACL for the Exim mail server — with this not only the ongoing Dictionary attack is stoped but it also prevents further attempts by blocking spammer ip address. (The ACL has two main functions – the detection and the block.)

If you find emails like — anything@domainname.com [where anything == john , mark , chris almost any dictionary word..] that means you server is under dictionary attack.

You can find here the instructions for downloading and installing Dictionary Attack ACL

ThinkSupport has used this ACL on many exim servers and have found it as effective solution to stop Dictionary Attack.

Not able to view JSP pages

Wednesday, May 9th, 2007

If you are getting code instead of JSP page then you need to install servlets.

To install servlet go to the WHM >> Account Functions >> Install Servlets. Select domain and install.

After doing this you need to restart tomcat.

Now you will be able to view JSP pages.

Enjoy

Ninad

Nither suspend nor enable error email

Monday, May 7th, 2007

The cp_id: xxx for which you are receiving the mails from cron are not exist into your MB(seems to be deleted) but this cp_id i.e xxx is still remain into your MB database and hence you are receiving emails from cron.

Login to your phpMyAdmin and delete the logs which you want from the suspend_log file.

you will have to edit your database and run the following command on your ModernBill database:

DELETE FROM suspend_log WHERE suspend_id = xyz

MOdernBill : Please make sure you have set the following PHP variable into your PHP.ini file on the server.

Monday, May 7th, 2007

§ register_globals = On
§ register_argc_argv = On
§ open_basedir = no value
§ short_open_tag = On
§ safe_mode = Off
§ error_reporting = 2039
§ memory_limit = 32M

Please make sure you have to restart your web server after you modify the php.ini file.

Unable to login to my modernbill4

Monday, May 7th, 2007

Please make sure you have set the following PHP variable to ON into your PHP.ini file on server.

register_globals = ON   ON

Remember to restart your web server after you modify the php.ini file and try to login to your MB.