Hi.
I have to isolate an old PHP application inside a FreeBSD jail. However, would it be possible to send mails, from this jail, via the SMTP server of the host ?
I have an OpenSMTPd on the host, configured using relays, on port 25, and I don't want to configure another OpenSMTPd on the jail, it would be redondant, just for an old web app.
The /etc/jail.conf (host):
Here's the /usr/local/etc/mail/smtpd.conf (host):
Here's the /usr/local/etc/mail/smtpd.conf (jail):
On the jail, when I'm trying to send an email with
However I have nothing on the host's /var/log/mailog. But a
On the host, a
On the jail:
Any ideas? I'd like to send emails from the jail, through the OpenSMTPd installed on the host. What did I mess? Maybe a better solution? I'm open.
Thanks a lot in advance.
Regards,
I have to isolate an old PHP application inside a FreeBSD jail. However, would it be possible to send mails, from this jail, via the SMTP server of the host ?
I have an OpenSMTPd on the host, configured using relays, on port 25, and I don't want to configure another OpenSMTPd on the jail, it would be redondant, just for an old web app.
The /etc/jail.conf (host):
Code:
myjail {
# STARTUP/LOGGING
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.consolelog = "/var/log/jail_console_${name}.log";
# PERMISSIONS
allow.raw_sockets;
exec.clean;
mount.devfs;
# HOSTNAME/PATH
host.hostname = "${name}";
path = "/jails/containers/${name}";
# NETWORK
ip4.addr = "192.168.1.201";
interface = em0;
# MISC
jid = 1;
persist;
}
Here's the /usr/local/etc/mail/smtpd.conf (host):
Code:
table aliases file:/etc/mail/aliases
table secrets file:/usr/local/etc/mail/secrets
listen on em0
action "local" maildir alias <aliases>
action "relay" relay host smtps://user@provider.tld auth <secrets>
match for local action "local"
match from local for any action "relay"
match from src "192.168.1.201" for any action "relay"
Here's the /usr/local/etc/mail/smtpd.conf (jail):
Code:
listen on localhost
action "local" maildir
action "relay" relay host smtps://192.168.1.10
match for local action "local"
match from local for any action "relay"
On the jail, when I'm trying to send an email with
echo "test" | mail myuser@whateverdomain.tld
, I got this in /var/log/maillog :
Code:
smtp connected address=local host=hostname.domain.tld
smtp message msgid=a06cf5db size=345 nrcpt=1 proto=ESMTP
smtp envelope evpid=a06cf5dbfbf2f1c1 from=<root@hostname.domain.tld> to=<user@domain.tld>
smtp disconnected reason=quit
mta connecting address=smtps://192.168.1.10:465 host=192.168.1.10
mta error reason=IO Error: Connection refused
smtp-out: Disabling route [] <-> 192.168.1.10 (192.168.1.10) for 15s
However I have nothing on the host's /var/log/mailog. But a
telnet 192.168.1.10 25
seems to be good:
Code:
Trying 192.168.1.10...
Connected to 192.168.1.10.
Escape character is '^]'.
On the host, a
sockstat -l|grep 25
returns this:
Code:
_smtpd smtpd 19082 11 tcp4 192.168.1.10:25 *:*
_smtpd smtpd 19082 12 tcp4 192.168.1.201:25 *:*
On the jail:
Code:
_smtpd smtpd 19179 9 tcp4 192.168.1.201:25 *:*
Any ideas? I'd like to send emails from the jail, through the OpenSMTPd installed on the host. What did I mess? Maybe a better solution? I'm open.
Thanks a lot in advance.
Regards,