ssaguiar
(usa Ubuntu)
Enviado em 24/01/2009 - 16:36h
Pessoal:
Instalei o sendmail, mas estou tendo problemas para enviar e-mails.
Explico:
Instalei o servidor sendmail em uma máquina em casa (ip dinâmico), mas não consigo acertar a configuração do arquivo . A máquina não consegue enviar e-mails.
No caso, minha máquina em casa, tem o nome: cefalosporina.net
Tenho uma conta no no-ip para validar o e-mail em caso de consulta ao dns reverso.
Meu arquivo sendmail.mc está assim:
divert(-1)dnl
divert(0)dnl
define(`_USE_ETC_MAIL_')dnl
include(`/usr/share/sendmail/cf/m4/cf.m4')dnl
VERSIONID(`$Id: sendmail.mc, v 8.13.8-3 2006-12-08 20:21:10 cowboy Exp $')
OSTYPE(`debian')dnl
DOMAIN(`debian-mta')dnl
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE
undefine(`confHOST_STATUS_DIRECTORY')dnl #DAEMON_HOSTSTATS=
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE
dnl #
dnl # General defines
dnl #
dnl # SAFE_FILE_ENV: [undefined] If set, sendmail will do a chroot()
dnl # into this directory before writing files.
dnl # If *all* your user accounts are under /home then use that
dnl # instead - it will prevent any writes outside of /home !
dnl # define(`confSAFE_FILE_ENV', `')dnl
dnl #
dnl # Daemon options - restrict to servicing LOCALHOST ONLY !!!
dnl # Remove `, Addr=' clauses to receive from any interface
dnl # If you want to support IPv6, switch the commented/uncommentd lines
dnl FEATURE(`no_default_msa')dnl
dnl DAEMON_OPTIONS(`Family=inet6, Name=MTA-v6, Port=smtp, Addr=::1')dnl
dnl DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp, Addr=127.0.0.1')dnl
dnl DAEMON_OPTIONS(`Family=inet6, Name=MSP-v6, Port=submission, Addr=::1')dnl
dnl DAEMON_OPTIONS(`Family=inet, Name=MSP-v4, Port=submission, Addr=127.0.0.1')dnl
dnl #
dnl # Be somewhat anal in what we allow
define(`confPRIVACY_FLAGS',dnl
`needmailhelo,needexpnhelo,needvrfyhelo,restrictqrun,restrictexpand,nobodyreturn,authwarnings')dnl
dnl #
dnl # Define connection throttling and window length
define(`confCONNECTION_RATE_THROTTLE', `15')dnl
define(`confCONNECTION_RATE_WINDOW_SIZE',`10m')dnl
dnl #
dnl # Features
dnl #
dnl # The access db is the basis for most of sendmail's checking
FEATURE(`access_db', , `skip')dnl
dnl #
dnl # The greet_pause feature stops some automail bots - but check the
dnl # provided access db for details on excluding localhosts...
FEATURE(`greet_pause', `1000')dnl 1 seconds
dnl #
dnl # Delay_checks allows sender<->recipient checking
FEATURE(`delay_checks', `friend', `n')dnl
dnl #
dnl # If we get too many bad recipients, slow things down...
define(`confBAD_RCPT_THROTTLE',`3')dnl
dnl #
dnl # Stop connections that overflow our concurrent and time connection rates
FEATURE(`conncontrol', `nodelay', `terminate')dnl
FEATURE(`ratecontrol', `nodelay', `terminate')dnl
dnl #
dnl # If you're on a dialup link, you should enable this - so sendmail
dnl # will not bring up the link (it will queue mail for later)
dnl define(`confCON_EXPENSIVE',`True')dnl
dnl #
dnl # Dialup/LAN connection overrides
dnl #
include(`/etc/mail/m4/dialup.m4')dnl
include(`/etc/mail/m4/provider.m4')dnl
dnl #
dnl # Default Mailer setup
MAILER_DEFINITIONS
MAILER(`local')dnl
MAILER(`smtp')dnl
dnl # Masquerading options
FEATURE(`always_add_domain')dnl
MASQUERADE_AS(`ssaguiar.no-ip.info
#cefalosporina.net')dnl
FEATURE(`allmasquerade')dnl
FEATURE(`masquerade_envelope')dnl
MAILER(`local')dnl
MAILER(`smtp')dnl
Cw cefalosporina.net
FEATURE(dnsbl,`combined.njabl.org',`Message from $&{client_addr} rejected - see
http://njabl.org/lookup?$&{client_addr}')
O tail do arquivo /var/log/mail.log:
Jan 24 14:00:37 cefalosporina sendmail[5777]: n0OG0Z62005777: to=root, ctladdr=root (0/0), delay=00:00:02, xdelay=00:00:00, mailer=relay, pri=30299, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (n0OG0b8S005786 Message accepted for delivery)
Jan 24 14:00:37 cefalosporina sm-mta[5794]: n0OG0b8S005786: to=<root@cefalosporina>, ctladdr=<root@cefalosporina> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30778, dsn=2.0.0, stat=Sent
Jan 24 15:00:19 cefalosporina sendmail[5941]: n0OH0H8f005941: from=root, size=299, class=0, nrcpts=1, msgid=<200901241700.n0OH0H8f005941@cefalosporina>, relay=root@localhost
Jan 24 15:00:20 cefalosporina sm-mta[5950]: n0OH0JGj005950: from=<root@cefalosporina>, size=555, class=0, nrcpts=1, msgid=<200901241700.n0OH0H8f005941@cefalosporina>, proto=ESMTP, daemon=MSA, relay=smmsp@localhost.localdomain [127.0.0.1]
Jan 24 15:00:20 cefalosporina sendmail[5941]: n0OH0H8f005941: to=root, ctladdr=root (0/0), delay=00:00:03, xdelay=00:00:01, mailer=relay, pri=30299, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (n0OH0JGj005950 Message accepted for delivery)
Jan 24 15:00:20 cefalosporina sm-mta[5958]: n0OH0JGj005950: to=<root@cefalosporina>, ctladdr=<root@cefalosporina> (0/0), delay=00:00:01, xdelay=00:00:00, mailer=local, pri=30778, dsn=2.0.0, stat=Sent
Jan 24 16:00:05 cefalosporina sendmail[6433]: n0OI0352006433: from=root, size=299, class=0, nrcpts=1, msgid=<200901241800.n0OI0352006433@cefalosporina>, relay=root@localhost
Jan 24 16:00:05 cefalosporina sm-mta[6442]: n0OI055P006442: from=<root@cefalosporina>, size=555, class=0, nrcpts=1, msgid=<200901241800.n0OI0352006433@cefalosporina>, proto=ESMTP, daemon=MSA, relay=smmsp@localhost.localdomain [127.0.0.1]
Jan 24 16:00:05 cefalosporina sendmail[6433]: n0OI0352006433: to=root, ctladdr=root (0/0), delay=00:00:02, xdelay=00:00:00, mailer=relay, pri=30299, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (n0OI055P006442 Message accepted for delivery)
Jan 24 16:00:05 cefalosporina sm-mta[6450]: n0OI055P006442: to=<root@cefalosporina>, ctladdr=<root@cefalosporina> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30778, dsn=2.0.0, stat=Sent
Como pode ser viso, existe:
relay=smmsp@localhost.localdomain [127.0.0.1]
mas smmsp@localhost.localdomain [127.0.0.1] não existe.
Os e-mails são gerados por cron (programado pelo crontab).
Entre 0 horas e 8 horas da manhã e entre 12 e 14 horas, se houver movimento em frente a uma das câmeras, o sistema envia um e-mail.
No crontab, existem as linhas:
0 0,12 * * * root /bin/touch /root/mov_cap_enable
0 8,14 * * * root /bin/rm /root/mov_cap_enable
Eu uso o motion para o sistema de segurança, e, ao detectar movimento em frente uma das câmeras, ele grava o filme relativo ao movimento e, se existir o arquivo /root/mov_cap_enable, ele envia um e-mail com a cópia do filme.
no arquivo de configuraçã do motion, em /usr/local/etc/thread2.conf coloquei a linha, ao final:
on_movie_end /sbin/email.sh "%f"
O conteúdo do script email.sh é este:
#!/bin/sh
if echo "$1" | grep -q '.avi'; then
if [[ -e /root/mov_cap_enable ]]; then
( cat /root/mensagem.txt
uuencode $1 movimento.avi
) | mail -s "$1" somebody@somewhere.com;
echo $1 >> /root/emailmovimento.log;
fi;
fi;
Obrigado por qualquer ajuda.
Sérgio