Slurm REST API:部署 slurmrestd、接入 JWT,并按响应排错

Slurm 的 slurmrestd 守护进程在命令行和 C API 之外提供 REST 接口。客户端通过 HTTP 请求访问集群能力,并可以使用 JWT 完成身份认证。本指南从已有 Slurm 集群出发,说明依赖、独立服务账户、监听配置、令牌和请求验证,以及常见 HTTP 错误应从哪里排查。

本文完整译写 SchedMD 官方 REST API Quick Start Guide,合并其 JWT 与 依赖说明中和部署直接相关的前提。源站于 2026-10-05 核对,页面标示 Slurm 26.05,文中保留 24.05 与 23.11 的历史配置分界。原页没有可确认的个人署名,归属 SchedMD 与 Slurm 文档贡献者。以下命令和配置只做静态审阅,未创建账户、密钥、令牌或服务。

Slurm REST 访问链路:客户端令牌通过受保护的传输到独立账户运行的 slurmrestd,再访问 slurmctld 和可选的 slurmdbd;签名密钥仅由受信任的签发方及后端持有
原创架构图:未完纪技术编辑,依据 SchedMD 官方 REST 与 JWT 文档绘制。图示表达信任边界,不是实际部署截图。

先确认编译依赖和既有集群

slurmrestd 编译时需要 HTTP 解析库和 JSON-C 的开发库及头文件。官方 Related Software 页给出的条件是:libhttp_parser ≥ 2.6.0 或 llhttp ≥ 9.0.0 二选一;JSON-C ≥ 0.15。可选功能还包括 YAML、JWT 和 TLS:YAML 需要 libyaml ≥ 0.2.5,JWT 需要 libjwt ≥ 1.10.0 且 < 3,TLS 使用 s2n-tls。运行时安装共享库并不能弥补编译时缺失的支持。

依赖页中的构建示例固定到 JSON-C 0.15、http-parser 2.9.4、llhttp 9.0.0、libyaml 0.2.5 和 libjwt 1.12.0;这些是官方示例版本,不等于各依赖的最新版本或安全背书。自行构建时分别核对 --with-libhttp-parser、--with-llhttp-parser、--with-yaml 和 --with-jwt 等路径参数,并使用与目标 Slurm 发行版匹配的构建说明。本稿不把这些第三方编译流程另拆成教程。

官方一般建议已配置 slurmdbd 来支持记账。如果不使用 slurmdbd,可能需要通过 slurmrestd -s 选择实际加载的插件,避免加载数据库接口。具体插件名应按安装版本查询 slurmrestd 手册,不能从缺失的数据库服务推断所有 REST 路径都应该可用。

服务可以放在专用 REST 主机,也可以与 slurmctld 共机,取决于负载。多个集群需要分别运行自己的 slurmrestd 实例。安装组件时,官方 DEB 包名为 slurm-smd slurm-smd-slurmrestd,RPM 包名为 slurm slurm-slurmrestd;RPM 构建需要 --with slurmrestd。同时确保该服务读取的 /etc/slurm/slurm.conf 存在且对应正确集群。

JWT 的签发权就是集群级信任

JWT 通常作为 AuthAltTypes 与主要认证方式共存。官方当前支持的通信方向是客户端连接到 slurmctld 或 slurmdbd;不能把它理解成所有 Slurm 交互都支持 JWT。尤其在环境中启用 SLURM_JWT 时,部分 srun 交互作业场景不受支持。

签名权必须由集群管理员审查。能够签发 Slurm 接受的 JWT,就能够为任意用户构造令牌,官方将这视为集群 root 级信任。需要更细的认证和授权策略时,可在 slurmrestd 前使用受信任认证代理;代理向 Slurm 提供 X-SLURM-USER-TOKEN 与 X-SLURM-USER-NAME,但客户端不必使用同一种认证协议。作业进入队列后仍按 Linux/POSIX 用户权限运行,前端代理不再参与作业的每一次系统访问。

简单的独立部署可使用 HS256 共享签名密钥。控制器与 slurmdbd(如果启用)需要配置同一密钥;对控制器,原文建议放在 StateSaveLocation,例如:

dd if=/dev/random of=/var/spool/slurm/statesave/jwt_hs256.key bs=32 count=1
chown slurm:slurm /var/spool/slurm/statesave/jwt_hs256.key
chmod 0600 /var/spool/slurm/statesave/jwt_hs256.key
chown slurm:slurm /var/spool/slurm/statesave
chmod 0755 /var/spool/slurm/statesave

这是原文的密钥生成示例,不应在已有集群上未经检查直接执行:dd 的 of 会覆盖同名现存密钥;更换签名密钥会影响已有令牌的验证,递交到两端的内容也必须一致。路径与 slurm 账户只是示例。原文代码设置 0600,随后文字推荐由 SlurmUser 或 root 持有并设为 0400;两者都不向 other 开放,但后者进一步限制拥有者写入。这里保留这一差异,实际权限由管理员按部署阶段决定。不要公开密钥或把它复制到普通 REST 客户端。

在 slurm.conf 和 slurmdbd.conf 中添加:

AuthAltTypes=auth/jwt
AuthAltParameters=jwt_key=/var/spool/slurm/statesave/jwt_hs256.key

官方独立配置流程随后要求重启 slurmctld。若同时修改 slurmdbd 配置,也要按对应版本的配置生效方式安排维护窗口;本稿不声称仅重启一个进程即可使所有后端配置生效。JWT 所需的库与头文件必须在构建时就可用。

root 或 SlurmUser 可以为指定用户签发令牌,普通用户默认可为自己申请。默认有效期是 1800 秒,可使用 lifespan=SECONDS 调整:

scontrol token username=$USER
scontrol token

上面两行分别演示指定用户和当前用户的申请方式,不是要求连发两次。管理员可在 AuthAltParameters 中启用 disable_token_creation,禁止普通用户自行创建令牌,并由统一认证体系控制签发时间和期限。已有 jwt_key 等参数不能不加判断地被另一条同名配置覆盖。

另一种模式是 JWKS 与 RS256。Slurm 自 21.08 起支持验证这类令牌,可在 AuthAltParameters 中配置 jwks=/path/to/jwks.json。可信 JWKS 中的签名公钥代表能够为所有用户签发令牌的信任方,不是给每个普通用户单独发一把钥匙。启用 JWKS 后,内置 HS256 签发默认关闭;确需共存时显式配置 jwt_key。签名验证不是内容加密;JWT 中的声明不应视为保密数据。

官方 JWT 页还说明身份字段映射以及完整身份声明:默认以用户名在控制器上查询 uid、gid 等信息,use_jwt_client_ids 可允许令牌携带完整身份,use_jwt_client_ids_only 则要求完整声明且不再退回本地查询。完整声明包括数字 uid/gid 和嵌套的 name、gecos、dir、shell、groups 或 gids,其中 groups 与 gids 二选一。第三方身份系统可通过 userclaimfield 映射用户名;例如 Keycloak 使用 preferred_username。这些选项扩大了被信任的身份输入,不能只为消除报错就启用。

外部令牌至少应带创建时间 iat、到期时间 exp 和可映射的用户名声明,签名算法与配置匹配。JWT 文档中的 Keycloak 开发服务、占位密码和 Python 签发脚本是集成示例;其中开发模式、明文 HTTP 与命令行密码不适合作为生产默认。本文保留官方入口而不复制一套缺少站点身份策略的旁支部署。

以前台方式确认进程启动

准备好集群配置和认证后,可在选定主机及端口运行:

export SLURM_JWT=daemon
export SLURMRESTD_DEBUG=debug
slurmrestd <host>:<port>

SLURM_JWT=daemon 是激活守护进程 JWT 认证路径的标记,不是可供客户端使用的令牌。SLURMRESTD_DEBUG 控制日志级别,可按手册调整。官方默认监听配置为 :6820;省略主机地址会扩大监听范围,部署时应明确绑定地址、网络可达范围和传输保护。JWT 负责身份认证,单独启用它不会把 HTTP 变成加密连接。

systemd:使用独立服务账户

Slurm 自带 slurmrestd.service,但可能需要本地调整。以下假设采用官方包或手工安装到等效目录。服务账户不能是 root 或 SlurmUser,不能供真实用户登录或承担其他用途,也不应授予特别权限。原文的创建命令是:

sudo useradd -M -r -s /usr/sbin/nologin -U slurmrestd

这会实际创建系统账户与同名组;应先确认包管理器是否已经创建了账户。需要覆盖服务用户时运行 systemctl edit slurmrestd,在覆盖文件中写入:

[Service]
User=slurmrestd
Group=slurmrestd

Slurm 24.05 及更新版本,默认服务通过 SLURMRESTD_LISTEN 控制监听,默认只监听 TCP 6820;可按需改为其他主机端口或 UNIX socket。23.11 及更早版本还需处理原有 UNIX socket 配置,服务账户必须对其父目录有写入和执行权限。23.11 的官方覆盖示例为:

[Service]
ExecStart=
ExecStart=/usr/sbin/slurmrestd $SLURMRESTD_OPTIONS
Environment=SLURMRESTD_LISTEN=:6820

空的 ExecStart= 用来清除原服务命令,再定义替代值。升级到 24.05 后,这种不直接包含 socket 的覆盖通常已经多余,但原文说明它不会与新方式冲突。反过来,如果旧覆盖的 ExecStart 中仍写有 TCP 或 UNIX socket,同时 SLURMRESTD_LISTEN 又指定相同监听对象,就可能因重复绑定导致启动失败。

定制服务:环境文件或覆盖文件

默认单元支持两种定制方式。第一种是在 /etc/default/slurmrestd 或 /etc/sysconfig/slurmrestd 中配置环境变量。SLURMRESTD_OPTIONS 追加命令行选项;SLURMRESTD_LISTEN 是以逗号分隔的监听列表,条目为 host:port 或 unix:/path/to/socket。从 24.05 开始,默认 ExecStart 自身不包含 socket,完全依赖这一变量。

第二种是 systemctl edit slurmrestd,由 systemd 在 /etc/systemd/ 下创建覆盖文件,增补或替代 /lib/systemd/ 中的默认指令。文件必须包含正确的节名,例如 [Service];环境值可写为 Environment=NAME=value。需要撤销本地覆盖时,原文给出 systemctl revert slurmrestd,但这会撤回本地服务定制,使用前应保存并确认要撤销的内容。重新载入、重启及服务启用策略应遵循站点维护流程。

查询实际 API 版本,再验证请求

不要把网页中的 API 版本复制成固定值。先列出已安装解析插件支持的版本:

slurmrestd -d list

然后申请令牌。原文先清除旧变量,再导出 scontrol token 返回的赋值:

unset SLURM_JWT; export $(scontrol token)

清除旧值能避免过期令牌影响新令牌的申请。该写法依赖命令返回预期的 SLURM_JWT=… 文本;只应用于受信任的本地 Slurm 命令输出,不要对任意远程响应照搬。令牌本身与密码一样敏感,不应粘贴到工单或共享日志。

原文用 curl 访问诊断接口,输出写到 /tmp/curl.log,同时开启较详细的请求日志:

curl -s -o "/tmp/curl.log" -k -vvvv \
  -H X-SLURM-USER-TOKEN:$SLURM_JWT \
  -X GET 'http://<server>:<port>/slurm/v0.0.<api-version>/diag'

请把服务器、端口和 API 版本替换为实际值。验收应同时检查 HTTP 状态为 200 OK,以及响应文件中确实是合法 JSON;“curl 命令没有明显报错”不足以证明 API 已正常工作。其他端点及方法以 Methods and Models 为准,尤其要区分 /slurm/ 与 /slurmdb/。

原命令的实际风险:-vvvv 可能把请求头中的令牌打印到终端或日志;-k 在 HTTPS 下跳过证书验证,而对这里的 HTTP 地址并没有加密作用。固定的共享临时路径也不适合保存敏感响应。下面是编辑提供的替代请求形式,使用已配置并受信任的 HTTPS 入口、证书校验和当前目录内的私有响应文件;它不是原文命令,也没有在真实端点上测试:

umask 077
curl --silent --show-error \
  --output slurm-diag.json \
  --write-out 'HTTP %{http_code}\n' \
  --header "X-SLURM-USER-TOKEN: ${SLURM_JWT}" \
  'https://<trusted-endpoint>/slurm/v0.0.<api-version>/diag'

这个替代写法要求先正确部署 TLS 服务或反向代理;它不会自动把裸 slurmrestd 监听改成 HTTPS。仍需确认本地命令行参数的可见性、输出目录以及站点的令牌传递策略。

若使用 UNIX socket,原文对应的命令是:

curl -s -o "/tmp/curl.log" -k -vvvv \
  -H X-SLURM-USER-TOKEN:$SLURM_JWT \
  --unix-socket /path/to/slurmrestd.socket \
  'http://<server>/slurm/v0.0.<api-version>/diag'

需要替换 socket 路径、URL 主机部分与 API 版本。UNIX socket 负责本地传输,访问权限由文件系统控制;同样要检查 200 和 JSON,并注意原示例的详细日志会暴露令牌。生产令牌管理通常应比入门用的 scontrol token 更完善,是否禁用用户自签由站点策略决定。

从症状回到对应的配置层

通用排查顺序是检查 SLURM_JWT 是否有效,再核对主机与端口、API 版本与端点,最后结合 slurmrestd 和后端日志定位。

现象 应检查什么
Unable to bind socket 日志里的 socket 路径及父目录权限。服务用户需具备相应写入和执行权限;也可修正或移除不需要的监听。若是 Address already in use,同时检查实际启动命令与 SLURMRESTD_LISTEN 是否重复声明同一 TCP/UNIX socket。
Connection refused slurmrestd 是否确实运行,并监听了客户端连接的端口。认证失败与根本没有连接上服务是不同问题。
Protocol authentication error / HTTP 500 常见原因之一是令牌过期,重新申请后再试。若仍失败,查 slurmctld 与 slurmdbd 日志,不能将所有 500 都归因于 JWT。
HTTP 401,且未发送令牌 确认请求头存在。日志可能出现 Authentication does not apply to request。更新令牌只解决令牌问题,不会修复错误的请求头或权限配置。
Unable to find requested URL / HTTP 404 按当前 API 文档核对路径和 HTTP 方法,并区分 slurm 与 slurmdbd 接口。
Rejecting thread config token / HTTP 401 检查是否加载 auth/jwt 插件。若没有,在启动守护进程的环境中设置 SLURM_JWT=daemon,再按站点流程重新启动并检查日志。
Unexpected URL character / HTTP 400 检查 URL 中的问题字符,使用适当百分号编码;不要把用户输入直接拼进路径或查询字符串。
其他 Slurm 命令突然失败 环境中的 SLURM_JWT 会让其他命令尝试 JWT 认证。退出 REST 调试后清除该变量,再按正常认证路径运行。

JWT 插件加载成功的原文日志形态是:

slurmrestd: debug:  auth/jwt: init: JWT authentication plugin loaded

重新获取令牌仍采用前文的 unset SLURM_JWT; export $(scontrol token)。不再使用 JWT 客户端环境时,执行:

unset SLURM_JWT

URL 编码的官方例子使用历史接口 v0.0.40 和示例日期,不表示当前应使用该版本。原文把日期中的斜杠编码后,请求由 400 变成 200:

... -X GET "localhost:8080/slurmdb/v0.0.40/jobs?submit_time=02/28/24"
# 原文示例:400 BAD REQUEST
... -X GET "localhost:8080/slurmdb/v0.0.40/jobs?submit_time=02%2F28%2F24"
# 原文示例:200 OK

这些状态是原文的演示结果,不是本次请求的实测。是否仍支持该日期格式、端点和 API 版本,需要按实际安装版本确认。

进一步配置与来源

认证方式、运行模式、插件、高可用、代理和 Python 客户端可继续查阅 REST API Details,版本行为可查看 OpenAPI Plugin Release Notes;客户端生成和调用注意事项见 REST API Client Guide。集群基础配置分别见 Quick Start Admin Guide 和 slurm.conf 手册。

许可与修改声明:Slurm 仓库 COPYING 明确将代码与文档置于 GNU GPL 下,并随附 GPL v2、原有资助声明与无保证条款。本稿保留该归属,按 GPL v2 提供译写内容;英文许可与原声明副本见 COPYING。本文于 2026-10-05 翻译并增加风险提示、版本核对及替代 curl 示例,改动不代表 SchedMD 原文。本稿不构成已完成服务部署或安全测试的证明。

版权与许可全文

以下保留本页涉及的来源材料或示例代码的版权、许可条件与免责声明;各自适用范围依原声明。中文翻译及编辑标注:未完纪,2026-10-05。

COPYING

SLURM LICENSE AGREEMENT

All Slurm code and documentation is available under the GNU General Public
License. Some tools in the "contribs" directory have other licenses. See
the documentation for individual contributed tools for details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library under
certain conditions as described in each individual source file, and distribute
linked combinations including the two. You must obey the GNU General Public
License in all respects for all of the code used other than OpenSSL. If you
modify file(s) with this exception, you may extend this exception to your
version of the file(s), but you are not obligated to do so. If you do not
wish to do so, delete this exception statement from your version. If you
delete this exception statement from all source files in the program, then
also delete it here.
NO WARRANTY: Because the program is licensed free of charge, there is no
warranty for the program. See section 11 below for full details.

=============================================================================

OUR NOTICE AND TERMS OF AND CONDITIONS OF THE GNU GENERAL PUBLIC LICENSE

Auspices

Portions of this work were performed under the auspices of the U.S. Department
of Energy by Lawrence Livermore National Laboratory under Contract
DE-AC52-07NA27344.

Disclaimer
This work was sponsored by an agency of the United States government.
Neither the United States Government nor Lawrence Livermore National
Security, LLC, nor any of their employees, makes any warranty, express
or implied, or assumes any liability or responsibility for the accuracy,
completeness, or usefulness of any information, apparatus, product, or
process disclosed, or represents that its use would not infringe privately
owned rights. References herein to any specific commercial products, process,
or services by trade names, trademark, manufacturer or otherwise does not
necessarily constitute or imply its endorsement, recommendation, or
favoring by the United States Government or the Lawrence Livermore National
Security, LLC. The views and opinions of authors expressed herein do not
necessarily state or reflect those of the United States government or
Lawrence Livermore National Security, LLC, and shall not be used for
advertising or product endorsement purposes.
=============================================================================

		    GNU GENERAL PUBLIC LICENSE
		       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

			    Preamble
  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.
  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.
		    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.
    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,
    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,
    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.
  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

			    NO WARRANTY
  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
		     END OF TERMS AND CONDITIONS

	    How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA


Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
    Gnomovision version 69, Copyright (C) year name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:
  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Library General
Public License instead of this License.

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容