Create the groups needed by Sendmail by running:
groupadd -g 1 bin groupadd -g 2 kmem groupadd -g 3 mail useradd -u 1 -g bin -d /bin -s /bin/sh bin
Outgoing mail processed by Sendmail is put in the /var/spool/mqueue directory. Incoming mail is forwarded to Procmail by Sendmail so we need to have an incoming mail directory as well which is /var/mail. We'll create these directories and give them the proper permissions:
mkdir /var/spool mkdir /var/mail cd /var/spool; ln -s ../mail mail chmod 700 /var/spool/mqueue chmod 775 /var/mail chgrp mail /var/mail chmod 1777 /tmp
cd src ./Build; ./Build install
Configuring Sendmail isn't as easily said as done. There are a lot of things you need to consider while configuring Sendmail and I can't take everything into account. That's why at this time we'll create a very basic and standard setup. If you want to tweak Sendmail to your own liking, go right ahead, but this is not the right article. You could always use your existing /etc/sendmail.cf (or /etc/mail/sendmail.cf) file if you need to use certain features.
cf/lfs.mc
containing the following:
OSTYPE(LFS) FEATURE(nouucp) define(`LOCAL_MAILER_PATH', /usr/bin/procmail) MAILER(local) MAILER(smtp)
ostype/LFS.m4
by running touch ostype/LFS.m4
m4 m4/cf.m4 cf/lfs.mc > cf/lfs.cf
/etc/sendmail.cf
touch /etc/aliases
sendmail -v -bi
make; make install; make install-suid
/etc/init.d/sendmail
containing the following:
#!/bin/sh # Begin /etc/init.d/sendmail check_status() { if [ $? = 0 ] then echo "OK" else echo "FAILED" fi } case "$1" in start) echo -n "Starting Sendmail..." start-stop-daemon -S -q -o -x /usr/sbin/sendmail -- -bd check_status ;; stop) echo -n "Stopping Sendmail..." start-stop-daemon -K -q -o -p /var/run/sendmail.pid check_status ;; reload) echo -n "Reloading Sendmail configuration file..." start-stop-daemon -K -q -s 1 -p /var/run/sendmail.pid check_status ;; restart) echo -n "Stopping Sendmail..." start-stop-daemon -K -q -o -p /var/run/sendmail.pid check_status sleep 1 echo -n "Starting Sendmail..." start-stop-daemon -S -q -o -x /usr/sbin/sendmail -- -bd check_status ;; *) echo "Usage: $0 {start|stop|reload|restart}" exit 1 ;; esac # End /etc/init.d/sendmail
chmod 755 /etc/init.d/sendmail
cd /etc/init.d/rc2.d; ln -s ../init.d/sendmail S20sendmail cd ../rc0.d; ln -s ../init.d/sendmail K20sendmail cd ../rc6.d; ln -s ../init.d/sendmail K20sendmail
groupadd -g 65534 nogroup groupadd -g 4 ftp
useradd -u 65534 -g nogroup -d /home nobody useradd -u 4 -g ftp -s /bin/sh -m ftp
./configure make; make install
/etc/init.d/proftpd
containing the following:
#!/bin/sh # Begin /etc/init.d/proftpd check_status() { if [ $? = 0 ] then echo "OK" else echo "FAILED" fi } case "$1" in start) echo -n "Starting Pro FTP daemon..." start-stop-daemon -S -q -o -x /usr/sbin/proftpd check_status ;; stop) echo -n "Stopping Pro FTP daemon..." start-stop-daemon -K -q -o -x /usr/sbin/proftpd check_status ;; restart) echo -n "Stopping Pro FTP daemon..." start-stop-daemon -K -q -o -x /usr/sbin/proftpd check_status sleep 1 echo -n "Starting Pro FTP daemon..." start-stop-daemon -S -q -o -x /usr/sbin/proftpd check_status ;; *) echo "Usage: $0 {start|stop|restart}" ;; esac # End /etc/init.d/proftpd
chmod 755 /etc/init.d/proftpd
cd /etc/rc2.d; ln -s ../init.d/proftpd S40proftpd cd ../rc0.d; ln -s ../init.d/proftpd K40proftpd cd ../rc6.d; ln -s ../init.d/proftpd K40proftpd
./configure make; make install
/etc/init.d/apache
containing the following:
#!/bin/sh # Begin /etc/init.d/apache case "$1" in start) echo -n "Starting Apache HTTP daemon..." /usr/apache/bin/apachectl start ;; stop) echo -n "Stopping Apache HTTP daemon..." /usr/apache/bin/apachectl stop ;; restart) echo -n "Restarting Apache HTTP daemon..." /usr/apache/bin/apachectl restart ;; force-restart) echo -n "Stopping Apache HTTP daemon..." /usr/apache/bin/apachectl stop sleep 1 echo -n "Starting Apache HTTP daemon..." /usr/apache/bin/apachectl start ;; *) echo "Usage: $0 {start|stop|restart|force-restart}" ;; esac # End /etc/init.d/apache
chmod 755 /etc/init.d/apache
cd /etc/rc2.d; ln -s ../init.d/apache S50apache cd ../rc0.d; ln -s ../init.d/apache K50apache cd ../rc6.d; ln -s ../init.d/apache K50apache
./configure make; make install
/etc/inetd.conf
containing the following:
# Begin /etc/inetd.conf telnet stream tcp nowait root /usr/sbin/in.telnetd # End /etc/inetd.conf
/etc/init.d/inetd
containing the following:
#!/bin/sh # Begin /etc/init.d/inetd check_status() { if [ $? = 0 ] then echo "OK" else echo "FAILED" fi } case "$1" in start) echo -n "Starting Internet Server daemon..." start-stop-daemon -S -q -o -x /usr/sbin/inetd check_status ;; stop) echo -n "Stopping Internet Server daemon..." start-stop-daemon -K -q -o -p /var/run/inetd.pid check_status ;; reload) echo -n "Reloading Internet Server configuration file..." start-stop-daemon -K -q -s 1 -p /var/run/inetd.pid check_status ;; restart) echo -n "Stopping Internet Server daemon..." start-stop-daemon -K -q -o -p /var/run/inetd.pid check_status sleep 1 echo -n "Starting Internet Server daemon..." start-stop-daemon -S -q -o -x /usr/sbin/inetd check_status ;; *) echo "Usage: $0 {start|stop|reload|restart}" ;; esac # End /etc/init.d/inetd
chmod 755 /etc/init.d/inetd
cd /etc/rc2.d; ln -s ../init.d/inetd S30inetd cd ../rc0.d; ln -s ../init.d/inetd K30inetd cd ../rc6.d; ln -s ../init.d/inetd K30 inetd
Before you can logon to the Internet, the kernel must be ppp-aware. You can accomplish this by compiling ppp-support directly into the kernel, or compiling the ppp drivers are modules which you load when you need them. Whatever you prefer, do it now by re-configuring the kernel if necessary. If your LFS kernel is already ppp-aware than you don't have to re-configure the kernel.
groupadd -g7 daemon
./configure make; make install
/etc/resolv.conf
containing the following:
# Begin /etc/resolv.conf nameserver <IP address of your ISP's primairy DNS server> nameserver <IP address of your ISP's secundairy DNS server> # End /etc/resolv.conf
/etc/ppp/peers
directory/etc/ppp/peers/provider
containing the following:
# Begin /etc/ppp/peers/provider noauth connect "/usr/sbin/chat -v -f /etc/chatscripts/provider" /dev/ttyS1 115200 defaultroute noipdefault # End /etc/ppp/peers/provider
/etc/chatscripts
directory/etc/chatscripts/provider
containing the following:
# Begin /etc/chatscripts/provider ABORT BUSY ABORT "NO CARRIER" ABORT VOICE ABORT "NO DIALTONE" ABORT "NO ANSWER" "" ATZ OK ATDT <ISP's phonenumber> TIMEOUT 35 CONNECT '' TIMEOUT 10 ogin: \q<username> TIMEOUT 10 assword: \q<mysecretpassword> # End /etc/chatscripts/provider
As you see from the sample scripts (these are the actual scripts I use when I'm not using X) above I logon to my ISP using this chatscripts in stead of authenticating via pap or chap. Though my ISP supports pap, I choose to do it this slightly different way which has it's disadvantages and advantages. In my case the advantages outweigh the disadvantages. This way I have more control over my logon procedure and I can see closer what is happening when.
For example most times when I connect I have a window running tail -f /var/log/syslog
so I can keep an eye on when (with my provider it's mostly 'if') things like
the username and password are sent.