Commit Graph

12914 Commits

Author SHA1 Message Date
Dave Cramer fd8b153912 added empty result set testing 2002-06-14 14:01:36 +00:00
Dave Cramer 6e2fab0a41 added empty result set testing 2002-06-14 10:56:13 +00:00
Bruce Momjian 1ed4a922b8 Yet another SSL patch. :-) This one adds some informational messages
on the server, if DebugLvl >= 2.

The patch also includes a late addition to the last patch
(X509_check_private_key()).  I'm not sure why it the currect
revision wasn't tagged.


Bear Giles
2002-06-14 04:38:04 +00:00
Bruce Momjian eb7afc1407 SSL patch that adds support for optional client certificates.
If the user has certificates in $HOME/.postgresql/postgresql.crt
and $HOME/.postgresql/postgresql.key exist, they are provided
to the server.  The certificate used to sign this cert must be
known to the server, in $DataDir/root.crt.  If successful, the
cert's "common name" is logged.

Client certs are not used for authentication, but they could be
via the port->peer (X509 *), port->peer_dn (char *) or
port->peer_cn (char *) fields.  Or any other function could be
used, e.g., many sites like the issuer + serial number hash.

Bear Giles
2002-06-14 04:36:58 +00:00
Bruce Momjian b8b6691e52 Patch that checks ownership and permissions on server static
private key.  (You want it to be a regular file owned by the
database process, with 0400 or 0600 permissions.)

Bear Giles
2002-06-14 04:35:02 +00:00
Bruce Momjian 8f44024639 SSL patch to periodically renegotiate session key.
In order to reduce the risk of cryptanalysis during extended
sessions (or brief ones involving a substantial amount of data),
this patch renegotiates the session key after 64kib has been
transferred.

Bear Giles
2002-06-14 04:33:53 +00:00
Bruce Momjian 55d053233c SSL support for ephemeral DH keys.
As the comment headers in be-secure.c discusses, EPH preserves
confidentiality even if the static private key (which is usually
kept unencrypted) is compromised.

Because of the value of this, common default values are hard-coded
to protect the confidentiality of the data even if an attacker
successfully deletes or modifies the external file.

Bear Giles
2002-06-14 04:31:49 +00:00
Bruce Momjian 19570420f5 UPDATED PATCH:
Attached are a revised set of SSL patches.  Many of these patches
are motivated by security concerns, it's not just bug fixes.  The key
differences (from stock 7.2.1) are:

*) almost all code that directly uses the OpenSSL library is in two
   new files,

     src/interfaces/libpq/fe-ssl.c
     src/backend/postmaster/be-ssl.c

   in the long run, it would be nice to merge these two files.

*) the legacy code to read and write network data have been
   encapsulated into read_SSL() and write_SSL().  These functions
   should probably be renamed - they handle both SSL and non-SSL
   cases.

   the remaining code should eliminate the problems identified
   earlier, albeit not very cleanly.

*) both front- and back-ends will send a SSL shutdown via the
   new close_SSL() function.  This is necessary for sessions to
   work properly.

   (Sessions are not yet fully supported, but by cleanly closing
   the SSL connection instead of just sending a TCP FIN packet
   other SSL tools will be much happier.)

*) The client certificate and key are now expected in a subdirectory
   of the user's home directory.  Specifically,

	- the directory .postgresql must be owned by the user, and
	  allow no access by 'group' or 'other.'

	- the file .postgresql/postgresql.crt must be a regular file
	  owned by the user.

	- the file .postgresql/postgresql.key must be a regular file
	  owned by the user, and allow no access by 'group' or 'other'.

   At the current time encrypted private keys are not supported.
   There should also be a way to support multiple client certs/keys.

*) the front-end performs minimal validation of the back-end cert.
   Self-signed certs are permitted, but the common name *must*
   match the hostname used by the front-end.  (The cert itself
   should always use a fully qualified domain name (FDQN) in its
   common name field.)

   This means that

	  psql -h eris db

   will fail, but

	  psql -h eris.example.com db

   will succeed.  At the current time this must be an exact match;
   future patches may support any FQDN that resolves to the address
   returned by getpeername(2).

   Another common "problem" is expiring certs.  For now, it may be
   a good idea to use a very-long-lived self-signed cert.

   As a compile-time option, the front-end can specify a file
   containing valid root certificates, but it is not yet required.

*) the back-end performs minimal validation of the client cert.
   It allows self-signed certs.  It checks for expiration.  It
   supports a compile-time option specifying a file containing
   valid root certificates.

*) both front- and back-ends default to TLSv1, not SSLv3/SSLv2.

*) both front- and back-ends support DSA keys.  DSA keys are
   moderately more expensive on startup, but many people consider
   them preferable than RSA keys.  (E.g., SSH2 prefers DSA keys.)

*) if /dev/urandom exists, both client and server will read 16k
   of randomization data from it.

*) the server can read empheral DH parameters from the files

     $DataDir/dh512.pem
     $DataDir/dh1024.pem
     $DataDir/dh2048.pem
     $DataDir/dh4096.pem

   if none are provided, the server will default to hardcoded
   parameter files provided by the OpenSSL project.

Remaining tasks:

*) the select() clauses need to be revisited - the SSL abstraction
   layer may need to absorb more of the current code to avoid rare
   deadlock conditions.  This also touches on a true solution to
   the pg_eof() problem.

*) the SIGPIPE signal handler may need to be revisited.

*) support encrypted private keys.

*) sessions are not yet fully supported.  (SSL sessions can span
   multiple "connections," and allow the client and server to avoid
   costly renegotiations.)

*) makecert - a script that creates back-end certs.

*) pgkeygen - a tool that creates front-end certs.

*) the whole protocol issue, SASL, etc.

 *) certs are fully validated - valid root certs must be available.
    This is a hassle, but it means that you *can* trust the identity
    of the server.

 *) the client library can handle hardcoded root certificates, to
    avoid the need to copy these files.

 *) host name of server cert must resolve to IP address, or be a
    recognized alias.  This is more liberal than the previous
    iteration.

 *) the number of bytes transferred is tracked, and the session
    key is periodically renegotiated.

 *) basic cert generation scripts (mkcert.sh, pgkeygen.sh).  The
    configuration files have reasonable defaults for each type
    of use.

Bear Giles
2002-06-14 04:23:17 +00:00
Bruce Momjian eb43af3210 Back out SSL changes. Newer patch available. 2002-06-14 04:09:37 +00:00
Bruce Momjian a9bd17616e Attached are a revised set of SSL patches. Many of these patches
are motivated by security concerns, it's not just bug fixes.  The key
differences (from stock 7.2.1) are:

*) almost all code that directly uses the OpenSSL library is in two
   new files,

     src/interfaces/libpq/fe-ssl.c
     src/backend/postmaster/be-ssl.c

   in the long run, it would be nice to merge these two files.

*) the legacy code to read and write network data have been
   encapsulated into read_SSL() and write_SSL().  These functions
   should probably be renamed - they handle both SSL and non-SSL
   cases.

   the remaining code should eliminate the problems identified
   earlier, albeit not very cleanly.

*) both front- and back-ends will send a SSL shutdown via the
   new close_SSL() function.  This is necessary for sessions to
   work properly.

   (Sessions are not yet fully supported, but by cleanly closing
   the SSL connection instead of just sending a TCP FIN packet
   other SSL tools will be much happier.)

*) The client certificate and key are now expected in a subdirectory
   of the user's home directory.  Specifically,

	- the directory .postgresql must be owned by the user, and
	  allow no access by 'group' or 'other.'

	- the file .postgresql/postgresql.crt must be a regular file
	  owned by the user.

	- the file .postgresql/postgresql.key must be a regular file
	  owned by the user, and allow no access by 'group' or 'other'.

   At the current time encrypted private keys are not supported.
   There should also be a way to support multiple client certs/keys.

*) the front-end performs minimal validation of the back-end cert.
   Self-signed certs are permitted, but the common name *must*
   match the hostname used by the front-end.  (The cert itself
   should always use a fully qualified domain name (FDQN) in its
   common name field.)

   This means that

	  psql -h eris db

   will fail, but

	  psql -h eris.example.com db

   will succeed.  At the current time this must be an exact match;
   future patches may support any FQDN that resolves to the address
   returned by getpeername(2).

   Another common "problem" is expiring certs.  For now, it may be
   a good idea to use a very-long-lived self-signed cert.

   As a compile-time option, the front-end can specify a file
   containing valid root certificates, but it is not yet required.

*) the back-end performs minimal validation of the client cert.
   It allows self-signed certs.  It checks for expiration.  It
   supports a compile-time option specifying a file containing
   valid root certificates.

*) both front- and back-ends default to TLSv1, not SSLv3/SSLv2.

*) both front- and back-ends support DSA keys.  DSA keys are
   moderately more expensive on startup, but many people consider
   them preferable than RSA keys.  (E.g., SSH2 prefers DSA keys.)

*) if /dev/urandom exists, both client and server will read 16k
   of randomization data from it.

*) the server can read empheral DH parameters from the files

     $DataDir/dh512.pem
     $DataDir/dh1024.pem
     $DataDir/dh2048.pem
     $DataDir/dh4096.pem

   if none are provided, the server will default to hardcoded
   parameter files provided by the OpenSSL project.

Remaining tasks:

*) the select() clauses need to be revisited - the SSL abstraction
   layer may need to absorb more of the current code to avoid rare
   deadlock conditions.  This also touches on a true solution to
   the pg_eof() problem.

*) the SIGPIPE signal handler may need to be revisited.

*) support encrypted private keys.

*) sessions are not yet fully supported.  (SSL sessions can span
   multiple "connections," and allow the client and server to avoid
   costly renegotiations.)

*) makecert - a script that creates back-end certs.

*) pgkeygen - a tool that creates front-end certs.

*) the whole protocol issue, SASL, etc.

 *) certs are fully validated - valid root certs must be available.
    This is a hassle, but it means that you *can* trust the identity
    of the server.

 *) the client library can handle hardcoded root certificates, to
    avoid the need to copy these files.

 *) host name of server cert must resolve to IP address, or be a
    recognized alias.  This is more liberal than the previous
    iteration.

 *) the number of bytes transferred is tracked, and the session
    key is periodically renegotiated.

 *) basic cert generation scripts (mkcert.sh, pgkeygen.sh).  The
    configuration files have reasonable defaults for each type
    of use.

Bear Giles
2002-06-14 03:56:47 +00:00
Tatsuo Ishii 15378a53f8 Add support for GB18030 2002-06-14 03:30:56 +00:00
Tom Lane b1313e3474 Suppress 'owner of datatype appears to be invalid' warning message for
undefined (shell) types.
2002-06-13 20:02:31 +00:00
Bruce Momjian c66eb00adc Allow ANALYZE to run in a transaction. 2002-06-13 19:52:02 +00:00
Bruce Momjian deec3cb91c Add:
> * Create native Win32 port [win32]
2002-06-13 18:01:38 +00:00
Bruce Momjian ad579a9e43 Add Win32 thread to TODO.detail. 2002-06-13 18:00:47 +00:00
Tom Lane f67a931aa4 Make WHERE conditions pulled up from subqueries be executed before outer
WHERE conditions, if there is no reason to do it differently.
2002-06-13 15:10:25 +00:00
Dave Cramer b1ac89f594 removed personal test parameters 2002-06-13 14:37:30 +00:00
Thomas G. Lockhart bbc9b759d6 Add PLACING to the list of reserved keywords. Added as a token in the last
update to support the new OVERLAY() function.
2002-06-13 14:16:43 +00:00
Dave Cramer 5598cbf641 Added test for newly implemented updateable result sets 2002-06-13 14:06:11 +00:00
Dave Cramer 603c46d8ce changes to accomodate updateable resultset mostly just call setSqlQuery on execute 2002-06-13 14:02:50 +00:00
Dave Cramer 7873bed77c Implemented updateable result sets based on raghu nidagal implementation 2002-06-13 13:52:16 +00:00
Dave Cramer ad88ee1e04 changed some commented out messages to use the Driver.debug and fixed first to read the underlying data into rowbuffer 2002-06-13 13:48:28 +00:00
Dave Cramer 3f857600b2 added messages for updateable result sets 2002-06-13 13:43:02 +00:00
Tatsuo Ishii 14f72b9a4d Add GB18030 support. Contributed by Bill Huang <bill_huanghb@ybb.ne.jp>
(ODBC support has not been committed yet. left for Hiroshi...)
2002-06-13 08:30:22 +00:00
Tatsuo Ishii 620dbc98cd make namein multibyte aware 2002-06-13 06:19:45 +00:00
Bruce Momjian 9310caf589 Update for new SGML file. 2002-06-13 05:54:00 +00:00
Bruce Momjian 2d237c7c18 Move disk usage section into its own section. 2002-06-13 05:15:22 +00:00
Bruce Momjian 5612949ff8 Add section on showing disk usage. 2002-06-13 04:36:50 +00:00
Tom Lane ecb5269404 Further tweaks to support display of sort keys in EXPLAIN --- initial
implementation didn't work for Sort nodes associated with Append plans.
2002-06-13 03:40:49 +00:00
Tom Lane 59c325bb73 Repair for bug #691 --- CREATE TABLE AS column aliases fail to be
applied when the select is a UNION (or other set-operation).

An alternative route to a fix would be to leave analyze.c alone and
change plan_set_operations in prepunion.c to take column names from
the topmost targetlist.  But I am not sure that would work in all
cases.  This patch seems the minimum-risk fix.
2002-06-13 02:04:46 +00:00
Bruce Momjian 2ed878d31d Mention vacuum for relpages. 2002-06-13 00:54:05 +00:00
Bruce Momjian 9bba67aa9b Add script to show disk space per db. 2002-06-13 00:21:52 +00:00
Bruce Momjian 4f8795eb71 Improve query. 2002-06-12 23:42:48 +00:00
Bruce Momjian 7e20a2e74f Add mention of query showing pages used. 2002-06-12 23:41:50 +00:00
Bruce Momjian e6e577490d Add to ecpg:
> 	o Allow multi-threaded use of SQLCA
2002-06-12 23:39:49 +00:00
Bruce Momjian 6b3f0ef1db Cleanup. 2002-06-12 21:20:59 +00:00
Bruce Momjian 5a8f555e41 Add -q option to oid2name. Add sample session to README. 2002-06-12 21:09:09 +00:00
Michael Meskes 0f865e17e2 Applied Lee Kindness' patch to fix one of memory allocation with floating point numbers. 2002-06-12 12:06:53 +00:00
Hiroshi Inoue 0484700cda 1) Fix a bug *double error message*.
2) Fix a bug *passowrd prompt in case of md5 authentication*.
3) Improve the DSN setup dialog.
2002-06-12 02:27:44 +00:00
Bruce Momjian 237fb9bbc6 Allow createdb to create comments in current db, not template1. 2002-06-11 22:21:01 +00:00
Bruce Momjian 435941440b Mark as done:
> * -Add SIMILAR TO to allow character classes, 'pg_[a-c]%'
2002-06-11 21:28:17 +00:00
Thomas G. Lockhart 062d8b9ebd Fix markup typo. 2002-06-11 16:00:17 +00:00
Thomas G. Lockhart ea01a451cc Implement SQL99 OVERLAY(). Allows substitution of a substring in a string.
Implement SQL99 SIMILAR TO as a synonym for our existing operator "~".
Implement SQL99 regular expression SUBSTRING(string FROM pat FOR escape).
 Extend the definition to make the FOR clause optional.
 Define textregexsubstr() to actually implement this feature.
Update the regression test to include these new string features.
 All tests pass.
Rename the regular expression support routines from "pg95_xxx" to "pg_xxx".
Define CREATE CHARACTER SET in the parser per SQL99. No implementation yet.
2002-06-11 15:44:38 +00:00
Thomas G. Lockhart 090dd22de6 Implement SQL99 OVERLAY(). Allows substitution of a substring in a string.
Implement SQL99 SIMILAR TO as a synonym for our existing operator "~".
Implement SQL99 regular expression SUBSTRING(string FROM pat FOR escape).
 Extend the definition to make the FOR clause optional.
 Define textregexsubstr() to actually implement this feature.
Update the regression test to include these new string features.
 All tests pass.
Rename the regular expression support routines from "pg95_xxx" to "pg_xxx".
Define CREATE CHARACTER SET in the parser per SQL99. No implementation yet.
2002-06-11 15:32:33 +00:00
Jan Wieck 469cb65aca Katherine Ward wrote:
> Changes to avoid collisions with WIN32 & MFC names...
> 1.  Renamed:
>       a.  PROC => PGPROC
>       b.  GetUserName() => GetUserNameFromId()
>       c.  GetCurrentTime() => GetCurrentDateTime()
>       d.  IGNORE => IGNORE_DTF in include/utils/datetime.h & utils/adt/datetim
>
> 2.  Added _P to some lex/yacc tokens:
>       CONST, CHAR, DELETE, FLOAT, GROUP, IN, OUT

Jan
2002-06-11 13:40:53 +00:00
Bruce Momjian 3b993acf19 Fix link. 2002-06-11 10:36:16 +00:00
Bruce Momjian 3a9f82bf78 Update performance section. 2002-06-11 10:29:54 +00:00
Barry Lind b465f5307f The patch does the following:
Allows you to set the loglevel at runtime by adding ?loglevel=X to the connection URL, where 1 = INFO and 2 = DEBUG.
  Automatically turns on logging by calling DriverManager.setPrintWriter(new PrintWriter(System.out)) if one is not already set.
Adds a Driver.info() message that prints out the version number
Adds member variables logDebug and logInfo that can be checked before making logging methods calls
Adds a build number to the version number string.  This build number will need to be manually incremented when we see fit.

----------------------------------------------------------------------
Modified Files:
 	org/postgresql/Connection.java org/postgresql/Driver.java.in
 	org/postgresql/fastpath/Fastpath.java
 	org/postgresql/jdbc1/DatabaseMetaData.java
 	org/postgresql/jdbc2/Connection.java
 	org/postgresql/jdbc2/DatabaseMetaData.java
 	org/postgresql/largeobject/LargeObjectManager.java
 	org/postgresql/util/PSQLException.java
 	org/postgresql/util/Serialize.java
----------------------------------------------------------------------
2002-06-11 02:55:16 +00:00
Bruce Momjian 8d1c1d40ec Update fsync FAQ item. 2002-06-11 02:22:41 +00:00
Bruce Momjian c86fac2787 Fix link. 2002-06-10 20:45:07 +00:00