Archive for August, 2007

632 Part V . Running Servers If you

Friday, August 31st, 2007

632 Part V . Running Servers If you want to have Fetchmail run in the background, you can use the –daemon (or -d) flags with a parameter telling it how often (in seconds) to poll the servers: $ fetchmail –daemon 300 To have Fetchmail automatically start when the system boots, add this to your crontab file: @reboot /usr/bin/fetchmail –daemon 300 Fetchmail cannot prompt for passwords when run in this manner, which means that you must store the passwords in .fetchmailrc for this to work. If you haven t configured a crontab file before, setting it up can be as easy as performing the following steps: $ cat > mycron @reboot /usr/bin/fetchmail –daemon 300 (hit Ctrl-D here) $ crontab mycron Configuring Web-Based Mail If you re running an IMAP server, you can offer Web-based access by installing IMP (http://horde.org/imp/, also in the imp3 package) or SquirrelMail (http:// squirrelmail.org/, also found in the squirrelmail package). Start by configuring your system as a LAMP server (Chapter 23), and then install and configure the appropriate package. IMP is considerably more complex to configure than SquirrelMail and may be more difficult to install. If you aren t sure which one is right for you, try the online demos for both and see which one you like best. Securing Communications with SSL/TLS Because communication between mail clients and the server often contains sensitive information such as passwords, it is usually desirable to enable SSL/TLS encryption. Here s how to enable SSL/TLS in Postfix and Courier-IMAP: 1. SSL/TLS for Postfix and Courier-IMAP are provided in the postfix-tls and courier-imap-tls packages, respectively. Use APT to install them: # apt-get install postfix-tls courier-imap-ssl 2. Third-party CA certificates are provided in the ca-certificates package. This will be referenced in the configuration, so install it too: # apt-get install ca-certificates Note Note
If you are in need for chaep and reliable webhost to host your website, our recommendation is http web server services.

Chapter 24 . Running a Mail Server 631 (Michigan web site)

Thursday, August 30th, 2007

Chapter 24 . Running a Mail Server 631 Any errors relating to clamav-milter and spamass-milter not running will be in the mail.log file and will look something like this: […] Milter (clamav): to error state Configuring Mail Clients Any mail client with support for the appropriate protocol for your configuration (POP3 for the first configuration, IMAP for the second) should be able to access mail from your server. Just use the name of your server in the mail server settings, and follow the troubleshooting steps in the previous section if something doesn t work. You can find more information about mail clients for Linux in Chapter 21. Configuring Fetchmail Fetchmail is an MRA (Mail Retrieval Agent) that you can use to pull mail from a remote account to your new server. It is configured in the $HOME/.fetchmailrc file, and is very easy to set up. To pull mail to your server, log in as the user that the mail should go, then configure and run it from there. Run Fetchmail as the user for whom the mail is being retrieved. You should never run it as root. If you re doing a complex setup in which you retrieve mail from a single mailbox that needs to be sorted out for multiple users, see the fetchmail man page for information about multidrop mailboxes. A .fetchmailrc file can be as simple as this: poll mailserver.yourisp.example protocol pop3 username foo If you have more than one mail server, you can add it as an additional line. If the server from which you are pulling mail supports IMAP, you can use imap instead of pop3. Other options that you can have are password=your password> and ssl. Storing the password in the file enables you to run Fetchmail without entering a password, and the ssl option tells Fetchmail to use an SSL/TLS connection to the server. Your .fetchmailrc file should not be readable by others, and Fetchmail will generally complain if it is. To set the permissions so that only you can read it, run chmod 0600 $HOME/.fetchmailrc/. Running Fetchmail is as simple as typing $ fetchmail Note Note Cross- Reference
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.

630 Part V . Running Servers 9. Signal (Web site layout)

Wednesday, August 29th, 2007

630 Part V . Running Servers 9. Signal Postfix to reload its configuration so that it starts using maildrop instead of its own built-in MDA: # invoke-rc.d postfix reload 10. Install the Courier-IMAP daemon: # apt-get install courier-imap If you want to allow POP3 access, you can also install the courier-pop package at this step. Keep in mind, however, that POP3 clients will be unable to access the Trash folders under their accounts. 11. Debconf asks whether you want to create directories for Web-based administration. This interface has limited features, so I recommend that you not enable it. You now have a fully functioning mail server that you can access from any standard mail client. Testing and Troubleshooting The best way to test your mail system is to try sending a message to your new address. Messages can be sent using your mail client or from the command line using the mail program. Messages with attachments can be sent from the command line using mpack. To verify that your virus scanner is scanning messages properly, try sending yourself a test file. Test files containing fake viruses that should be detected by ClamAV can be found in the clamav-testfiles package. Use mpack to send one of the files, such as test.zip, in /usr/share/clamav-testfiles/ to an address on your server and verify that it was handled properly: # mpack -s test message /usr/share/clamav-testfiles/test.zip e-mail address of recipient The mpack program is part of the mpack package, which may not be installed by default. You can use apt-get to install it very easily. To test SpamAssassin, try sending yourself a message that looks a lot like spam. Usually, a message containing a lot of capital letters and ! and $ symbols will receive a high spam score from SpamAssassin. If something is not working properly, you should first check the mail logs in /var/ log/mail.log. If you don t recognize an error message that you find in there, try doing a Web search. More often than not, you ll find a solution within a few search hits. You should also check that all of the daemons are running. Both configurations require that spamd be running in the background. The sendmail configuration also requires that clamd, clamav-milter, and spamass-milter be running normally. Note Note
If you are in need for chaep and reliable webhost to host your website, our recommendation is http web server services.

Make a web site - Chapter 24 . Running a Mail Server 629

Tuesday, August 28th, 2007

Chapter 24 . Running a Mail Server 629 6. Configure maildrop to filter messages through SpamAssassin and ClamAV by changing your /etc/maildroprc file to look like this: # Global maildrop filter file DEFAULT= $HOME/Maildir if ( $SIZE < 60000 ) { xfilter /usr/bin/spamc -f } xfilter /usr/local/sbin/clam-mailscan if (/^X-Spam-Flag: YES/ || /^X-Virus-Alert:/ ) { exception { to $DEFAULT/.Trash/ } } The line starting with DEFAULT tells maildrop which location messages should be stored to. This causes maildrop to save the messages to a directory named Maildir under the recipient s home directory (which is automatically substituted for the $HOME variable by maildrop). The IMAP server is expecting to find messages in this directory. The first if block filters messages that are less than 60,000 bytes through spamc, and the line after that runs the message through the clam-mailscan program. The final if block checks for the presence of X-Spam-Flag and X-Virus-Alert headers. If either of these headers are found, maildrop attempts to deliver the message to a Trash folder located under the default folder. By enclosing this step within an exception block, maildrop is instructed to take the default action instead of aborting delivery in the event that this step fails. This allows you to safely prevent mail sorting for an individual account by simply removing its Trash folder. You can find more information about the features and syntax of the /etc/mail droprc file by running man maildropfilter and man maildropex. 7. Create Maildir mail directories for every user already on the system. This step needs to be performed for every user that is already on the system and needs to be run as the user because executing it as root results in maildrop being unable to write to the new directories: $ maildirmake.maildrop $HOME/Maildir $ maildirmake.maildrop -f Trash $HOME/Maildir 8. Create mail directories under /etc/skel. The contents of /etc/skel will be copied to the home directories of any new accounts: # maildirmake.maildrop /etc/skel/Maildir # maildirmake.maildrop -f Trash /etc/skel/Maildir Note
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

Abyss web server - 628 Part V . Running Servers tmpfn =

Monday, August 27th, 2007

628 Part V . Running Servers tmpfn = mktemp() tmpfh = open(tmpfn, w+b ) while True: rbuf = stdin.read(1024) if rbuf == : break tmpfh.write(rbuf) tmpfh.close() vscan = popen( %s –no-summary –stdout –infected –mbox %s % (CLAMSCAN, tmpfn), r ) while True: rbuf = vscan.readline() if rbuf == : break if rbuf.find( FOUND ): errors.append(rbuf[rbuf.find( : )+2:-1]) vscan.close() tmpfh = open(tmpfn, r ) if len(errors) > 0: while True: rbuf = tmpfh.readline() if rbuf == n : break stdout.write(rbuf) for e in errors: stdout.write( X-Virus-Alert: %s in messagen % e) stdout.write( n ) while True: rbuf = tmpfh.read(1024) if rbuf == : break stdout.write(rbuf) tmpfh.close() unlink(tmpfn) When called from maildrop to process a message, this program will save the message to a temporary file that it scans using clamscan (which is part of the ClamAV package). It then processes the output from clamscan to determine whether any viruses were found. Finally, it passes the message back to maildrop, including a X-Virus-Alert header (as appropriate), and removes the temporary file. 5. Set the permissions on clam-mailscan so that it can be executed by any user: # chmod 0755 /usr/local/sbin/clam-mailscan
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

Chapter 24 . Running a Mail Server 627 (Submit web site)

Sunday, August 26th, 2007

Chapter 24 . Running a Mail Server 627 2. Debconf asks several questions about how to configure Postfix: Select Internet Site as the configuration type, unless you have to send outgoing mail through a specific server, in which case you should select Internet With Smarthost. Direct all mail to the appropriate account on your system. Generally this is the account that you created while installing Debian. Enter the name of the primary domain for which you will be accepting mail. Answer no to the question about adding your domain to simple addresses. If you selected the smarthost option, enter the name of that server when prompted. Enter the entire list of hosts for which you plan to accept mail. This is generally your main domain, localhost, and localhost.localdomain. Do not force synchronous writes for mail unless you expect your server to have frequent unexpected reboots and are ready to take the performance decrease. 3. Configure Postfix to use maildrop as its local MDA by editing the mailbox_ command line in /etc/postfix/main.cf: mailbox_command = /usr/bin/maildrop -d ${USER} If you will be relaying mail for any clients, add their IP addresses to the mynetworks line. 4. The only filter mechanism supported by maildrop requires that the external filter program read the original message on its input and then write the entire message to its output. ClamAV does not include this feature, so an intermediate program will be needed to perform some of the filtering steps. Create a file named /usr/local/sbin/clam-mailscan that contains the following: By the time this book goes to press, this script should be available online at http: //www.tuckerlabs.com/wayne/projects/clam-mailscan/. #!/usr/bin/env python from sys import stdin, stdout from os import execv, popen, umask, unlink from tempfile import mktemp CLAMSCAN= /usr/bin/clamscan umask(0077) errors = [] Note
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

626 Part V . Running Servers 11. Install

Saturday, August 25th, 2007

626 Part V . Running Servers 11. Install and start Qpopper if you want to provide POP3 access: # apt-get install qpopper If desired, you can also enable IMAP support by installing uw-imapd package. 12. If any client machines are going to be relaying messages through your server, add their IP addresses to /etc/mail/access and run make in the /etc/mail directory to update the database. This change does not require that you reload the sendmail configuration. The default /etc/mail/access file contains REJECT settings for a number of IP address blocks. These addresses are not assigned to any networks right now but are sometimes abused by spammers. From time to time, one of these address blocks is assigned to a regional IP address registry and then further divided among networks. When this happens, your server will continue to reject mail from those addresses. You can find a list of these networks at http://cymru.com/Bogons/ index.html. If you don t have time to check the list regularly for removals, then you may want to remove the entries now. You now have a fully functioning mail server that you can access from any standard mail client. Installing and Running Postfix Postfix (http://postfix.org/) was created by Wietse Venema as a replacement for sendmail. It was designed to be fast, easy to administer, and secure. It was also designed to behave similarly enough to sendmail that existing users would be able to switch without needing to make any major changes to other programs. Maildrop (http://flounder.net/~mrsam/maildrop/) is the local MDA for the Courier mail system and is also available as a standalone package. It can be configured to sort messages based on rules that are specified on a system-wide or per-user level and is used in this example configuration to run messages through SpamAssassin and ClamAV and then move them to a Trash folder if either filter identifies them as undesirable. Courier-IMAP (http://courier-mta.org/imap/), like maildrop, is a part of the Courier mail system and is also available as a separate package. Follow these steps to install and configure the needed software: 1. Install the Postfix and maildrop packages: # apt-get install postfix postfix-doc maildrop Caution Note
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

Chapter 24 . Running a Mail Server 625 (Abyss web server)

Friday, August 24th, 2007

Chapter 24 . Running a Mail Server 625 The following lines cause sendmail to rewrite the domain in the return path of all outgoing messages: FEATURE(`always_add_domain )dnl MASQUERADE_AS(`mail.example.com )dnl FEATURE(`allmasquerade )dnl FEATURE(`masquerade_envelope )dnl This is often not desirable, so comment out these lines by adding dnl (including the space after dnl) to the front of each line: dnl FEATURE(`always_add_domain )dnl dnl MASQUERADE_AS(`mail.example.com )dnl dnl FEATURE(`allmasquerade )dnl dnl FEATURE(`masquerade_envelope )dnl The next two lines tell sendmail what forms of mail delivery it should handle. They may be missing from your configuration by default, so make sure they are added toward the end of the file. MAILER(local)dnl MAILER(smtp)dnl The following lines tell sendmail how to communicate with the milter processes. The INPUT_MAIL_FILTER ones define the connection parameters for the individual milters, and the define statement specifies the order in which they will be processed. INPUT_MAIL_FILTER(`spamassassin , `S=local:/var/run/sendmail/spamass.sock, F=, T=S:4m;R:4m;E:10m )dnl INPUT_MAIL_FILTER(`clamav , `S=local:/var/run/clamav/clamav-milter.ctl, F=, T=S:4m;R:4m )dnl define(`confINPUT_MAIL_FILTERS , `spamassassin,clamav )dnl The F= option tells sendmail to continue message processing even if it is unable to communicate with the milter. Replace it with F=T if you need to have messages temporarily fail in such an event (but make sure you watch your mail logs closely when doing so). 9. Make sure that any domains for which your server will be accepting mail are listed, one per line, in /etc/mail/local-host-names. 10. Regenerate the sendmail configuration file: # sendmailconfig Configure sendmail with the existing /etc/mail/sendmail.conf? [Y]y […] Configure sendmail with the existing /etc/mail/sendmail.mc? [Y]y […] Reload the running sendmail now with the new configuration? [Y]y Note
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Web site construction - 624 Part V . Running Servers 3. Configure

Friday, August 24th, 2007

624 Part V . Running Servers 3. Configure SpamAssassin to not modify message bodies by adding the following line to the end of /etc/spamassassin/local.conf: report_safe 0 4. Start SpamAssassin: # invoke-rc.d spamassassin start 5. Install the ClamAV virus scanning daemon: # apt-get install daemon clamav-daemon 6. Install the milter programs that sendmail will use to perform the content filtering: # apt-get install spamass-milter clamav-milter 7. Edit the spamass-milter startup parameters in /etc/default/spamassmilter. The configuration settings shown here instruct spamass-milter to not modify the message body (which can result in significant performance decreases) and to reject messages with a spam score higher than 20. # spamass-milt startup defaults # OPTIONS are passed directly to spamass-milter. # man spamass-milter for details OPTIONS= -m -r 20 Note the last line in this example. If you have several options to specify, you include them in a single OPTIONS line as shown. 8. The master sendmail configuration file is /etc/mail/sendmail.cf. Its format is very complicated, which is why the preferred method is to edit /etc/mail/ sendmail.mc. /etc/mail/sendmail.mc contains macros that are translated and copied to the sendmail.cf when you run sendmailconfig or when you run make from the /etc/mail directory. Open sendmail.mc in your text editor and make the following changes: DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp, Addr=127.0.0.1 )dnl This line tells sendmail to only listen for connections on the loopback interface. If you plan to receive messages directly via SMTP, replace 127.0.0.1 with 0.0.0.0. Add the following line after the DAEMON_OPTIONS lines if you do not have control over all hosts within the domains that you are relaying for (doing so will help prevent other machines within those domains from relaying mail through your server without authorization): FEATURE(`relay_hosts_only )dnl Insert this line if you have to send all outgoing mail through a specific server: define(`SMART_HOST , `mail.example.org )dnl If you are going to allow client machines to relay messages through your server (see step 12 and the associated Caution), find this line: FEATURE(`access_db , , `skip )dnl and replace skip with /etc/mail/access.
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Chapter 24 . Running a Mail Server 623 (Web hosting e commerce)

Thursday, August 23rd, 2007

Chapter 24 . Running a Mail Server 623 Installing and Running sendmail Sendmail (http://www.sendmail.org/) is the granddaddy of SMTP mail systems. It is still the default MTA on most systems, and a recent survey showed that 41% of active mail servers were running sendmail. A fairly recent addition to sendmail is the Milter API. This API allows for the writing of mail filters that can filter messages at the SMTP level, allowing for careful control over what messages are accepted by the server. A standard milter consists of a daemon that runs in the background and waits for a connection from the sendmail daemon. Almost every line that is sent from an SMTP client to the server is passed to the milter, which can accept, temporarily reject, or permanently reject the message at any point in the process. Milters also have the capability to modify message content. This capability is most commonly used to add headers to messages indicating status information. A number of milters have been written to perform various tasks. Two such milters are Spamass-Milter (http://savannah.nongnu.org/projects/spamass-milt/) and ClamAV-Milter (http://clamav.net/). As you would expect, these milters use SpamAssassin and ClamAV to perform content identification. You can find general information about milters at http://milter.org/. The final component is Qpopper (http://qpopper.sourceforge.net), which is the most widely used POP3 daemon. You can find configuration options for Qpopper in /etc/qpopper.conf, although you won t need to change any of the defaults for this server. Follow these steps to install and configure the needed software: 1. Use APT to install the sendmail packages: # apt-get install sendmail sendmail-bin sendmail-doc APT will download the packages, remove Exim (the default MTA on Debian systems), and install sendmail. During the configuration process, you will see warnings about databases not existing. It is safe to ignore these warnings. 2. Configure SpamAssassin s startup parameters. Start by editing the file /etc/default/spamassassin and changing the ENABLED and OPTIONS parameters. The file should look something like this when you are done: # /etc/default/spamd.conf # Change to one to enable spamd ENABLED=1 # Options # See man spamd for possible options. The -d option is # automatically added. OPTIONS= -m 25 -H Note
We recommend high quality webhost to host and run your jsp application: christian web host services.