pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: [PHP] authentication question
6+ messages / 4 participants
[nested] [flat]
* authentication question
@ 2003-08-07 05:47 Cath Lawrence <Cath.Lawrence@anu.edu.au>
2003-08-07 03:12 ` Re: [PHP] authentication question Robby Russell <rrussell@commandprompt.com>
0 siblings, 1 reply; 6+ messages in thread
From: Cath Lawrence @ 2003-08-07 05:47 UTC (permalink / raw)
To: pgsql-novice@postgresql.org; pgsql-php
Hi,
Not sure if this is a novice or a PHP question; so I sent it to both.
Anyway, I can't seem to deny access to my database through the web
server/PHP connection...
In my pg_hba.conf, at the top, before getting to the real databases, I
have:
# temporary, cath testing access on example
local temp all reject
host temp all 127.0.0.1 255.255.255.255 reject
host temp all 0.0.0.0 255.255.255.255 reject
Command line psql won't let me connect to temp - so far so good.
But when I use PHP's pg_connect with host, dbname, username, password
specified, it lets me through. It does fail non-users or bad passwords
- but all existing postgresql users seem to be able to make the
connection regardless.
What have I missed? Ultimately, I am trying to set this up so only
specific known users can connect to my database from particular hosts.
thanks for any help,
regards
Cath
Cath Lawrence, Cath.Lawrence@anu.edu.au
Senior Scientific Programmer, Centre for Bioinformation Science,
John Curtin School of Medical Research (room 4088)
Australian National University, Canberra ACT 0200
ph: (02) 61257959 mobile: 0421-902694 fax: (02) 61252595
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [PHP] authentication question
2003-08-07 05:47 authentication question Cath Lawrence <Cath.Lawrence@anu.edu.au>
@ 2003-08-07 03:12 ` Robby Russell <rrussell@commandprompt.com>
2003-08-07 06:27 ` Re: [PHP] authentication question Cath Lawrence <Cath.Lawrence@anu.edu.au>
2003-08-07 14:04 ` Re: [PHP] authentication question Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 6+ messages in thread
From: Robby Russell @ 2003-08-07 03:12 UTC (permalink / raw)
To: Cath Lawrence <Cath.Lawrence@anu.edu.au>; +Cc: pgsql-novice@postgresql.org; pgsql-php
Cath Lawrence wrote:
> Hi,
>
> Not sure if this is a novice or a PHP question; so I sent it to both.
>
> Anyway, I can't seem to deny access to my database through the web
> server/PHP connection...
>
> In my pg_hba.conf, at the top, before getting to the real databases,
> I have:
> # temporary, cath testing access on example
> local temp all reject
> host temp all 127.0.0.1 255.255.255.255 reject
> host temp all 0.0.0.0 255.255.255.255 reject
>
> Command line psql won't let me connect to temp - so far so good.
> But when I use PHP's pg_connect with host, dbname, username, password
> specified, it lets me through. It does fail non-users or bad passwords
> - but all existing postgresql users seem to be able to make the
> connection regardless.
>
> What have I missed? Ultimately, I am trying to set this up so only
> specific known users can connect to my database from particular hosts.
Cath,
I'm not sure if this will help you or not, but try adding this to the
bottom (seen this as a common practice)
# reject all connections from all hosts not granted above
host all 0.0.0.0 0.0.0.0 reject
-Robby
--
Robby Russell, Sr. Administrator / Lead Programmer
Command Prompt, Inc.
rrussell@commandprompt.com
http://www.commandprompt.com (503) 222.2783
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [PHP] authentication question
2003-08-07 05:47 authentication question Cath Lawrence <Cath.Lawrence@anu.edu.au>
2003-08-07 03:12 ` Re: [PHP] authentication question Robby Russell <rrussell@commandprompt.com>
@ 2003-08-07 06:27 ` Cath Lawrence <Cath.Lawrence@anu.edu.au>
2003-08-07 03:37 ` Re: authentication question Robby Russell <rrussell@commandprompt.com>
2003-08-07 06:39 ` Re: [PHP] authentication question Christopher Kings-Lynne <chriskl@familyhealth.com.au>
1 sibling, 2 replies; 6+ messages in thread
From: Cath Lawrence @ 2003-08-07 06:27 UTC (permalink / raw)
To: pgsql-php; pgsql-novice@postgresql.org
On Thursday, August 7, 2003, at 01:12 PM, Robby Russell wrote:
> Cath Lawrence wrote:
> I'm not sure if this will help you or not, but try adding this to the
> bottom (seen this as a common practice)
> # reject all connections from all hosts not granted above
> host all 0.0.0.0 0.0.0.0 reject
D'oh! That does it. Thanks Robby.
Blindly copy'n'paste-ing a line with the wrong netmask did NOT help!
But while I'm here - how does PHP connect? If rejecting connections
from the local machine and from 127.0.0.1 didn't do the trick, why not?
(Or is that getting into network issues and I needed the host's IP
address?)
thanks again
Cath
Cath Lawrence, Cath.Lawrence@anu.edu.au
Senior Scientific Programmer, Centre for Bioinformation Science,
John Curtin School of Medical Research (room 4088)
Australian National University, Canberra ACT 0200
ph: (02) 61257959 mobile: 0421-902694 fax: (02) 61252595
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: authentication question
2003-08-07 05:47 authentication question Cath Lawrence <Cath.Lawrence@anu.edu.au>
2003-08-07 03:12 ` Re: [PHP] authentication question Robby Russell <rrussell@commandprompt.com>
2003-08-07 06:27 ` Re: [PHP] authentication question Cath Lawrence <Cath.Lawrence@anu.edu.au>
@ 2003-08-07 03:37 ` Robby Russell <rrussell@commandprompt.com>
1 sibling, 0 replies; 6+ messages in thread
From: Robby Russell @ 2003-08-07 03:37 UTC (permalink / raw)
To: Cath Lawrence <Cath.Lawrence@anu.edu.au>; +Cc: pgsql-php
Cath Lawrence wrote:
> On Thursday, August 7, 2003, at 01:12 PM, Robby Russell wrote:
>
>> Cath Lawrence wrote:
>> I'm not sure if this will help you or not, but try adding this to the
>> bottom (seen this as a common practice)
>> # reject all connections from all hosts not granted above
>> host all 0.0.0.0 0.0.0.0 reject
>
>
> D'oh! That does it. Thanks Robby.
> Blindly copy'n'paste-ing a line with the wrong netmask did NOT help!
>
> But while I'm here - how does PHP connect? If rejecting connections
> from the local machine and from 127.0.0.1 didn't do the trick, why
> not? (Or is that getting into network issues and I needed the host's
> IP address?)
Cath,
It depends, is the php (on apache I assume) running on the same machine?
If it is, than usually rejecting 127.0.0.1 will do the trick (given that
the /etc/hosts file has an entry for localhost). If it's a remote
connection, than you will need to look at all your configuration
settings to try and determine this issue.
Glad that other bit of info helped though.
--
Robby Russell, | Sr. Administrator / Lead Programmer
Command Prompt, Inc. | http://www.commandprompt.com
rrussell@commandprompt.com | Telephone: (503) 222.2783
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [PHP] authentication question
2003-08-07 05:47 authentication question Cath Lawrence <Cath.Lawrence@anu.edu.au>
2003-08-07 03:12 ` Re: [PHP] authentication question Robby Russell <rrussell@commandprompt.com>
2003-08-07 06:27 ` Re: [PHP] authentication question Cath Lawrence <Cath.Lawrence@anu.edu.au>
@ 2003-08-07 06:39 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
1 sibling, 0 replies; 6+ messages in thread
From: Christopher Kings-Lynne @ 2003-08-07 06:39 UTC (permalink / raw)
To: Cath Lawrence <Cath.Lawrence@anu.edu.au>; pgsql-php; pgsql-novice@postgresql.org
> But while I'm here - how does PHP connect? If rejecting connections
> from the local machine and from 127.0.0.1 didn't do the trick, why not?
> (Or is that getting into network issues and I needed the host's IP
> address?)
PHP is probably using a Unix domain socket (eg. /tmp/pgsql.1321 or
something), and not using an actual TCP/IP connection.
Chris
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [PHP] authentication question
2003-08-07 05:47 authentication question Cath Lawrence <Cath.Lawrence@anu.edu.au>
2003-08-07 03:12 ` Re: [PHP] authentication question Robby Russell <rrussell@commandprompt.com>
@ 2003-08-07 14:04 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 6+ messages in thread
From: Tom Lane @ 2003-08-07 14:04 UTC (permalink / raw)
To: Robby Russell <rrussell@commandprompt.com>; +Cc: Cath Lawrence <Cath.Lawrence@anu.edu.au>; pgsql-novice@postgresql.org; pgsql-php
Robby Russell <rrussell@commandprompt.com> writes:
> I'm not sure if this will help you or not, but try adding this to the
> bottom (seen this as a common practice)
> # reject all connections from all hosts not granted above
> host all 0.0.0.0 0.0.0.0 reject
This is unnecessary --- if the postmaster falls off the end of the file
without a match, it defaults to "reject". Nothing wrong with having
such a line for documentation purposes, but it shouldn't change the
behavior one bit.
My guess about Cath's original problem is that the lines she showed us
only controlled attempted connections to the "temp" database ... not to
any other database. If she had more lines later in the file, those
would be consulted for any connection to a database not named "temp".
Another common mistake (been burnt this way more than once) is to forget
to SIGHUP the postmaster (eg, pg_ctl reload) after editing the config
file. You can get *really* confused if you are trying different things
and sometimes you remember to SIGHUP and sometimes you don't.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2003-08-07 14:04 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-08-07 05:47 authentication question Cath Lawrence <Cath.Lawrence@anu.edu.au>
2003-08-07 03:12 ` Robby Russell <rrussell@commandprompt.com>
2003-08-07 06:27 ` Cath Lawrence <Cath.Lawrence@anu.edu.au>
2003-08-07 03:37 ` Robby Russell <rrussell@commandprompt.com>
2003-08-07 06:39 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2003-08-07 14:04 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox