Archive for April, 2007

Chapter 17 . Mail Servers (Java web server) Postfix, Sendmail,

Monday, April 30th, 2007

Chapter 17 . Mail Servers Postfix, Sendmail, Qpopper, and Cyrus 493 Choosing a Mail Client When your mail server is configured, you need to be able to read your email. You will find many mail clients available, the most popular being mutt, pine, kmail, and evolution. We briefly describe the benefits of all of the systems and where they are most commonly used. The Command-Line Clients If you have only command-line access to your mail, you will probably want to use mail or mutt. mail The mail command is the most basic mail client of all and is used to send mail and receive it using the command line. If you want to send mail with the mail command, just enter mail and the person you want to send mail to. bible:~ # mail justin@wileybible.com Subject: Hello there This is a test . EOT Here, we have been asked for the subject of the mail, and we are then ready to type our mail message. Notice that at no point during this transaction are we given guidance on what to do. This is stereotypical Unix commands at their best! When the message has been entered, you then need to enter a period on a line by itself and then press Enter/Return. This will send the mail to the recipient specified. To read mail with the mail command, enter mail at the command line and press Enter/Return. You are then presented with a list of mails in your mailbox that you can read. To read a message, just enter the number of the mail you want to read: bible:~ # mail mailx version nail 10.6 11/15/03. Type ? for help. /var/mail/justin : 1 message 1 new >N 1 justin@wileybible.com Thu Sep 30 11:30 14/452 Hello there & Pressing 1 and Return will show you the mail message you just sent. mail is installed by default on most Unix systems and can be used as a last resort to read your mail. It is also good because you can use the mail command to send mail through a shell script if you have a list of email addresses you need to send something to (but not for spam).
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision make web site services

Jetty web server - 492 Part IV . Implementing Network Services in

Monday, April 30th, 2007

492 Part IV . Implementing Network Services in SUSE Linux When set, the ACLs come into effect immediately. Copying mails to the shared folder will work, but deleting them will not. This enables you as the administrator to set up a non-volatile, non-destructive mail store for a group of users with fine- grained access controls. Integrating Cyrus and Postfix So now that you know how Cyrus works, you need to set up Postfix to use Cyrus to store the user s mail. In /etc/postfix/main.cf, you need to set the mailbox_transport to use the service cyrus. The service cyrus is preconfigured in /etc/postfix/master.cf. This file contains definitions for SMTP services as well as any user-defined services that can be used in parameters such as mailbox_transport. So you edit /etc/ postfix/main.cf and change the mailbox_transport as follows: mailbox_transport = cyrus When /etc/postfix/main.cf is edited, restart Postfix with rcpostfix. Tip To make sure Postfix or any other service (such as inetd, or cyrus in this chapter) starts when you boot the system, use chkconfig -a servicename. Any mail sent to users will now be delivered to their mailboxes using the cyrus service. The cyrus service calls the Cyrus deliver command to take the mail message and deliver it to the defined user s IMAP mailbox for his or her retrieval instead of the local mail spool. Setting an Alias for Root s Mail in Cyrus One thing that you need to consider when using Cyrus in this type of environment is that any mail to a user that is not in the Cyrus database will be rejected by Cyrus. This is especially true for the root user. It is not a good idea to store the root user mail in Cyrus, so most people configure an alias for root s mail to be delivered to a non-administrative user. Here we configure root s mail to be delivered to the user justin: 1. Open the file /etc/aliases and add an entry for the root user: root: justin This tells Postfix that any mail for root should actually be delivered to the user justin. 2. When /etc/aliases is edited, run the postalias command: bible:~ # postalias /etc/aliases 3. You then need to reload Postfix s databases to commit the new alias.
Note: If you are looking for cheap and reliable webhost to host and run your web application check Vision coldfusion web hosting services

Chapter 17 . Mail Servers (Web hosting plans) Postfix, Sendmail,

Monday, April 30th, 2007

Chapter 17 . Mail Servers Postfix, Sendmail, Qpopper, and Cyrus 491 Note If you ever need to find out what Cyrus commands you can use, type help in the Cyrus command shell. Table 17-1 Cyrus ACL Settings ACL Code Description r Read the contents of the folder. s Set the seen flag on a message in the folder. w Write to the folder that is, store a message in the folder. i Insert or append a message to the folder. p Send a mail to the folder. c Create (subfolder) or delete the folder. d Delete a message in the folder. a Administrative rights on the folder, set ACLs. L List the folder that is, be able to view the folder in a folder list. To set an ACL on the folder, you need three pieces of information: the user you want to set the ACL for, the mailbox, and the ACL settings themselves. Consider the example in Listing 17-5. Listing 17-5: Setting ACLs on a Shared Mailbox localhost> sam share aimee lrwsip localhost> sam share roger lrwsip localhost> sam share justin lrwsip localhost> lam share roger lrswip justin lrswip anyone lrs aimee lrswip Here, we have allowed the users justin, roger, and aimee to list the folder, read the contents of the folder, set the seen flag on a message, store a message in the folder, and also send a message directly to the folder. We have not allowed them to delete any messages in the folder, so all is as we originally wanted.
Note: If you are looking for high quality webhost to host and run your jsp application check Vision christian web host services

Web hosting reseller - 490 Part IV . Implementing Network Services in

Sunday, April 29th, 2007

490 Part IV . Implementing Network Services in SUSE Linux Note New password: Re-enter new password: Password changed When set, you need to start the cyrus and saslauthd services. The saslauthd service is the Cyrus SASL authentication daemon. SASL is a general- purpose authentication mechanism that can be used in client and server environments. Cyrus IMAP relies on the SASL library to provide authentication services. Adding Users to Cyrus When those services are started, you need to add users to the Cyrus database to provide mail services for them. We will take the user justin (who must exist in the system) as an example. To add a user to the Cyrus system, become the cyrus user and connect to the Cyrus IMAP server with the cyradm command (Cyrus administration tool): bible:~ # su - cyrus cyrus@bible:~> cyradm localhost IMAP Password: localhost> When connected, you can use the cm (create mailbox) command to create the user justin s inbox: localhost> cm user.justin localhost> lm user.justin (HasNoChildren) localhost> Here you have told Cyrus to create the mailbox user.justin. This may seem odd, but it is a standard way to configure Cyrus for user mailboxes. Cyrus works on a hierarchical mailbox structure, not only for the users, but also for system mailboxes. These system mailboxes could be mailboxes that are shared between many users for bulletins, for example. Creating a Shared Mailbox If you want to create a mailbox that is shared between certain users, use the cm command to create the mailbox and also set the access control list (ACL) for users on the mailbox. For example, if you have three users, justin, roger, and aimee, on the system, and you want them to be able to store and view messages in this folder, but not to be able to delete any, you can look up the access control codes in Table 17-1 and set the ACL on that folder using the sam command (set ACL on folder).
Note: If you are looking for cheap and reliable webhost to host and run your web application check Vision coldfusion web hosting services

Chapter 17 . Mail Servers Postfix, Sendmail, (Web site design and hosting)

Sunday, April 29th, 2007

Chapter 17 . Mail Servers Postfix, Sendmail, Qpopper, and Cyrus 489 If you are using a dial-up Postfix configuration, you can use fetchmail to automatically download your POP mail through SMTP to your mail server. Some Internet service providers (ISPs) routinely poll a static IP address that you have been assigned and automatically have your mail delivered through SMTP, but these services usually cost more money and are few and far between. Cyrus IMAPD POP3 is a good mail delivery agent for most situations, but if you like your mail controlled from a central server, with access to all your mail and folders from a remote site regardless of whether your mail is stored locally, then IMAP is the answer. IMAP is a connection-based protocol. What that means is that you need a connection to the server to read your mail. Some MUAs enable you to read your mail locally and offline while not connected, but the server holds the up-to-date representation of your mail. There are two main contenders in the Unix IMAP server space, University of Washington and Cyrus IMAPD. Both IMAP servers are extremely good at what they do, and we have chosen Cyrus as our focus because it is the IMAP server of choice by SUSE (it is the IMAP server used in OpenExchange). The Cyrus IMAP server is extremely scalable and is capable of handling thousands of mail accounts. If more scalability is needed, you can use a Murder of Cyrus (a cluster of Cyrus servers) to provide a distributed IMAP server farm. To use Cyrus, you need to add a system user (in our case, we will use justin) to the Cyrus database. All authentication is still handled through the user s system password, but the Cyrus database needs to provide a namespace for the user, including folders and access control lists. Configuring the Cyrus User When Cyrus has been installed through YaST, a few administrative tasks need to take place before you can log in as a user. First, we need to talk about how Cyrus works and interacts with the system. The Cyrus IMAP process is controlled by the user cyrus. With most daemon processes, the user who owns the process is usually a placeholder to run the daemon and nothing else. In the case of Cyrus, the cyrus system user plays an important part by not only running the IMAPD process but also by being the user that IMAP administration is conducted under. With this in mind, you need to set a password for the cyrus user. To do this, as root, run the passwd command for the cyrus user: bible:~ # passwd cyrus Changing password for cyrus.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision best web hosting services

488 Part IV . Implementing Network Services in (Web hosting control panel)

Sunday, April 29th, 2007

488 Part IV . Implementing Network Services in SUSE Linux # pop2 stream tcp nowait root /usr/sbin/tcpd ipop2d # pop3 stream tcp nowait root /usr/sbin/tcpd ipop3d # pop3s stream tcp nowait root /usr/sbin/tcpd ipop3d pop3 stream tcp nowait root /usr/sbin/tcpd /usr/sbin/popper f /etc/qpopper.conf # If you want to set the parameters discussed previously in the qpopper.conf configuration, you have to use a full text representation of the parameters: set statistics set downcase-user set reverse-lookup=false Qpopper has many options that you can enable on the command line in /etc/inetd.conf or by specifying a configuration file on the command line containing parameters. For more information on what you can do with Qpopper, take a look at the popper(8) man page. Fetchmail In certain situations, you may need to pull your email from a POP or IMAP server to your local mail server. The fetchmail program was designed to contact an MDA and fetch the mail and then pass it through your local SMTP server for delivery. For fetchmail to successfully run, you need to know the address of your MDA server, the username, password, and the protocol to use (POP3/IMAP). The fetchmail program then connects to the MUA and transports the messages to your SMTP server for further processing. When you run fetchmail with the required options, it delivers mail to the user you are running the command as. justin@bible:~> fetchmail mail.bible.suse.com -p pop3 Enter password for justin@mail.bible.suse.com: 1 message for justin at mail.bible.suse.com (720 octets). reading message justin@mail.bible.suse.com:1 of 1 (720 octets) flushed In the example, the user is currently logged in as justin, so the mail will be delivered through SMTP to the user justin@localhost. In the fetchmail run in the previous example, we told fetchmail the server (mail.bible.suse.com) and the protocol (-ppop3). The fetchmail program is clever enough to know that we also need a password, so it asks us for it. When a message has been flushed, it is delivered through SMTP.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision web and email hosting services

Chapter 17 . Mail Servers Postfix, Sendmail, (Web server)

Sunday, April 29th, 2007

Chapter 17 . Mail Servers Postfix, Sendmail, Qpopper, and Cyrus 487 # # pop2 stream tcp nowait root /usr/sbin/tcpd ipop2d # pop3 stream tcp nowait root /usr/sbin/tcpd ipop3d # pop3s stream tcp nowait root /usr/sbin/tcpd ipop3d pop3 stream tcp nowait root /usr/sbin/tcpd /usr/sbin/popper -s # Note The network process inetd accepts connections from standard ports and passes control over to a specific application. Whereas Postfix listens on port 25 in daemon mode, Qpopper relies on inetd to provide its listening services. When enabled, start inetd to enable POP3 access to your mail. bible:~ # rcinetd start Starting inetd done Once started, you can test connectivity with Telnet as we discuss in more detail in Chapter 15. Listing 17-4 shows an example. Listing 17-4: Testing the POP3 Server with Telnet bible:~ # telnet localhost 110 Trying 127.0.0.1… Connected to localhost. Escape character is ^] . +OK ready <2282.1088970620@bible> user justin +OK Password required for justin. pass password +OK justin has 1 visible message (0 hidden) in 544 octets. As you can see, the user justin has one unread mail that is 544 octets in length. You can pass other parameters to Qpopper to extend its functionality. For example, if you want to allow your users to enter their usernames in uppercase or mixed case format, you can add -c to the Qpopper command line in inetd.conf to enable this. Another common parameter is -R to disable reverse name lookups (so that the host name and not the IP address is stored in the system log). If you want to store your Qpopper options in a configuration file instead of specifying them on the command line through inetd.conf, you need to call Qpopper with the -f parameter (to set the configuration file): # Pop et al #
Note: In case you are looking for affordable and reliable webhost to host and run your business application check Vision ftp web hosting services

486 Part IV . Implementing Network Services in (Web site directory)

Saturday, April 28th, 2007

486 Part IV . Implementing Network Services in SUSE Linux in the beginning of this section, the primary reason that people choose a mail transfer agent other than sendmail is the complexity of its configuration files, which are totally hidden by YaST s graphical interface. If you decide to use sendmail, you may eventually want to delve more deeply into manual aspects of its configuration. A number of excellent books dedicated to sendmail are currently available, as are a number of online resources. The best online resource for information about send- mail is the home page for the Sendmail Consortium, which maintains and develops the freeware version of sendmail. Go to www.sendmail.org for a good deal of information local to their site, as well as pointers to many of the best sites on the Internet for sendmail information. Qpopper When your MTA is configured, you need to be able to access your mail using a mail client by connecting to an MDA. You have three ways of remotely accessing your mail: . By logging in to the server and accessing the mail spool directly . Through Internet Message Access Protocol (IMAP) . Through Post Office Protocol (POP3) We will talk about POP3 and IMAP in this section of the chapter, starting with POP3. POP3 enables you to receive your mail from a server and store it on your local disk. When the mail has been received from the server, it is deleted from the server. POP3 is a good mail storage option for laptop users as your mail is always local to your machine. IMAP takes a different approach by always storing your mail messages on the server. This gives you the added benefit of being able to access all of your mail (including subfolders) wherever you are. If you use POP3, you are able to see all of your mail that you have downloaded only if you have your laptop or desktop machine that you use to download your POP3 mail with you. One of the best POP3 servers is Qpopper. In addition to being the standard for POP3 retrieval, it is actively maintained and also supports extended authentication methods from the standard cleartext username and passwords. You will need to install Qpopper using YaST, and then enable POP3 access in /etc/inetd.conf. Open /etc/inetd.conf and uncomment the popper line relating to POP3 (see Listing 17-3). Listing 17-3: Enabling Qpopper in inetd # Pop et al
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision best web hosting services

Chapter 17 . Mail Servers Postfix, Sendmail, (Jetty web server)

Saturday, April 28th, 2007

Chapter 17 . Mail Servers Postfix, Sendmail, Qpopper, and Cyrus 485 root Note Starting sendmail Installing sendmail as described in the previous section also installs the sendmail startup script /etc/init.d/sendmail and creates symbolic links that automatically start and stop sendmail at run levels 3 (/etc/init.d/rc3.d/S14sendmail and /etc/init.d/rc3.d/K08sendmail, respectively) and 5 (/etc/init.d/ rc5.d/S14sendmail and /etc/init.d/rc5.d/K08sendmail, respectively). To start sendmail, execute the startup script manually, as in the following example: #/etc/init.d/sendmail start To verify that sendmail is running and its current status, you can use a command such as the following: $ ps -p `pidof sendmail` UPID TTY STAT START TIME COMMAND ? Ss 05:31 0:00 sendmail: accepting connections If the ps -p command returns the error message ERROR: List of process IDs mustfollow p, the pidof command returned NULL because sendmail is not running on your system. Try restarting sendmail using the startup script, as described previously. If you still receive an error message, try executing the ps A command and using grep to search for sendmail in its output (ps A |grep I sendmail). This shows that the sendmail daemon is running as root. Alternately, you could connect to the mail port (port 25) using your host s loopback address to verify that the sendmail daemon will respond to incoming requests, as in the following example: $ telnet 127.0.0.1 25 Trying 127.0.0.1… Connected to 127.0.0.1. Escape character is ^] . 220 laptop.vonhagen.org ESMTP Sendmail 8.13.3/8.13.3/SuSE Linux 0.7; Thu, 9 Jun 2005 05:38:28 -0400 QUIT 221 2.0.0 laptop.vonhagen.org closing connection Connection closed by foreign host. If you configured sendmail to accept remote SMTP connections, you should also verify this by connection to the mail port on your host s externally visible IP address. Getting More Information about sendmail SUSE s YaST tool vastly simplifies the configuration and administration of sendmail compared with the tasks required on other Linux and Unix systems. As mentioned
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision web design programs services

484 Part IV (Web site layout) . Implementing Network Services in

Saturday, April 28th, 2007

484 Part IV . Implementing Network Services in SUSE Linux Figure 17-5: Specifying incoming mail parameters The other settings on this panel enable you to specify a port that sendmail can use to retrieve and send mail, and to identify a remote mail server from which sendmail should retrieve mail for local delivery. This panel also enables you to specify a central address to which you would like mail to the root user on your current system to be delivered. This is the most common example of email aliasing, which is the ability to specify the destination to which mail addressed to a specific local user should be forwarded or delivered. Clicking the Aliases button displays a screen that enables you to add other email aliases, which will be stored in the file /etc/mail/aliases. Similarly, clicking the Virtual domains button enables you to specify the addresses to which mail addressed to non-local users should be forwarded or delivered. Click Finish to complete your configuration of sendmail. If you enabled antivirus scanning and the AMaViS package is not already installed, YaST will prompt you for the appropriate CD or DVD media at this point. If this is the case, insert the appropriate media and wait for the installation to complete. YaST completes the sendmail configuration process by running SUSEConfig for you, which generates and updates /etc/sendmail.cf for you, as well as any of the files in /etc/mail that have been affected by your configuration changes.
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision web design programs services