一种用于ezjail的远程控制和方便包装器
ezjailremote的Python项目详细描述
ezjail-remote是最优秀的ezjail工具的ezjail-admin命令的“远程控制”和便利包装(反过来,它本身也是jails,FreeBSD的轻量级虚拟化解决方案的便利包装)。
它的主要功能是:
- more sophisticated support for flavours, i.e. interactive configuration and/or templating as opposed to ezjail’s hardcoded flavours
- you can ssh into jails created by ^{tt1}$ immediately upon creation (no more manual mucking about with sshd config or uploading your public key!)
- unlike ^{tt2}$, ^{tt1}$ is not installed on the jail host, but on your local machine. This means it doesn’t introduce any further dependencies on the jail host whatsoever (ezjail itself purposefully limits itself to ^{tt6}$).
。注意:一般来说,ezjail remote会尝试跟上ezjail的发展,因此除非另有说明,否则它需要(默认情况下也会安装)最新版本的ezjail(本文撰写时的版本3.2.2)。
用法
ezjail remote使用fabric库远程运行其任务。基本上,它提供了一个所谓的fabfile文件,其中包含了ezjail-admin的所有命令。
这意味着它的用法与ezjail-admin略有不同。特别是,您可以通过-H开关提供监狱服务器的主机名,以及用冒号分隔的命令参数(例如监狱的名称等),如下所示:
ezjail-remote -H host(s) <COMMAND>:param1,param2,param3
或:
ezjail-remote -H host(s) <COMMAND>:param1=foo,param3=bar
请参阅full documentation of what fabric has to offer here。
尤其是,您可以…
- run ^{tt10}$ to see a list of the available options
- run ^{tt11}$ to see a list of the available commands
- run ^{tt12}$ to see a detailed description of a command
作为使用fabric的副作用,您可以同时对多个监狱主机运行ezjail管理命令。
引导
ezjail remote不仅使创建和管理监狱变得容易,还帮助您从头开始建立一个监狱主机环境。这是通过bootstrap和install命令完成的。
要成功运行引导命令,主机上需要满足以下要求:
- sshd is up and running
- ssh login for root is (temporarily) enabled
- currently we also require an internet connection (to install ezjail) but this will eventually be replaced with uploading a copy of ezjail.
例如(以根用户身份登录控制台):
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config echo 'ifconfig_em0=DHCP' >> /etc/rc.conf passwd # give yourself a TEMP_PASSWORD dhclient em0 # note the IP_ADDR you get /etc/rc.d/sshd onestart
现在,您可以使用自己提供的临时密码运行bootstrap命令:
ezjail-remote -H IP_ADDR bootstrap
这个
- disables root login
- permanently enables SSH for the jail host (and limits it to the primary IP address)
- creates an admin user with your username and public SSH key
。注意:在使用install命令安装ezjail之前,您可能需要设置其他内容,例如zfs池、网络接口别名等。
要安装ezjail,可以使用install命令,该命令可以从端口安装,也可以从cvs(勇敢者)安装:
ezjail-remote -H IP_ADDR install
如果要使用cvs快照:
ezjail-remote -H IP_ADDR install:source=cvs
如果你想使用zfs(你应该!)通过jailzfs参数提供它应该使用的池:
ezjail-remote -H IP_ADDR install:jailzfs='jails/ezjail'
命令
在最简单的形式中,ezjail remote提供与ezjail admin完全相同的命令,即[archive|config|console|create|delete|install|list|restore|start|stop|update]。此外,它还提供了create和destroy的增强版本(后者是delete命令的更彻底的变体)。
创建
在给定主机上创建一个新的jail实例,创建具有sudo权限的管理员用户,并通过公钥启用ssh访问。
在设置监狱之后,它尝试从ezjailremote.flavours.<name-of-flavour>执行名为setup的方法,传递所有参数,包括任何附加的任意关键字参数。
参数
- 名称
- 新监狱的名称,必需
- ip
- IP地址,必需
- 管理
- 监狱的管理员用户的名称,默认为当前用户。用户将被创建并添加到wheel(这反过来将允许用户在没有密码的情况下使用sudo)。
- 密钥文件
- 要为管理员用户安装的公钥,默认为~/.ssh/identity.pub。
- 味道
- 本地风味的名称,默认为basic。
- c类型
- 默认为none并引用
-c
标志,这意味着您可以将其设置为simple
、bde
、eli
或zfs
。
销毁
停止、删除和删除给定的监狱实例(但不要在最后一次明确询问之前)。然而,一旦你确认,监狱就不可撤销地消失了。
参数
- 名称
- 新监狱的名称,必需
安装
简单易用安装:
easy_install ezjail-remote
开发
开发ezjail-rem注意,请检查此存储库的副本,然后:
virtualenv . --no-site-package ./bin/python setup.py develop
待办事项
- document flavour development
- use a base class for flavours
- list them (with their docstr) with ezjail-remote list-flavours
- allow chaining/nesting/stacking of flavours (i.e. always include basic)
更改历史记录
0.2.2-2013年5月3日
- Use ezjail version 3.2.2 feature to create ZFS jails by default
- Make use and configuration of sshd in created jail optional
- Various smaller bugfixes
- officially out of alpha :)
0.2.1-2012年9月10日
- add support for creating ZFS (and other image based) jails
0.2-2012年9月7日
- split installation into ^{tt13}$ (which has proven itself useful outside of a ezjail setup) and ^{tt14}$
- added support for ZFS
- can install ezjail from CVS
- added support for flavours outside the ezjail-remote package itself (using namespace packages for ezjailremote.flavours.*)
- added
start
,stop
andjls
commands.
0.1-2011年7月29日
初次发布。提供所有命令的“传递”,以及create和destroy的增强版本。