Set up a profile in /etc/xinetd.d called http:
Set up a profile in /etc/xinetd.d called http:
grep. The truth is, inability to navigate Linux and the Asterisk command line is crippling.
yum/RPM with CentOS) so that he/she can easily load necessary tools
svn, and the ability to decipher output they produce
Is it a tall order? Yes, there is a learning curve. It’s not Windows 7. But, like learning a foreign language, when you go into the foreign land (Linux console) and can speak the language, you are empowered.
Here’s a simple how-to for processing the mail your Asterisk server generates, without running a full mail-transfer agent (MTA) like sendmail or postfix.
First, two assertions:
In the past, a Linux admin would enable sendmail, set the domain name and basically be done. Mail would work on port 25, everyone would accept everyone else’s mail, and life was good. Then spammers ruined our lives and we have to use strange ports, domain validation and a bunch of other things to make ourselves an official mail server. That’s too much work, especially for a box that’s supposed to be a PBX, not a mail system. And if you’re on a residential Internet connection, forget it–you’re probably in every blacklist.
Enter ssmtp, the simple SMTP sender. We’ll use it to send both Internet e-mail, such as might be produced by Asterisk’s voicemail system, and local root-type mail (e.g. cron alerts) through a legitimate SMTP server. It does not run as a system daemon, only on-demand when something on the server generates e-mail. And it’s simple to set up.
tar jxvf ssmtp_(version).orig.tar.bz2to expand it.
./configure --enable-ssl(if the build fails later,
yum install openssl-devel[CentOS/RedHat] to get the necessary SSL libraries)
make install, as root. On a fresh install, sample configurations are installed in /usr/local/etc/ssmtp/. The program is in /usr/local/sbin/.
# The person who gets all mail for userids < 1000 firstname.lastname@example.org # The place where the mail goes. The actual machine name is required # no MX records are consulted. Commonly mailhosts are named mail.domain.com mailhub=smtp.gmail.com:587 # The full hostname hostname=asteriskbox.example.com fromlineoverride=yes authuser=USERNAME authpass=PASSWORD useTLS=yes useSTARTTLS=yes authmethod=LOGIN
This example configuration, as you can guess, is for a Gmail account, and will also work with a Google Apps account. Since so many folks use Gmail, you could just cut and paste this, replacing the hostname and credentials with your own. If you are using a different SMTP server, adjust as necessary. With Gmail, the fromlineoverride won’t work–Gmail uses your Gmail address as the From. But it may work on other servers, especially if you are running your own mail server on a different box and send your mail to that.
yum erase sendmailwill get rid of it from CentOS. Then
ln -s /usr/local/sbin/ssmtp /usr/sbin/sendmailto trick your programs into believing sendmail is there, while ssmtp runs instead.
Test it out
You can install mailx with
yum install mailx, then try both local mail and Internet mail:
Or you can use ssmtp directly:
ssmtp root or
sendmail -t and then fill out the header by typing to: address and so on.
Once you see that mail is moving, you’re done. If you encounter a problem, check /var/log/maillog.
If you want to control where mail goes for individual local accounts, check out the revaliases file in /usr/local/etc/ssmtp/. Otherwise, all mail destined to local accounts with UID < 1000 will go to the mailbox specified in the root= line in the config.
If you are using authenticated SMTP (as in the example config above), your ssmtp.conf file contains your SMTP password in plain text. If your box is secure and you are the only user of it, this may not matter. If other users are logging in to the box, and you don’t want them to be able to see the config, you can
chmod 600 ssmtp.conf to make it readable only by root, then setuid root the ssmtp binary with
chmod +s /usr/local/sbin/ssmtp .
We have four x86-platform “server” appliances left over from an abandoned VoIP project by a consulting company that is now no longer in business. What to do with them? Install Linux, of course, and deploy them as remote network probes for a Smokeping network.
Problem: no console (headless), no peripherals, and it will only boot from the hard disk. It has four serial ports available and network connectivity.
Solution: load a modified Linux installer onto the hard disk. It must redirect the console to a serial port and be able to do a network install of the Linux distribution.
Here’s a summary of the steps I took to install CentOS on the appliances. If you’re interested in details, drop me a line.
serial 0 9600
which tells the installer we’re using serial port 0 (COM1) at 9600 baud. Change the “default” line to:
because the terminal is initially screwed up so we won’t be able to make a choice; we’ll have to let it default to the right one.
Now on “label text” add the following to the end of the “append” line:
which will tell it to boot the kernel and use serial 0 at 9600 baud for the console.
dd if=diskboot.img of=/dev/appliancedisk