# postfix help



## Business_Woman (Jan 13, 2010)

Hi,

Im trying to setup postfix, i've followed the basic steps on as described on postfix.org. But trying to telnet to localhost:25 yields no respone what so ever.

Does it matter how the systems domain name is set?
As of current i have it set in rc.conf as hostname.domainname.tld

Issuing 
	
	



```
domainname
```
, or 
	
	



```
sysctl -a | grep domain
```

Shows nothing.

Should i disable SASL and TLS until i got the basics working? 

Here is the output of postconf -n

```
alias_database = db:/etc/mail/aliases
alias_maps = hash:/etc/mail/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/local/sbin
config_directory = /usr/local/etc/postfix
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix
debug_peer_level = 2
home_mailbox = Mailbox
html_directory = /usr/local/share/doc/postfix
inet_interfaces = all
mail_owner = postfix
mailbox_command = /usr/local/bin/procmail
mailq_path = /usr/local/bin/mailq
manpage_directory = /usr/local/man
mydestination = $mydomain, localhost.$mydomain, localhost
mydomain = thedomainname.tld
myhostname = [mydomainname]
myorigin = $mydomain
newaliases_path = /usr/local/bin/newaliases
proxy_interfaces = 192.168.1.50
queue_directory = /var/spool/postfix
readme_directory = /usr/local/share/doc/postfix
relayhost = [smtprelay1.telia.com]:25
sample_directory = /usr/local/etc/postfix
sendmail_path = /usr/local/sbin/sendmail
setgid_group = maildrop
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/usr/local/etc/sasldb2
smtp_sasl_path = smtpd
smtp_tls_note_starttls_offer = yes
smtp_use_tls = yes
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks
smtpd_tls_CAfile = /etc/postfix/ssl/smtpd.pem
smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.pem
smtpd_tls_key_file = /etc/postfix/ssl/smtpd.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550 mynetworks = 192.168.1.0/24 127.0.0.0/8
```


----------



## plamaiziere (Jan 13, 2010)

Business_Woman said:
			
		

> Hi,
> 
> Im trying to setup postfix, i've followed the basic steps on as described on postfix.org. But trying to telnet to localhost:25 yields no respone what so ever.



Check the log (/var/log/maillog). Postfix is quite verbose.


----------



## Ruler2112 (Jan 13, 2010)

Logs are definitely the first place to check.

However, one thing that I noticed just doing a cursory look at your config is that mynetworks isn't set.  This should be set to at least 127.0.0.1, reload postfix, and then try telneting to port 25 from the console.

Another thing to check is your firewall - it may be blocking connections on port 25.


----------



## Ruler2112 (Jan 13, 2010)

Nevermind my comment about mynetworks - saw it on the last line of your output next to another line.  (Guessing that the formatting got screwed up when pasted onto the forum?)


----------



## J65nko (Jan 13, 2010)

Are the postfix processes running?
	
	



```
# ps -aux | grep postfix
root        717  0.0  0.3  3328  1536  ??  Ss    9:27PM   0:00.02 /usr/local/libexec/postfix/master
postfix     720  0.0  0.3  3328  1540  ??  S     9:27PM   0:00.01 pickup -l -t fifo -u
postfix     721  0.0  0.3  3328  1556  ??  S     9:27PM   0:00.01 qmgr -l -t fifo -u
postfix     839  0.0  0.3  3328  1540  ??  I     9:30PM   0:00.01 anvil -l -t unix -u
```

Is something LISTENing on port 25?

```
# netstat -an -f inet

Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp4       0     48 192.168.222.244.2022   192.168.222.20.33443   ESTABLISHED
tcp4       0      0 *.2022                 *.*                    LISTEN
tcp4       0      0 *.*                    *.*                    CLOSED
tcp46      0      0 *.80                   *.*                    LISTEN
[color=blue]tcp4       0      0 *.25                   *.*[/color]                    LISTEN
tcp4       0      0 192.168.222.244.53     *.*                    LISTEN
udp4       0      0 192.168.222.244.53     *.*                    
udp4       0      0 *.514                  *.*
```

The telnet test
	
	



```
$ telnet vintrax.utp.xnet 25
Trying 192.168.222.244...
Connected to vintrax.utp.xnet.
Escape character is '^]'.
220 vintrax.utp.xnet ESMTP Postfix
quit
221 2.0.0 Bye
Connection closed by foreign host.
```

And remember that without a properly configured DNS not anybody on the Internet can send mail to your server.
Not having a hostname for the postfix box, and probably not resolvable in DNS does not seem to be a promising start 

At least mine resolves in my local LAN


----------



## Alt (Jan 14, 2010)

First to check - which port he is listening:

```
sockstat -lnp 25
```
Second - check its running at all

```
pgrep -fl postfix
```


----------



## Business_Woman (Jan 14, 2010)

Hi,

Here are some output from ps and netstat


```
ps -aux | grep postfix
postfix  1008  0.0  0.5  5312  2380  ??  I     7:50PM   0:00.02 pickup -l -t fi
postfix  1009  0.0  0.5  5312  2412  ??  I     7:50PM   0:00.02 qmgr -l -t fifo
```



```
netstat -an -f inet
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp4       0     52 192.168.1.50.2200      192.168.1.38.1219      ESTABLISHED
tcp4       0      0 *.2200                 *.*                    LISTEN
tcp4       0      0 *.10100                *.*                    LISTEN
tcp4       0      0 *.10143                *.*                    LISTEN
tcp4       0      0 *.25                   *.*                    LISTEN
```

So it seems like it is listening, but all i get when i try a telnet to localhost on port 25 is

```
telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
```

_Edit_ Oops, in /var/log/messages i found this:

```
parameter "smtpd_recipient_restrictions": specify at least one working instance of: check_relay_domains, reject_unauth_destination, reject, defer or defer_if_permit
```


----------



## plamaiziere (Jan 14, 2010)

Business_Woman said:
			
		

> Hi,
> 
> ```
> parameter "smtpd_recipient_restrictions": specify at least one working instance of: check_relay_domains, reject_unauth_destination, reject, defer or defer_if_permit
> ```



You have to add reject_unauth_destination.


```
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
```


----------



## Business_Woman (Jan 15, 2010)

It seems to be working now. I had two instances of smtpd_recipient_restrictions and that's what caused the fsck up


----------



## Business_Woman (Jan 16, 2010)

By the way, is there a way to test postfix without having dovecot
configured?


----------



## J65nko (Jan 16, 2010)

Yes, of course, just send mail to it.

But without a hostname resolvable in DNS, that is only going to work on the postfix box itself, not from a remote box.So fix the hostname/DNS issue first. 


```
$ echo hello | mail -s 'test' business_woman
```
The mail should turn up in /var/mail. If not check the log files.


----------

