Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 157753 - dev-db/postgresql-8.1.5 ignores listen_address
Summary: dev-db/postgresql-8.1.5 ignores listen_address
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-10 11:53 UTC by Juan
Modified: 2007-09-23 00:15 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juan 2006-12-10 11:53:35 UTC
dev-db/postgresql-8.1.5 appears to be ignoring the parameter listen_address in /var/lib/postgresql/data/postgresql.conf. I have applied both of the following parameters (not simutaneous) but neither work as it should:

listen_addresses = 'localhost' || listen_addresses = '127.0.0.1'

nmap shows PgSQL on my LAN interface (as well as my lo interface):

shadow dracco # nmap -sT shadow
Starting Nmap 4.01 ( http://www.insecure.org/nmap/ ) at 2006-12-10 11:45 PST
Interesting ports on (192.168.4.240):
(The 1656 ports scanned but not shown below are in state: closed)
PORT      STATE SERVICE
21/tcp    open  ftp
22/tcp    open  ssh
25/tcp    open  smtp
53/tcp    open  domain
80/tcp    open  http
139/tcp   open  netbios-ssn
143/tcp   open  imap
199/tcp   open  smux
443/tcp   open  https
445/tcp   open  microsoft-ds
873/tcp   open  rsync
953/tcp   open  rndc
993/tcp   open  imaps
995/tcp   open  pop3s
5432/tcp  open  postgres
10000/tcp open  snet-sensor-mgmt

I am not sure what other information to provide in the situation since PgSQL works otherwise.
Comment 1 Tiziano Müller (RETIRED) gentoo-dev 2006-12-13 00:34:19 UTC
I've just committed new init.d/conf.d files for the versions 8.0 and 8.1 with a revision bump. Could you please update and check again?

It is possible to override the settings in postgresql.conf with commandline arguments. If you for example have "-i" as argument for the postmaster, this overrides listen_adresses with listen_adresses="*".
Comment 2 Juan 2006-12-13 08:40:15 UTC
This revision brought some errors:

I allowed etc-update to override /etc/conf.d/postgresql which I then customized afterwards. I added the following:

PGOPTS="-i -h 127.0.0.1 -p 5432"

nmap still shows postgre listening on both interfaces (lo and eth0)

Additionally, the postgre init script is gives me this error on restart:

shadow dracco # /etc/init.d/postgresql restart
 * Caching service dependencies ...                                                        [ ok ]
 * Stopping PostgreSQL ...
/sbin/start-stop-daemon: invalid schedule item (must be [-]<signal-name>, -<signal-number>, <timeout> or `forever'
Try `/sbin/start-stop-daemon --help' for more information.

I have to zap postgresql before I can start it.
Comment 3 Juan 2006-12-13 08:42:14 UTC
I could have sworn the restart command was 'restart' and not reload. My bad.

So omit my entry regarding this revisions init script.
Comment 4 Juan 2006-12-13 08:45:47 UTC
More info: ps shows postgre running with on -i as the arg with the args I added.

shadow dracco # ps -ef |grep postgre
postgres  5456     1  0 Dec12 ?        00:00:00 /usr/bin/postmaster -D /var/lib/postgresql/data -i
Comment 5 Juan 2006-12-13 08:47:28 UTC
grr. I really with there was a preview function with bugzilla so I don't have to commit a new post to correct my grammar errors...

To grammatically correctly my last entry:

More info: ps shows postgre running with -i as the only arg and without the args I
added in /etc/conf.d/postgresql
Comment 6 Tiziano Müller (RETIRED) gentoo-dev 2006-12-13 10:40:01 UTC
Copy-paste from 'man postmaster' about the switch '-i':

Allows  remote  clients  to  connect  via TCP/IP (Internet domain) connections. Without this option, only local connections are accepted. This option is equivalent to setting listen_addresses to * in postgresql.conf or via -h.
This option is deprecated since it does not allow access to the full functionality of listen_addresses.  It's usually better to set listen_addresses directly.

****************************
About the other thing. This is rather strange since I get here:
postgres  9410     1  3 19:42 ?        00:00:00 /usr/bin/postmaster -D /var/lib/postgresql/data --silent-mode=true -i -h 127.0.0.1 -N 512 -B 1024

with
PGOPTS="-i -h 127.0.0.1 -N 512 -B 1024"
Comment 7 Juan 2006-12-13 11:01:03 UTC
Well, it's becoming stranger. Short of rebooting this server (i don't really want that), I have changed PGOPTS again to:

PGOPTS="-N 1024 -B 2048"

But ps still reports with incorrect command line options passed:

shadow dracco # /etc/init.d/postgresql reload
 * Reloading PostgreSQL configuration ...
No process in pidfile `/var/lib/postgresql/data/postmaster.pid' found running; none killed.                                                         [ ok ]
shadow dracco # ps -ef |grep postmaster
postgres  5456     1  0 Dec12 ?        00:00:00 /usr/bin/postmaster -D /var/lib/postgresql/data -i
root     28006 27657  0 10:49 pts/0    00:00:00 grep --colour=auto postmaster

Need more info? Just let me know. It's a pretty normal PgSQL installation but this issue has always been. It's only recently that I've been required to run SQL on lo interfaces for security reasons bringing me to file a bug report.
Comment 8 Juan 2006-12-13 11:11:30 UTC
Here is an error you probably should know about:

shadow init.d # /etc/init.d/postgresql stop
 * Caching service dependencies ...                                                                                              [ ok ]
 * Stopping PostgreSQL ...
/sbin/start-stop-daemon: invalid schedule item (must be [-]<signal-name>, -<signal-number>, <timeout> or `forever'
Try `/sbin/start-stop-daemon --help' for more information.

So I do have to 'zap' it before starting the service (since 'reload' wasn't working, I tried this).
Comment 9 Juan 2006-12-13 11:25:32 UTC
I figured out the 'stop' issue.

etc-update didn't force me to update /etc/conf.d/postgresql so a couple of new variables were missing. I found these new vars from a file from a new PgSQL install. Adding the vars cured the error regarding the my previous post.
Comment 10 Juan 2006-12-13 11:34:56 UTC
issue 100% solved.

I 'stopped' and 'zapped' (respectively) postgresql, checked one of my webapps that uses this DB to find that it was still able to pull information from the DB.

So I figured it was still in memory but top and ps didn't show it. Did a 'killall postmaster', restarted pgsql and everything is running as it should.

About the -i option.... I apologize but I assumed this was required based on the output of 'postmaster --help'. I did notice that on the new/fresh install, the -i option is gone. Probably a good thing. =)
Comment 11 Tiziano Müller (RETIRED) gentoo-dev 2006-12-13 11:54:56 UTC
Hmm, ok. So I'm resolving this bug as fixed with the latest revision bump. Cheers :-)