Unix Network Admin   «Prev  Next»

How to Configure sendmail using M4 - Exercise

Objective: Use M4 and a template file to create sendmail.cf automatically.

Instructions

This exercise contains a slideshow to simulate a UNIX command line and allows you to practice entering commands.

Exercise scoring

This exercise is not scored. When you have completed the exercise, click the Submit button to review the solution and continue with the course.

Instructions

In this exercise, you will use a .mc template to configure sendmail for a generic Solaris machine. Start the simulation below and work through the situation presented.
1) Config Sendmail1 2) Config Sendmail2 3) Config Sendmail3 4) Config Sendmail4
  1. You are logged on as root and are in the usr/sendmail/cf/cf directory. Enter ls -l.
  2. List the files
  3. ls -l
  4. Notice that this directory has several files, including generic-solaris2.mc. You can customize any of these files, then run them through M4 to create a valid sendmail.cf file automatically. Now, view the contents of generic-solaris2.mc by using cat.
  5. View the contents of the file
  6. cat generic-solaris2.mc
  7. Type cat generic-solaris2.mc to view the contents of the file.
  8. Normally, an .mc file has much more information, including notes on how to use it. The pertinent information here tells you that this .mc file configures sendmail for a Solaris box, is masquerading as marketing.mail.com, and uses SMTP. You are still in the
    usr/sendmail/cf/cf
    
    directory. The m4.cf command is in the usr/sendmail/cf/m4 directory. Type (S1)m4 ../cf/m4/cf.m4 generic-solaris2.mc > sendmail.cf to configure the sendmail.mc file.
  9. Configure the .mc file,22,362,499,1,3,0,0
  10. m4 ../cf/m4/cf.m4 generic-solaris2.mc > sendmail.cf
  11. You have now created an entire sendmail.cf file. You are ready to test the sendmail file to see if it works in your particular situation. After testing the file, you can deploy it. This is the end of the simulation. Click the Exit button.