pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: Creating md5 passwords in PHP for the PostgreSQL pg_shadow table
5+ messages / 2 participants
[nested] [flat]

* Re: Creating md5 passwords in PHP for the PostgreSQL pg_shadow table
@ 1970-01-01 00:00  Fery@mik.co.id
  0 siblings, 1 reply; 5+ messages in thread

From: Fery@mik.co.id @ 1970-01-01 00:00 UTC (permalink / raw)
  To: Matthew Horoschun <mhoroschun@canprint.com.au>; +Cc: busby@pnts.com; pgsql-php; pgsql-php-owner@postgresql.org


Dear All,

When I do CREATE USER [user] WITH PASSWORD 'password'
why the encryption didn't work ? I saw in the pg_shadow table look like as
i set the password ?

SELECT * FROM PG_SHADOW

in password field will shown : 'password' ??????

Is there any way to activate md5 encryption in PostgreSQL ? or It was done
by compiling it when first installation ????

thankss

Best Regards,
Fery Gideon
IT Specialist
PT. Mitra Integrasi Komputindo
ASPAC Kuningan - 8th floor, Suite 805
Jl. H.R. Rasuna Said Kav. X-2 No. 4, Jakarta 12950
Phone: (62-21) 522-8322(ext 102), Fax: (62-21) 522-8321
e-mail: fery@mik.co.id


                                                                                                                          
                    Matthew Horoschun                                                                                     
                    <mhoroschun@canprint        To:     "David Busby" <busby@pnts.com>                                    
                    .com.au>                    cc:     pgsql-php@postgresql.org                                          
                    Sent by:                    Subject:     Re: [PHP] Creating md5 passwords in PHP for the PostgreSQL   
                    pgsql-php-owner@post        pg_shadow table                                                           
                    gresql.org                                                                                            
                                                                                                                          
                                                                                                                          
                    01/21/2003 05:10 AM                                                                                   
                                                                                                                          
                                                                                                                          




Hi David,

Thanks for the reply.

Unfortunately, thats not quite the problem. I want to create passwords
that will work in the pg_shadow table. So, I need them to be calculated
in exactly the same way PostgreSQL does when you do a CREATE USER
matthew WITH PASSWORD testing.

For example, If I create a user in PostgreSQL called 'matthew' with
password 'testing', I get pg_shadow entry with passwd:

md5759af56ffaf865413f7a50b4fae20ea3

but, if I do a simple md5 of 'testing' like you've done below, I get:

ae2b1fca515949e5d54fb22b8ed95575

As you can see, those don't match.

Perhaps I'm missing something though?

Cheers

Matthew.

On Tuesday, January 21, 2003, at 05:27  AM, David Busby wrote:

> Matthew,
>     I just use something like
>     $pass = $_POST['pass'];
>     $e_pass = md5($passs);
>     Maybe not as secure as two md5s, but have you ever tried to
> reverse one
> md5 checksum?



--
Matthew Horoschun
Network Administrator
CanPrint Communications Pty. Ltd.

Mobile:                   0417 282 378
Direct:                   (02) 6295 4544
Telephone:           (02) 6295 4422
Facsimile:           (02) 6295 4473


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)







^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Creating md5 passwords in PHP for the PostgreSQL pg_shadow table
@ 2003-01-20 11:37  Matthew Horoschun <mhoroschun@canprint.com.au>
  0 siblings, 0 replies; 5+ messages in thread

From: Matthew Horoschun @ 2003-01-20 11:37 UTC (permalink / raw)
  To: pgsql-php

Hi All,

I want to be able to allow non-superusers the ability to create other 
PostgreSQL users in limited circumstances. My plan was to create a 
dummy table with rules that actually made changes to the pg_shadow 
table.

Therefore I need to be able to create password entries in the pg_shadow 
table. From browsing the code and the mailing lists I'm pretty certain 
I need to do the following in PHP to create a MD5 password for 
PostgreSQL:

$passwd = "md5" . md5( md5( $password . $username ) . $salt );

Has anybody done this before? Is this the right way to get the md5?... 
and if so... how do I get PostgreSQL to give me the salt?

Thanks in advance for any assistance!

Cheers

Matthew.

--
Matthew Horoschun
Network Administrator
CanPrint Communications Pty. Ltd.

Mobile:		0417 282 378
Direct:		(02) 6295 4544
Telephone:	(02) 6295 4422
Facsimile: 	(02) 6295 4473




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Creating md5 passwords in PHP for the PostgreSQL pg_shadow table
@ 2003-01-20 22:10  Matthew Horoschun <mhoroschun@canprint.com.au>
  0 siblings, 0 replies; 5+ messages in thread

From: Matthew Horoschun @ 2003-01-20 22:10 UTC (permalink / raw)
  To: David Busby <busby@pnts.com>; +Cc: pgsql-php

Hi David,

Thanks for the reply.

Unfortunately, thats not quite the problem. I want to create passwords 
that will work in the pg_shadow table. So, I need them to be calculated 
in exactly the same way PostgreSQL does when you do a CREATE USER 
matthew WITH PASSWORD testing.

For example, If I create a user in PostgreSQL called 'matthew' with 
password 'testing', I get pg_shadow entry with passwd:

md5759af56ffaf865413f7a50b4fae20ea3

but, if I do a simple md5 of 'testing' like you've done below, I get:

ae2b1fca515949e5d54fb22b8ed95575

As you can see, those don't match.

Perhaps I'm missing something though?

Cheers

Matthew.

On Tuesday, January 21, 2003, at 05:27  AM, David Busby wrote:

> Matthew,
>     I just use something like
>     $pass = $_POST['pass'];
>     $e_pass = md5($passs);
>     Maybe not as secure as two md5s, but have you ever tried to 
> reverse one
> md5 checksum?



--
Matthew Horoschun
Network Administrator
CanPrint Communications Pty. Ltd.

Mobile:		0417 282 378
Direct:		(02) 6295 4544
Telephone:	(02) 6295 4422
Facsimile: 	(02) 6295 4473




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Fwd: Creating md5 passwords in PHP for the PostgreSQL pg_shadow table
@ 2003-01-21 00:14  Matthew Horoschun <mhoroschun@canprint.com.au>
  0 siblings, 0 replies; 5+ messages in thread

From: Matthew Horoschun @ 2003-01-21 00:14 UTC (permalink / raw)
  To: pgsql-php

Hi All,

I've figured this out myself... but I thought I might just let the list 
archives know so that others don't need to work it out for themselves.

To create a md5 password suitable for use in the PostgreSQL pg_shadow 
table:

$md5_passwd = 'md5' . md5( $password . $username );

The username acts as salt.


Matthew.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Creating md5 passwords in PHP for the PostgreSQL pg_shadow table
@ 2003-01-21 03:30  Matthew Horoschun <mhoroschun@canprint.com.au>
  parent: Fery@mik.co.id
  0 siblings, 0 replies; 5+ messages in thread

From: Matthew Horoschun @ 2003-01-21 03:30 UTC (permalink / raw)
  To: Fery@mik.co.id; +Cc: pgsql-php

Hi Fery,

Try

password_encryption = true

in postgresql.conf

(In my build it appears to be on by default).


Matthew.

On Wednesday, January 22, 2003, at 01:51  PM, Fery@mik.co.id wrote:
> Is there any way to activate md5 encryption in PostgreSQL ? or It was 
> done
> by compiling it when first installation ????




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2003-01-21 03:30 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1970-01-01 00:00 Re: Creating md5 passwords in PHP for the PostgreSQL pg_shadow table Fery@mik.co.id
2003-01-21 03:30 ` Matthew Horoschun <mhoroschun@canprint.com.au>
2003-01-20 11:37 Creating md5 passwords in PHP for the PostgreSQL pg_shadow table Matthew Horoschun <mhoroschun@canprint.com.au>
2003-01-20 22:10 Re: Creating md5 passwords in PHP for the PostgreSQL pg_shadow table Matthew Horoschun <mhoroschun@canprint.com.au>
2003-01-21 00:14 Fwd: Creating md5 passwords in PHP for the PostgreSQL pg_shadow table Matthew Horoschun <mhoroschun@canprint.com.au>

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