By Jake Edge
February 16, 2011
The OpenSSL license,
which is BSD-style with an advertising clause, has been a
source of problems in the past because it is rather unclear whether
projects using it can also include GPL-licensed code. Most distributions
seem to be comfortable that OpenSSL can be considered a "system library",
so that linking to it does not require OpenSSL to have a GPL-compatible
license, but the
Free Software Foundation (FSF) and, unsurprisingly, Debian are not on board with
that interpretation. This licensing issue recently reared its head again
in a thread on the pgsql-hackers (PostgreSQL development) mailing list.
For command-line-oriented programs, the GNU readline
library, which allows various types for command-line editing, is a
common addition. But readline is licensed under the GPL (rather than the LGPL),
which means that programs which use it must have a compatible license and
PostgreSQL's BSD-ish permissive license certainly qualifies. But the
OpenSSL license puts additional restrictions on its users and is thus not
compatible with the GPL. Whether that is a real problem in practice
depends on how you interpret the GPL and whether OpenSSL qualifies for the
system library exception.
Debian has chosen a fairly hardline stance on the matter, which is
evidently in line with
the FSF's interpretation, so it switched to the BSD-licensed Editline (aka libedit) library
instead of readline. PostgreSQL supports libedit as a readline
alternative, so making the switch is straightforward. Unfortunately,
a bug in
libedit means that Debian PostgreSQL users can't input multi-byte
characters into the psql command-line tool when using Unicode locales.
For the PostgreSQL project, it is something of a "rock and a hard place"
problem. The OpenSSL code works well, and is fairly tightly—perhaps
too tightly—integrated. There are two obvious alternatives, though,
GnuTLS and Mozilla's Network Security
Services (NSS). Switching to either of those would obviate the
readline problem because their licenses do not contain the problematic
advertising clause.
There have been efforts to switch PostgreSQL to use GnuTLS, as described in
Greg Smith's nice overview of the history
of the problem, but they didn't pass muster due to the size and
intrusiveness of the patch. Part of the problem is that psql is
too closely tied to OpenSSL as Martijn van Oosterhout, who developed the
GnuTLS support, describes:
I spent some time a while back making PostgreSQL work with GnuTLS. The
actual SSL bit is trivial. The GnuTLS interface actually made sense
whereas the OpenSSL one is opaque (at least, I've never seen any
structure in it). The GnuTLS interface was designed in the modern era
and it shows.
The problems are primarily that psql exposes in various ways that it
uses OpenSSL and does it in ways that are hard to support backward
[compatibly]. So for GnuTLS support you need to handle all those bits
too.
Another route to fixing the problem might be for either the
readline or the OpenSSL license to change, but that is not a very likely
outcome. Some GPL-licensed code has added an explicit "OpenSSL exception",
but it is pretty implausible to expect the FSF to do so for
readline—it has long seen that library as a way to move more projects
to GPL-compatible licenses.
OpenSSL is either happy with its license or is unable to change it as
Stephen Frost points out in the thread:
aiui [as I understand it], the problem here is actually a former OpenSSL
hacker who has no
interest (and, in fact, a positive interest against) in changing the
OpenSSL licensing. Most of the current OpenSSL hackers don't have an
issue with the change (again, aiui).
Robert Haas recommends revisiting the
GnuTLS support for the PostgreSQL 9.2 release, but in the meantime there
are some Debian users who cannot easily use psql. It goes beyond
just Debian, though, because Ubuntu will be picking up the
PostgreSQL+libedit version for its next release. That spreads the problem
further, as Joshua D. Drake, who
started the whole thread,
notes: "As popular
as Debian is, the 'user' population is squarely in Ubuntu world and that
has some serious public implications as a whole."
Instead of GnuTLS, NSS could be used and has one major advantage: Federal Information
Processing Standard (FIPS) 140-2 certification. FIPS 140-2 is a US
government standard for encryption that is sometimes required by companies
and organizations when adopting products that contain encryption. OpenSSL
has been FIPS 140-2 certified, as has NSS, but GnuTLS has not been. For
that reason, there is talk of making PostgreSQL support NSS rather than
GnuTLS.
The Fedora project is also looking at NSS as part of an effort to consolidate
the cryptography libraries used by the project. For a number of
reasons, including FIPS certification and some features missing from GnuTLS
(notably S/MIME), NSS is the direction Fedora chose. One would guess that
the GPL-incompatible license for OpenSSL played a role in eliminating it
from consideration.
On the other hand, Fedora does ship various tools with both readline and
OpenSSL, including PostgreSQL. It would seem that Fedora (and possibly Red
Hat's lawyers) are relying on a belief that OpenSSL is distributed as a
system library, as Fedora engineering manager Tom "spot" Callaway has said
in 2008 and again
in 2009. The project (and other distributions) may also be relying on the
near-zero probability that the FSF will ever make a serious effort to
stop the distribution of PostgreSQL using readline.
For Debian, though, that's not enough. Another Debian bug
report contained more discussion of the problem, and a workaround
discovered
by Andreas Barth:
If calling psql as
LD_PRELOAD=/lib/libreadline.so.5 psql
everything works as normal.
That's a bit of an ugly hack, and no one seems very happy about it, but the
plan is to add the LD_PRELOAD (if
libreadline is available) into the psql wrapper that
is shipped in the postgresql-client-common package. Martin Pitt sums it up this way:
Technically, this is a bit fragile, of course, as there might be some
subtle ABI differences which lead to crashes. However, the preloading
workaround already makes the situation so much better than before, so
IMHO it's better than the previous status quo.
I don't really like this situation, and personally I'd rather move
back to libreadline until OpenSSL or readline or PostgreSQL threatens
Debian with a legal case for license violation (I daresay that the
chances of this happening are very close to zero..). But oh well..
This kind of licensing clash occurs with some frequency, and the OpenSSL
license is known to be problematic—at least for projects that use GPL
code. The advertising requirement, which is something of a throwback to the
early days of the BSD license, makes OpenSSL increasingly isolated.
Distributions and other projects are likely to continue to search for, and
find, alternatives, if only to reduce the licensing murkiness and
associated questions from developers and users. It is unfortunate that an
ego-stroking clause or two in the license of a useful library may reduce
its usage but, as always, free software will find a way to work around
these kinds of problems and move on.
(
Log in to post comments)