LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   postfix relay problem (https://www.linuxquestions.org/questions/linux-newbie-8/postfix-relay-problem-288244/)

smurfix 02-18-2005 02:28 AM

Hey Tommy ... did that ... and followed your instructions to build the 2 lookup files: smurphy.db and rev.192 and have referenced them in named.conf. I have added them here, I don't have static IPs for my internal machines at the minute so haven't added the entries, not sure if that will be necessary, can certainly do so if need be :

"smurphy.db"
$TTL 604800
@ IN SOA domain.org. adminemail.domain.com (
10800 ; Refresh every 30 minutes
1800 ; retry every 30 minute
1209600 ; Expire in 2 weeks
604800 ) ; Minimum 1 week
IN NS 193.189.244.197 ; DNS server used by my router
IN MX 10 mail.domain.org
IN A 192.168.4.1 ; internet gateway
lobo IN A 82.82.82.82 ; debian box [actually DSL public IP]

"rev.192"
$TTL 604800
@ IN SOA 4.168.192.in-addr.arpa.admin.domain.org (
10800 ; refreah every 3 hours
1800 ; retry every 30 mins
604800 ; minmum 1 week
IN NS 193.189.244.197
IN MX 10 mail.domain.org

"named.conf" - lines left out to save space but above this is the standard default file settings

// add entries for other zones below here

zone "domain.org" {
type master;
file "smurphy.db";
};

zone "4.168.192.in-addr-arpa" {
type master;
file "192.rev";
};

Following the ps -C named command - even after issuing "/etc/init.d/bind9 start" named does not appear in the process list and there is nothing with named when I do ps ax, although there is no error when the start command is sent.

Thanks
Steve

newtommy 02-18-2005 12:31 PM

Getting there - A couple more things I have noticed here:

1) you will have to associate your mailserver IP with its 'mail.domain.com' in your lookup this is because your mail clients will actually access the DNS entry to 'resolve' the IP for mail.domain.com as 192.168.x.x and then communicate with that. So Modify in smurphy.db:

IN MX 10 mail.domain.org. ; which is good you have that already
IN NS ns2.domain.org. ; This is the DNS your are setting up
linuxbox IN A 192.168.x.x; internal IP address of your linux box (need to set this)
mail IN CNAME linuxbox ; here you say the IP of your mail.domain.org is same as your linuxbox
ns2 IN CNAME linuxbox ; here you say your DNS is also running on your linux box's IP

Notes: Of course replace 'linuxbox' with the name of your linux machine. You need to have at least a local static IP configured on your linux box, becuase what's going to happen here is you will add your linux box IP to your list of DNS servers on the other (nonlinux) machines you're using in your network, so they can use the DNS service you just set up. if that IP changes they won't be able to find this DNS service make sense? What this lets them do is use the lookup table we just made to resolve any entry ie. mail.domain.org to its IP address which is 192.168.x.x (fill in the x's) and find your server.

2) check to make sure you have modified the line in named.conf that reads something like this:
options {
directory "/var/lib/named"

you need to make sure this points to the directory you stored smurphy.db in so that when named loads its config file it can find the .db file you made


3) if named is not finding your .db or .rev files or if you have a typo in any of the config files, named will exit immediately when you try to start it. So it won't run. When you do a ps -C named and don't see it running after you called it you should check it's log file to see what it's complaining about. That will help you run down the last couple typo's etc. you have. It can be an iterative process. fix your named.conf and .db files and try to start named. if it isn't running - check your log files and see what its complaining about. (you can post here if you want) fix that and wash, rinse, repeat.


4) oh you also need to change domain.org (if you havn't already) to whatever your qualified domain name is.

I'll be checking today to see how it goes. Good luck!

smurfix 02-18-2005 02:37 PM

Lobo [the mail server] does have a static IP - 192.168.4.10, but this is the only machine that does.

1. I've made the changes to smurphy.db and hope they are correct:

$TTL 604800
@ IN SOA domain.org. postmaster.domain.org (
200518021 : serial number
10800 ; Refresh every 30 minutes
1800 ; retry every 30 minute
1209600 ; Expire in 2 weeks
604800 ) ; Minimum 1 week

IN MX 10 mail.domain.org.


;Name Servers
IN A 192.168.4.1 ; internet gateway
IN NS ns2.domain.org. ;

; Addresses for canonical names
localhost IN A 127.0.0.1
gateway IN A 192.168.4.1
lobo IN A 192.168.4.10

;Aliases
mail IN CNAME lobo
ns2 IN CNAME lobo

2. I have checked my named.conf and all is in order:

options {
directory "/var/lib/named"

3. errors in /var/log/syslog when I start bind with /etc/init.d/bind9 start are below:

Feb 18 20:24:26 lobo named[384]: starting BIND 9.2.1 -u nobody -t /var/lib/named
Feb 18 20:24:26 lobo named[384]: using 1 CPU
Feb 18 20:24:26 lobo named[386]: loading configuration from '/etc/bind/named.conf'
Feb 18 20:24:26 lobo named[386]: /etc/bind/named.conf:9: change directory to '/var/lib/named' failed: file not found
Feb 18 20:24:26 lobo named[386]: /etc/bind/named.conf:9: parsing failed
Feb 18 20:24:26 lobo named[386]: loading configuration: file not found
Feb 18 20:24:26 lobo named[386]: exiting (due to fatal error)

I have tried copying named.conf to /var/lib/named but that didn't seem to make any difference.

4. domain.org is amended in the life file on the server to be the correct domain name.

Do the errors in the logs give any clues to where the problem lies ?

Thanks
Steve

newtommy 02-18-2005 03:07 PM

Yes,

Looking at your log -- its loading your named.conf file and it can't locate the directory /var/lib/named which is where your .db files are. you can fix this two ways i think.

you could specify an absolute path to your db files and remove the directory element

zone "domain.org" {
type master;
file "/var/lib/named/smurphy.db";
};

zone "4.168.192.in-addr-arpa" {
type master;
file "/var/lib/named/192.rev";
};

try that

or the other possible issue I can see with that error log is maybe you don't have permissions set right for 'named' to access this directory? you could try leaving everything as is and chown nobody /var/lib/named and the two db files..... since it looks like you're running named as nobody?

Let me know if either of these fix your error log or change it?

newtommy 02-18-2005 03:20 PM

Oh,

one other thing in addition to what i just posted - its looking for named.conf in /etc/bind/named.conf, and I've been talking about having named.conf in your /etc directory -- for your implementation you should have named.conf in your /etc/bind directory insted.

smurfix 02-18-2005 04:23 PM

Oh dear ... I've tried all that and still no joy .. same error as before.

any other ideas ?

Thanks
Steve

smurfix 02-18-2005 05:22 PM

hey .. wouldn't you believe it. Been having some problems with the HDD aswell the last couple of days and about 30 mins ago .. it's dead as a doornail. So I guess it's back to the drawing board for now, someone will get some cash outta me for a new harddrive tomorrow.

As I will be installing fresh, are there any suggestions as to best or easiest to configure distros. I'm pretty easy about what to use and chose Debian as I'd never used it before. It was OK but will just as easy go for something else. I've touched on RedHat and Fedora in the past but am open to suggestions. Anyone got any suggestions !!?

Thanks for all your help over the last few days Tommy !

Off for now !

Steve

newtommy 02-18-2005 08:10 PM

LOL,

And we were so close man! Well what you gonna do anyways -- hey I really like SuSE, I had used Mandrake before but SuSE is even easier and more comprehensive. Personally I was really impressed and so I do recommend.

Not really a Fedora fan (although you will find that's a personal opinion) We tried to use it for some development work and it wasn't very friendly to our hardware.

Feel free to write again - I like to debug especially topics I know pretty well in Linux!

Have a great weekend.

Tommy

smurfix 02-19-2005 04:32 PM

Well, I'm back up and running .. Installed a new shiny 40Gb HDD, re-installed Debian [including named from the install packages this time - and named is in the process listing - whoopee].

I think this is an easier problem now. I recreated the smurphy.db and 192.rev files and when I restart bind "/etc/init.d/bind9 restart" I get the error below. Now I think there is a syntax error in 192.rev at line 6 but I have tried moving the ")" to the line below but that doesn't seem to make any difference. /var/lib/named/192.rev looks like this [where domain = my proper domainname]

$TTL 604800
@ IN SOA 4.168.192.in-addr.arpa.admin.domain.org (
200502180 ; serial number
10800 ; refresh every 3 hours
1800 ; retry every 30 mins
604800 ) ; minimum 1 week

;Addresses point to canonical names

1 IN PTR mail.domain.org.

/var/log/syslog looks like this after I issue /etc/init.d/bind9 restart:

Feb 19 22:22:15 lobo named[6829]: dns_rdata_fromtext: 192.rev:6: near eol: unexpected end of input
Feb 19 22:22:15 lobo named[6829]: zone 4.168.192.in-addr-arpa/IN: loading master file 192.rev: unexpected end of input
Feb 19 22:22:15 lobo named[6829]: zone localhost/IN: loaded serial 1
Feb 19 22:22:15 lobo named[6829]: zone domain.org/IN: loaded serial 200518021
Feb 19 22:22:15 lobo named[6829]: running

Any help is, as always, much appreciated !

Thanks
Steve

newtommy 02-21-2005 03:52 PM

I found your error!

You need a space between 4.168.192.in-addr. and admin.domain.org.

That should do it!! Let me know if it works!

Thanks
Tommy

smurfix 02-21-2005 06:19 PM

Hey,

I'm pretty sure these are right now - don't get the errors I was getting before when restarting bind9 and named starts correctly:

rev.192 [was missing line 6 completely]
$TTL 604800
@ IN SOA 4.168.192.in-addr-arpa. admin.domain.org. (
200521023 ; serial number
10800 ; refresh every 3 hours
1800 ; retry every 30 mins
1209600 ; expire in 2 weeks
604800 ; minmum 1 week
)

;Name Servers
IN A 192.168.4.1 ; internet gateway
IN NS ns2.domain.org. ;


;Addresses point to canonical names

1 IN PTR mail.domain.org.

smurphy.db
$TTL 604800
@ IN SOA domain.org. postmaster.domain.org (
200521022 ; serial number
10800 ; Refresh every 30 minutes
1800 ; retry every 30 minute
1209600 ; Expire in 2 weeks
604800 ) ; Minimum 1 week

IN MX 10 mail.domain.org.


;Name Servers
IN A 192.168.4.1 ; internet gateway
IN NS ns2.domain.org. ;

; Addresses for canonical names
localhost IN A 127.0.0.1
gateway IN A 192.168.4.1
lobo IN A 192.168.4.10

;Aliases
mail IN CNAME lobo
ns2 IN CNAME lobo


but getting this deferred error now when trying to send mail from command line [domain in the following is an external domain]:

Feb 22 00:05:20 lobo postfix/qmgr[7415]: A1786425EF3: from=<root@domain.org>, size=299, nrcpt=1 (queue active)
Feb 22 00:05:20 lobo postfix/qmgr[7415]: A1786425EF3: to=<username@domain.com>, relay=none, delay=0, status=deferred (Name service error for domain.com: Host not found, try again)

and when I try to send mail from within Thunderbird I get this error:

Feb 22 00:07:59 lobo postfix/smtpd[8042]: warning: restriction `permit_sasl_authenticated' ignored: no SASL support
Feb 22 00:08:00 lobo postfix/smtpd[8042]: BE630425EF4: client=unknown[192.168.4.2]
Feb 22 00:08:00 lobo postfix/smtpd[8042]: warning: restriction `permit_sasl_authenticated' ignored: no SASL support

here is my main.cf:

# see /usr/share/postfix/main.cf.dist for a commented, fuller
# version of this file.

# Do not change these directory settings - they are critical to Postfix
# operation.
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
program_directory = /usr/lib/postfix

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
setgid_group = postdrop
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = yes
myhostname = lobo.domain.org
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydomain = domain.org
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, $mydomain, mail.$mydomain
relayhost =
relay_domain = 127.0.0.1
mynetworks = 127.0.0.0/8, 192.168.4.0/24
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mail_owner = postfix
recipient_delimiter = +
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
mailbox_transport = cyrus
mailbox_size_limit = 0
recipient_delimiter = +
empty_address_recipient = MAILER-DAEMON
message_size_limit = 33554432
bounce_size_limit = 65536
header_size_limit = 32768
smtpd_recipient_limit = 128
smtpd_timeout = 180
readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
html_directory = no
manpage_directory = /usr/man
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
queue_directory = /var/spool/postfix
unknown_local_recipient_reject_code = 450
smtpd_sasl_auth_enable = yes
#header_checks = regexp:/usr/local/etc/postfix/header_checks
#body_checks = regexp:/usr/local/etc/postfix/body_checks

what do you reckon ? ;-)

Steve

newtommy 02-22-2005 10:56 PM

Hi, Sorry It took a while here

So two questions about the problem you're having -- (oh and by the way congrats on getting named to run!). So I can understand -- the first error you document <username@domain.org> is an external person you're trying to mail to?

I would check to make sure you have the "caching" zone setup in your DNS -- I skip over that one entry because it is already configured in SuSE and I think when you were installing BIND the instructions you were following instructed you to create it in your config files for named. Anyway - what the caching zone does is essentially mimic everything else that's out there outside of your box - if you have something wrong with that I guess it could be causing this problem. check your named.conf for the following:

zone "." in {
type hint;
file "root.hint";
};


Second, so looking at your main.cf (and I am not a postfix pro by any means) it looks like you are requiring that anyone who uses your system is SASL authenticated Hence the line in your Main.cf: (this is probably a good thing, but looking at how your email client is complaining I suggest the following line might be the problem, try deleting it and see what happens)

smtpd_sasl_auth_enable = yes

Now that could be doing something totally different and I could be all wrong about that --- It also looks like you have IMAP setup and are using Cyrus as your mail Transport. I'm doing the same. Now my main.cf is nowhere near great but it does work. you might want to try it out or look at the differences. You can find it Here:

http://www.bostonst.com/cgi-bin/Linu...6387;start=0#1

its on the first reply below the initial write-up about squirrel mail.

Got my fingers crossed.

Tommy


All times are GMT -5. The time now is 05:08 AM.