directory search
Compose About versions and upgrading (Compose) ASP.NET Core + SQL Server on Linux (Compose) CLI environment variables (Compose) Command-line completion (Compose) Compose(组成) Compose command-line reference(组合命令行参考) Control startup order (Compose) Django and PostgreSQL (Compose) Docker stacks and distributed application bundles (Compose) docker-compose build(docker-compose构建) docker-compose bundle docker-compose config docker-compose create docker-compose down docker-compose events docker-compose exec docker-compose help docker-compose images docker-compose kill docker-compose logs docker-compose pause docker-compose port docker-compose ps docker-compose pull docker-compose push docker-compose restart docker-compose rm docker-compose run docker-compose scale docker-compose start docker-compose stop docker-compose top docker-compose unpause docker-compose up Environment file (Compose) Environment variables in Compose Extend services in Compose Frequently asked questions (Compose) Getting started (Compose) Install Compose Link environment variables (deprecated) (Compose) Networking in Compose Overview of Docker Compose Overview of docker-compose CLI Quickstart: Compose and WordPress Rails and PostgreSQL (Compose) Sample apps with Compose Using Compose in production Using Compose with Swarm Engine .NET Core application (Engine) About images, containers, and storage drivers (Engine) Add nodes to the swarm (Engine) Apply custom metadata (Engine) Apply rolling updates (Engine) apt-cacher-ng Best practices for writing Dockerfiles (Engine) Binaries (Engine) Bind container ports to the host (Engine) Breaking changes (Engine) Build your own bridge (Engine) Configure container DNS (Engine) Configure container DNS in user-defined networks (Engine) CouchDB (Engine) Create a base image (Engine) Create a swarm (Engine) Customize the docker0 bridge (Engine) Debian (Engine) Default bridge network Delete the service (Engine) Deploy a service (Engine) Deploy services to a swarm (Engine) Deprecated Engine features Docker container networking (Engine) Docker overview (Engine) Docker run reference (Engine) Dockerfile reference (Engine) Dockerize an application Drain a node (Engine) Engine FAQ (Engine) Fedora (Engine) Get started (Engine) Get started with macvlan network driver (Engine) Get started with multi-host networking (Engine) How nodes work (Engine) How services work (Engine) Image management (Engine) Inspect the service (Engine) Install Docker (Engine) IPv6 with Docker (Engine) Join nodes to a swarm (Engine) Legacy container links (Engine) Lock your swarm (Engine) Manage nodes in a swarm (Engine) Manage sensitive data with Docker secrets (Engine) Manage swarm security with PKI (Engine) Manage swarm service networks (Engine) Migrate to Engine 1.10 Optional Linux post-installation steps (Engine) Overview (Engine) PostgreSQL (Engine) Raft consensus in swarm mode (Engine) Riak (Engine) Run Docker Engine in swarm mode Scale the service (Engine) SDKs (Engine) Select a storage driver (Engine) Set up for the tutorial (Engine) SSHd (Engine) Storage driver overview (Engine) Store service configuration data (Engine) Swarm administration guide (Engine) Swarm mode key concepts (Engine) Swarm mode overlay network security model (Engine) Swarm mode overview (Engine) Understand container communication (Engine) Use multi-stage builds (Engine) Use swarm mode routing mesh (Engine) Use the AUFS storage driver (Engine) Use the Btrfs storage driver (Engine) Use the Device mapper storage driver (Engine) Use the OverlayFS storage driver (Engine) Use the VFS storage driver (Engine) Use the ZFS storage driver (Engine) Engine: Admin Guide Amazon CloudWatch logs logging driver (Engine) Bind mounts (Engine) Collect Docker metrics with Prometheus (Engine) Configuring and running Docker (Engine) Configuring logging drivers (Engine) Control and configure Docker with systemd (Engine) ETW logging driver (Engine) Fluentd logging driver (Engine) Format command and log output (Engine) Google Cloud logging driver (Engine) Graylog Extended Format (GELF) logging driver (Engine) Journald logging driver (Engine) JSON File logging driver (Engine) Keep containers alive during daemon downtime (Engine) Limit a container's resources (Engine) Link via an ambassador container (Engine) Log tags for logging driver (Engine) Logentries logging driver (Engine) PowerShell DSC usage (Engine) Prune unused Docker objects (Engine) Run multiple services in a container (Engine) Runtime metrics (Engine) Splunk logging driver (Engine) Start containers automatically (Engine) Storage overview (Engine) Syslog logging driver (Engine) tmpfs mounts Troubleshoot volume problems (Engine) Use a logging driver plugin (Engine) Using Ansible (Engine) Using Chef (Engine) Using Puppet (Engine) View a container's logs (Engine) Volumes (Engine) Engine: CLI Daemon CLI reference (dockerd) (Engine) docker docker attach docker build docker checkpoint docker checkpoint create docker checkpoint ls docker checkpoint rm docker commit docker config docker config create docker config inspect docker config ls docker config rm docker container docker container attach docker container commit docker container cp docker container create docker container diff docker container exec docker container export docker container inspect docker container kill docker container logs docker container ls docker container pause docker container port docker container prune docker container rename docker container restart docker container rm docker container run docker container start docker container stats docker container stop docker container top docker container unpause docker container update docker container wait docker cp docker create docker deploy docker diff docker events docker exec docker export docker history docker image docker image build docker image history docker image import docker image inspect docker image load docker image ls docker image prune docker image pull docker image push docker image rm docker image save docker image tag docker images docker import docker info docker inspect docker kill docker load docker login docker logout docker logs docker network docker network connect docker network create docker network disconnect docker network inspect docker network ls docker network prune docker network rm docker node docker node demote docker node inspect docker node ls docker node promote docker node ps docker node rm docker node update docker pause docker plugin docker plugin create docker plugin disable docker plugin enable docker plugin inspect docker plugin install docker plugin ls docker plugin push docker plugin rm docker plugin set docker plugin upgrade docker port docker ps docker pull docker push docker rename docker restart docker rm docker rmi docker run docker save docker search docker secret docker secret create docker secret inspect docker secret ls docker secret rm docker service docker service create docker service inspect docker service logs docker service ls docker service ps docker service rm docker service scale docker service update docker stack docker stack deploy docker stack ls docker stack ps docker stack rm docker stack services docker start docker stats docker stop docker swarm docker swarm ca docker swarm init docker swarm join docker swarm join-token docker swarm leave docker swarm unlock docker swarm unlock-key docker swarm update docker system docker system df docker system events docker system info docker system prune docker tag docker top docker unpause docker update docker version docker volume docker volume create docker volume inspect docker volume ls docker volume prune docker volume rm docker wait Use the Docker command line (Engine) Engine: Extend Access authorization plugin (Engine) Docker log driver plugins Docker network driver plugins (Engine) Extending Engine with plugins Managed plugin system (Engine) Plugin configuration (Engine) Plugins API (Engine) Volume plugins (Engine) Engine: Security AppArmor security profiles for Docker (Engine) Automation with content trust (Engine) Content trust in Docker (Engine) Delegations for content trust (Engine) Deploying Notary (Engine) Docker security (Engine) Docker security non-events (Engine) Isolate containers with a user namespace (Engine) Manage keys for content trust (Engine) Play in a content trust sandbox (Engine) Protect the Docker daemon socket (Engine) Seccomp security profiles for Docker (Engine) Secure Engine Use trusted images Using certificates for repository client verification (Engine) Engine: Tutorials Engine tutorials Network containers (Engine) Get Started Part 1: Orientation Part 2: Containers Part 3: Services Part 4: Swarms Part 5: Stacks Part 6: Deploy your app Machine Amazon Web Services (Machine) Digital Ocean (Machine) docker-machine active docker-machine config docker-machine create docker-machine env docker-machine help docker-machine inspect docker-machine ip docker-machine kill docker-machine ls docker-machine provision docker-machine regenerate-certs docker-machine restart docker-machine rm docker-machine scp docker-machine ssh docker-machine start docker-machine status docker-machine stop docker-machine upgrade docker-machine url Driver options and operating system defaults (Machine) Drivers overview (Machine) Exoscale (Machine) Generic (Machine) Get started with a local VM (Machine) Google Compute Engine (Machine) IBM Softlayer (Machine) Install Machine Machine Machine CLI overview Machine command-line completion Machine concepts and help Machine overview Microsoft Azure (Machine) Microsoft Hyper-V (Machine) Migrate from Boot2Docker to Machine OpenStack (Machine) Oracle VirtualBox (Machine) Provision AWS EC2 instances (Machine) Provision Digital Ocean Droplets (Machine) Provision hosts in the cloud (Machine) Rackspace (Machine) VMware Fusion (Machine) VMware vCloud Air (Machine) VMware vSphere (Machine) Notary Client configuration (Notary) Common Server and signer configurations (Notary) Getting started with Notary Notary changelog Notary configuration files Running a Notary service Server configuration (Notary) Signer configuration (Notary) Understand the service architecture (Notary) Use the Notary client
characters

此页面解释了为运行自己的公证服务的用户提供的公证客户端的高级用途。确保你已经读过并理解了如何经营自己的公证服务在继续之前。

关于这些例子的一个重要说明

此文档的命令示例省略了-s-d旗子。如果您不知道这些选项是什么,请阅读开始文档或运行notary --help在继续之前。一旦了解了这些标志的作用,就必须在遵循本文档时为这些选项提供自己的值。您还可以配置这些选项,请参见高级配置选项想了解更多信息。

初始化受信任的集合

在向集合添加和签名内容之前,必须先初始化该集合。

$ notary init example.com/collection

No root keys found. Generating a new root key...You are about to create a new root signing key passphrase. This passphrase
will be used to protect the most sensitive key in your signing system. Please
choose a long, complex passphrase and be careful to keep the password and the
key file itself secure and backed up. It is highly recommended that you use a
password manager to generate the passphrase and keep it safe. There will be no
way to recover this key. You can find the key in your config directory.Enter passphrase for new root key with ID 1f54328:Repeat passphrase for new root key with ID 1f54328:Enter passphrase for new targets key with ID 1df39fc (example.com/collection):Repeat passphrase for new targets key with ID 1df39fc (example.com/collection):

初始化受信任的集合将生成以下项;所有密钥都使用非对称算法,但不要求它们都使用算法:

  • 如果没有找到根键,将生成一个初始根键。此键将用作所有受信任集合的默认信任根。

  • 目标键和快照键。如果可信集合%29的作者持有的安全配置文件%28相同,则使用相同的密码来加密这两种密码。这就是为什么您不会被要求提供快照密钥密码的原因。

  • 时间戳键。这是由服务器根据来自客户端的请求生成的,只返回公钥。服务器持有私钥,并将代表用户签署时间戳。

  • 存根签署公证元数据。此阶段为集合的信任元数据的基本版本。它将在发布到服务器时最后确定。

添加和删除目标

使用公证CLI向受信任的集合添加目标非常简单:

$ notary add example.com/collection v1 my_file.txt

上面的命令添加本地文件。my_file.txt%28该文件必须相对于目标名称下的当前工作目录%29存在v1example.com/collection我们建立的集合。本地文件的内容实际上没有添加到集合中--“目标”由文件路径和内容的一个或多个校验和组成。

注意,这是一个脱机命令,我们必须运行notary publish example.com/collection使添加生效。

要删除目标,我们使用notary remove命令,指定枪和目标名称。

$ notary remove example.com/collection v1

移除目标也是一个脱机命令,它需要notary publish example.com/collection才能生效。

管理密钥

默认情况下,公证客户端负责管理根、目标和快照角色的私钥。在初始化新的受信任集合时,默认情况下将生成所有这些键。钥匙在公证处trust_dir目录。此外,如果存在委托角色,则这些角色的密钥也将由公证客户端管理。

公证服务器始终负责管理时间戳密钥。但是,如果快照密钥从公证客户端旋转到服务器,则公证服务器可以管理快照密钥,如下节所述。

旋转键

在可能发生妥协的情况下,公证人提供了一个用于旋转键的CLI命令。当前,可以使用notary key rotate命令旋转目标或快照键。

默认情况下,快照键由公证客户端管理,但请使用notary key rotate snapshot -r命令将快照键旋转到服务器,以便公证服务器随后对快照进行签名。当使用带可信集合的委托时,这一点尤其有用,这样委托就不会需要访问快照键来将更新推送到集合中。

注意,由Docker 1.11引擎客户端创建的新集合将使服务器默认管理快照键。若要在客户端上恢复对快照键的控制,请使用notary key rotate命令,而不使用-r旗子。

目标键必须是本地管理的--要旋转目标键,例如,在发生妥协的情况下,请使用notary key rotate targets命令,而不使用-r旗子。

使用Yubikey

公证人可与Yubikey 4键,当Yubikey启用CCID模式时,通过PKCS 11接口。Yubikey将被优先用于存储根密钥,并且需要用户触摸输入才能签名。请注意,DockerEngine 1.11客户端中包含了Yubikey支持,以便与DockerContentTrust一起使用。

Yubikey支持需要Yubico PIV图书馆%28与PIV工具捆绑在标准库位置中。

使用委托角色

委托角色简化了公证可信集合中的协作者工作流,还允许在集合的委托内容中具有细粒度的权限。本质上,委托角色是目标角色的受限版本,只允许在特定文件中签名目标。

委托角色被赋予自己的密钥,这样每个协作者都可以保留自己的私钥,而无需管理员共享目标密钥或允许协作者对集合的所有目标进行写访问。

在添加任何委托之前,应该将快照键旋转到服务器。请注意,默认情况下,这是为使用Docker Engine 1.11客户端创建的新集合执行的。这样,委派角色将不需要快照键将自己的目标发布到集合,因为服务器可以使用委托目标发布有效的快照:

$ notary key rotate example.com/collection snapshot -r

这儿-r指定旋转远程服务器的键。

添加委托时,您必须获得一个具有您希望委派的用户的公钥的x 509证书。将承担此委托角色的用户必须持有私钥,才能与公证人签署内容。

一旦获得了委托的x 509证书,就可以为该用户添加一个委托:

$ notary delegation add example.com/collection targets/releases cert.pem --paths="delegation/path"

前面的示例演示了添加委托的请求。targets/releases对枪example.com/collection.代表团名称必须以targets/有效,因为所有代表团都是目标作用的限制性版本。该命令添加x 509证书中包含的公钥。cert.pemtargets/releases代表团。

targets/releases委托角色签名内容时,委托用户必须拥有与此公钥相对应的私钥。此命令将此委托限制为仅在以下路径名下发布内容:delegation/path对于给定的“委托/路径”路径,targets/releases角色将能够对“委托/路径/content.txt”、“委托/路径”等路径进行签名。[医]文件txt和“委托/path.txt”。可以在逗号分隔的列表中添加更多路径。--paths,或者通过--all-paths标志允许此委托在任何路径名下发布内容。

发布之后,可以使用List命令查看委托:

$ notary delegation list example.com/collection

      ROLE               PATHS                                   KEY IDS                                THRESHOLD---------------------------------------------------------------------------------------------------------------
  targets/releases   delegation/path   729c7094a8210fd1e780e7b17b7bb55c9a28a48b871b07f65d97baf93898523a   1

你可以看到targets/releases它的路径和密钥ID。如果您希望修改这些字段,可以使用notary delegation addnotary delegation remove关于这个角色的命令。

阈值1中指定的键之一。KEY IDS必须向这个代表团公布。目前不支持1以外的阈值。若要完全删除委托角色,或仅删除单个键和/或路径,请使用notary delegation remove指挥:

$ notary delegation remove example.com/user targets/releases

Are you sure you want to remove all data for this delegation? (yes/no)yes

Forced removal (including all keys and paths) of delegation role targets/releases to repository "example.com/user" staged for next publish.

可以通过将键作为参数传递,以及/或--paths旗子。使用--all-paths若要清除此角色的所有路径,请执行以下操作。如果您在委托角色中指定了当前的所有密钥ID,则将完全删除该角色。

若要将目标添加到指定的委托角色,可以使用notary add命令的--roles旗子。

您必须已为此角色导入了适当的委托密钥。要做到这一点,您可以运行notary key import <KEY_FILE> --role user使用私钥PEM文件,或将私钥PEM放在private/tuf_keys<KEY_ID>.key带着rolePEM标头设置为user...

$ notary add example/collections delegation/path/target delegation_file.txt --roles=targets/releases

在前面的示例中,添加目标delegation/path/target去收集example/collections准备下一次出版。文件delegation_file.txt是目标delegation/path/target使用委托角色targets/releases此目标的路径是有效的,因为它以委托角色的有效路径为前缀。

notary listnotary remove命令也可以接受--roles标志指定要从其中列出或移除目标的角色。默认情况下,这在基础上运行。targets角色。

若要从我们的代表团中删除此目标,请使用notary remove具有相同标志的命令:

$ notary remove example/collections delegation/path/target --roles=targets/releases

使用内容信任的委托

Docker Engine 1.10及以上版本支持使用targets/releases委托作为可信图像标记的规范源(如果存在的话)。

跑步时docker pull在Docker Engine 1.10上使用Docker Content Trust,Docker将尝试搜索targets/releases角色,并将返回到默认的targets如果不存在角色,则为。请注意,在搜索默认值时targets角色,码头1.10可能会接其他非-targets/releases委托角色的签名图像(如果存在于此标记中)。在Docker 1.11中,此行为被更改为docker pull带有DockerContentTrust的命令必须只提取由targets/releases授权角色或targets基本角色。

跑步时docker push使用DockerContentTrust,DockerEngine 1.10将尝试使用targets/releases如果存在委托角色,则返回到targets角色。在码头1.11,adocker push而是尝试与目标%28ex直接下的所有委托角色签名和推送:targets/role但不是targets/nested/role%29,用户有签名密钥。如果存在委托角色,但用户没有签名密钥,则推送将失败。如果不存在委托角色,则推送将尝试与基签名。targets角色。

使用targets/releases使用内容信任推拉图像的角色,按照上述步骤添加和发布公证委托角色。添加委托时,--all-paths应使用标志允许对所有标记进行签名。

磁盘上的文件和状态

公证员在其trust_dir目录,它是~/.notary默认或通常~/.docker/trust启用码头内容信任时。在这个目录中,trusted_certificates在集合中存储用于引导信任的证书,tuf存储要应用于枪支的TUF元数据和更改器,以及private存储私钥。

root_keys子目录private存储根私钥,而tuf_keys存储目标、快照和委托私钥。

 © 2017 Docker, Inc.

根据ApacheLicense,版本2.0获得许可。

Docker和Docker标志是Docker公司在美国和/或其他国家的商标或注册商标。

Docker,Inc.和其他各方也可以在这里使用的其他术语中拥有商标权。

Previous article: Next article: