[关闭]
@babydragon 2016-04-04T06:22:46.000000Z 字数 7744 阅读 3353

在Docker容器中运行Java违反协议吗?

docker java

最近Henn Idan发表了一篇博客,提出在容器中使用Oracle Java可能会违反Oracle许可协议。这会是一个问题?亦或这是开发者需要关注的地方吗?InfoQ对此进行了调查。


最近Henn Idan发表了一篇博客提出在容器中使用Oracle Java可能会违反Oracle许可协议。该问题最初源自Ben Evans回应了一条关于为Alpine Linux重新编译Java版本的推文,他指出该行为显然违反了Oracle许可

虽然OpenJDK基于GPL许可分发,然而可以从java.com下载的OracleJDK预编译二进制文件有不同的二进制许可。由于Oracleu对于代码拥有版权,他们能够发布非GPL许可的版本,并且来自Oracle的JRE同时包括了某些技术,例如Applet插件和Java WebStart(企业中用于平台无关方式启动GUI)。它同时包括了如飞行记录器(Flight Recorder)和任务控制器(Mission Control)等特性,它们对于开发者免费使用,但是对于生产使用需要额外许可。

对于Java SE,Oracle二进制代码许可协议中针对其产品(包括JDK和JRE)使用的许可:

2 . LICENSE TO USE. Subject to the terms and conditions of this Agreement including, but not limited to, the Java Technology Restrictions of the Supplemental License Terms, Oracle grants you a non-exclusive, non-transferable, limited license without license fees to reproduce and use internally the Software complete and unmodified for the sole purpose of running Programs.

由于该许可是不可转让的,它并未授权分发该软件,也不允许被分发对象使用该软件。

另外,对于分发软件的有限权利有额外补充许可条款:

C. LICENSE TO DISTRIBUTE SOFTWARE. Subject to the terms and conditions of this Agreement and restrictions and exceptions set forth in the README File, including, but not limited to the Java Technology Restrictions and Limitations on Redistribution of these Supplemental Terms, Oracle grants you a non-exclusive, non-transferable, limited license without fees to reproduce and distribute the Software, provided that (i) you distribute the Software complete and unmodified and only bundled as part of, and for the sole purpose of running, your Programs, (ii) the Programs add significant and primary functionality to the Software, (iii) you do not distribute additional software intended to replace any component(s) of the Software, (iv) you do not remove or alter any proprietary legends or notices contained in the Software, (v) you only distribute the Software subject to a license agreement that: (a) is a complete, unmodified reproduction of this Agreement; or (b) protects Oracle's interests consistent with the terms contained in this Agreement and that includes the notice set forth in Section H, and (vi) you agree to defend and indemnify Oracle and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Software. The license set forth in this Section C does not extend to the Software identified in Section G.

抛开责任和赔偿(这有时可能需要考虑),该许可本身允许Java技术被用于以运行应用程序为唯一目的的场景(例如程序不仅仅是一个简单的Java启动应用程序)。因此如果Java运行时环境和产品一起分发可能是可接受的;但是对于Docker容器,Java运行时环境和Java应用程序可能存在于不同的容器镜像中,这可能会违反上述条款。

(第G节定义了Oracle标准支持服务已经提供的安全补丁约束,该节提到的仅供参考,因为它不影响标准Java再分发本身的合法性。还有第E节定义了出版商在印刷书籍和杂志中的电子媒介包含JDK的权利;还记得印刷杂志中附带的CD吗?还记得印刷杂志,或是对于这种问题中的CD吗?)

然而,有一个补充项允许再分发

D. LICENSE TO DISTRIBUTE REDISTRIBUTABLES. Subject to the terms and conditions of this Agreement and restrictions and exceptions set forth in the README File, including but not limited to the Java Technology Restrictions and Limitations on Redistribution of these Supplemental Terms, Oracle grants you a non-exclusive, non-transferable, limited license without fees to reproduce and distribute those files specifically identified as redistributable in the README File ("Redistributables") provided that: (i) you distribute the Redistributables complete and unmodified, and only bundled as part of Programs, (ii) the Programs add significant and primary functionality to the Redistributables, (iii) you do not distribute additional software intended to supersede any component(s) of the Redistributables (unless otherwise specified in the applicable README File), (iv) you do not remove or alter any proprietary legends or notices contained in or on the Redistributables, (v) you only distribute the Redistributables pursuant to a license agreement that: (a) is a complete, unmodified reproduction of this Agreement; or (b) protects Oracle's interests consistent with the terms contained in the Agreement and includes the notice set forth in Section H, (vi) you agree to defend and indemnify Oracle and its licensors from and against any damages, costs, liabilities, settlement amounts and/or expenses (including attorneys' fees) incurred in connection with any claim, lawsuit or action by any third party that arises or results from the use or distribution of any and all Programs and/or Software. The license set forth in this Section D does not extend to the Software identified in Section G.

Oracle的自述文件包含对Oracle网站的引用,该网页包含不同自述文件的链接。(它们没有随JDK或者JRE分发或作为其中一部分,可能是出于一定的考虑,因为自述文件内容无法随着时间而追溯。)当前版本JDK 8对于发布版本(测试版本和预发布版本可能无法再分发)再分发有专门一节:

You may reproduce and distribute the Software (and also portions of Software identified below as Redistributable), provided that you comply with the terms and conditions of the Oracle Binary Code License Agreement for the Java SE Platform Products.

The term "vendors" used here refers to licensees, developers, and independent software vendors (ISVs) who license and distribute the Java Runtime Environment (JRE) with their programs.

Vendors must follow the terms of the Oracle Binary Code License Agreement for the Java SE Platform Products.

There are separate required and optional files in the distribution for both the JDK and the JRE:
对于JDK和JRE分发区分了必须可选的文件:

Required vs. Optional Files

The files that make up the Java Runtime Environment (JRE) are divided into two categories: required and optional. Optional files may be excluded from redistributions of the JRE at the vendor's discretion.

...

Please refer to the JRE Readme for details of which files are required and which files are optional when distributing a JRE.

JRE自述文件提供了基于Oracle二进制代码许可下的复制和分发(部分)软件。例如,JavaFX可以被排除,还有jre/ext目录中的内容。所以非可选的文件都是必须的,它们必须随着JRE被分发。同时JDK文件必须和JRE联合分发。

这些文件就JDK和JRE 8及以下版本而言。重新改编之后的JDK和JRE版本9以上版本,将会有不同的协议,这可能会排除或引入新的文件。一些诸如cacerts证书文件,可以因为保持证书变更是最新的而修改。

Java还携带了40位密钥强度的有限安全协议实现,它被普遍认为容易攻破,并且面临一系列降级攻击(例如BEASTPOODLE攻击)。该问题可以通过升级使用无限制强度密码系统。然而这些升级无法分发,必须让用户直接下载:

An unlimited strength version of these files indicating no restrictions on cryptographic strengths is available on the JDK web site for those living in eligible countries. Those living in eligible countries may download the unlimited strength version and replace the strong cryptography jar files with the unlimited strength files.

由于大部分现代应用程序需要开箱即用的稳定加密级别,即使应用程序的剩余环境可以被重新分发,但是缺少安全可能会是一个重大的问题。该问题对于使用OpenJDK构建而非OracleJDK的应用程序同样存在。

对于OpenJDK有可用的构建,可以通过运行sudo apt-get install openjdk-8-jre或者su -c "yum install java-1.8.0-openjdk"命令从未指明的远程仓库安装。在Debian(推测也包括Ubuntu)的示例中,最后的版本是openjdk-7,虽然openjdk-8在测试仓库openjdk-9在实验仓库中存在。这些构建不是由Oracle创建,因此不会有任何支持,另外也不太清楚是否应用了其他补丁和这些构建使用的标记(tags)。

Henn Idan将此描述为神秘的肉(Mystery Meat)——我们无从知道获取了什么,也不知道它的来源和历史。Azul Systems创始人Gil Tene跟进并宣称他们提供的Java分发版通过了Java测试兼容性套件(Java Testing Compatibility Kit,TCK),可以安全使用。他强调Azul的OpenJDK构建同时有一份认证以确认当前构建的版本来源以及通过TCK的断言。Azul是Java的TCK授权持有人之一,另外Red Hat分发的构建,作为企业Linux(RHEL)发行版的一部分,也通过了TCK兼容性测试

Henn Idan博客提到的其中一个问题是Docker OpenJDK镜像基于Debian unstable仓库版本构建,因为OpenJDK 8还不在stable仓库中。这会使得任何使用基于该Docker镜像的用户使用该基础仓库,其中的软件版本没有经过Debian对Java一致性测试。由于Debian未正式发布Java 8,他们不太可能在这个阶段进行认证。然而docker/openjdk仓库在Docker中似乎是标准可用。抛开前文提到的充分发JDK部分,标准Docker镜像基于一个Debian的已知不稳定版本也是需要考虑的地方。

最后,还有一个关于编写和使用Docker file自动下载Oracle JDK的合法性问题。通过在Oracle Java下载页面设置cookie值,代表点击了“我同意”按钮,可以将JDK(或JRE)自动下载和安装到目标系统。虽然Docker file本身没有违反Oracle许可权,但是下载的镜像没有重新分发的权利。Docker客户端会根据命令执行结果构建镜像快照,但是在此之前应用程序的文件已经确认下来,然后可能潜在的使镜像而那禁止文件可以在其他地方下载(例如Docker Hub),由此产生的镜像可能是侵权的。由于这些权利是不可传递的,任何使用Oracle镜像的人可能违反了Oracle的版权。

为了避免潜在的问题,Java用户可以使用另外一个TCK认证的Java运行环境,例如Zulu,它提供了认证的Java 6、7、8 Docker镜像,这些镜像基于UbuntuDebianCentos等基础镜像。或者,也可以通过将Zulu仓库添加到包仓库源列表中安装。Alpine Linux提供了独立(Azul不支持)且更小的JRE(和JDK)。本文较早的版本提到Zulu的使用条款关于出口保证相关条款和GPL相冲突,但是Azul有一个修改条款陈述该内容:

You also represent and warrant that you do not intend to distribute the software in a manner that is not compliant with relevant export control laws or regulations administered by the U.S. Commerce Department, OFAC, or any other government agency.

根据GNU/FSF的说辞“这不违反GPL。这些分发者(大部分是销售自由软件和相关服务的商业企业)是在试图避免他们自己的法律风险,而不是控制软件使用者的行为。”然而,因为没有办法在基于Docker Hub构建过程中强制执行,可能无法用该方式下分发的镜像。同时还不清楚这些条款是否和OpenJDK的GPL协议冲突:

You may not impose any further restrictions on the recipients' exercise of the rights granted herein.

对于Java的争论,目前为止还没有版权持有者的公开认定函,但是随着容器技术的崛起,软件的分发变得更模块化且按照容器层分割。很显然,分发这些镜像可能导致用户和将这些镜像发布到公共仓库的发布者产生法律问题。那些希望避免这种问题发生的人,应该寻求独立的法律意见。

InfoQ总结了这些信息,但这不能作为法律意见。随着形势变化或者再评估,本文可能会有新的勘误和更新。我们联系了Oracle对此问发表评论,截至本文发布前没有收到任何反馈。如果有最新消息,我们会及时更新本文。

最后更新:2016年3月24日,修正以澄清Zulu网站上关于出口保证和使用条款的情况

查看英文原文:http://www.infoq.com/news/2016/03/docker-java

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注