diff --git a/README.en.md b/README.en.md index a449ca4..156ca09 100644 --- a/README.en.md +++ b/README.en.md @@ -1,22 +1,17 @@ -# ovirt-cockpit-sso +# oVirt-Cockpit SSO #### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} -#### Software Architecture -Software architecture description +Provides `cockpit-ws` service configured to handle SSO from oVirt's Administration Portal to Cockpit running on an oVirt host. -#### Installation +Distributed either as ``rpm`` or ``docker image`` (experimental). -1. xxxx -2. xxxx -3. xxxx +Please note, the provided ``docker image`` is based on the Cockpit-Container project and is so far **experimental only** and work-in-progress. -#### Instructions - -1. xxxx -2. xxxx -3. xxxx +##### Main use case: + - log into oVirt's Administration Portal (available for `admin` users only) + - find particular host and click `Host Console` + - host's Cockpit session is opened while no password needs to be entered #### Contribution @@ -24,13 +19,3 @@ Software architecture description 2. Create Feat_xxx branch 3. Commit your code 4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 5cbc84b..2a380f9 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,15 @@ -# ovirt-cockpit-sso +# oVirt-Cockpit SSO #### 介绍 -{**以下是码云平台说明,您可以替换此简介** -码云是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用码云实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} +oVirt-Cockpit SSO提供了cockpit-ws服务,用于配置管理从oVirt的管理门户到在oVirt主机上Cockpit运行的SSO。 -#### 软件架构 -软件架构说明 +它提供两种方式安装:``rpm`` 或者``docker image`` - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx +需要注意的是,``docker image``是基于Cockpit-Container项目,该项目目前正处于实验阶段。 +其主要的用例如下: +* 登录到oVirt的管理门户(仅适用于`admin` 用户) +* 找到特定的主机,然后单击`Host Console` +* 主机的Cockpit session是开放的,而无需输入密码 #### 参与贡献 @@ -27,13 +17,3 @@ 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request - - -#### 码云特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 -5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/ovirt-cockpit-sso-0.1.1.tar.gz b/ovirt-cockpit-sso-0.1.1.tar.gz new file mode 100644 index 0000000..27499f7 Binary files /dev/null and b/ovirt-cockpit-sso-0.1.1.tar.gz differ diff --git a/ovirt-cockpit-sso.spec b/ovirt-cockpit-sso.spec new file mode 100644 index 0000000..0136638 --- /dev/null +++ b/ovirt-cockpit-sso.spec @@ -0,0 +1,113 @@ +Name: ovirt-cockpit-sso +Version: 0.1.1 +Release: 1%{?dist} +Summary: Provides SSO from oVirt Administration Portal to Cockpit +License: ASL 2.0 +URL: https://github.com/oVirt/ovirt-cockpit-sso +Source0: https://github.com/oVirt/ovirt-cockpit-sso/archive/%{name}-%{version}.tar.gz + +%define build_root_dir %{buildroot}%{_datadir}/%{name} +%define app_root_dir %{_datadir}/%{name} +%define logfile /var/log/ovirt-cockpit-sso.install.log + +BuildArch: noarch + +# None of the 4.2 features are reuiqred by this package but "Host Console" link is introduced here for the first time +# using conflicts instead of require because in CentOS Virt SIG repo we can't build ovirt-engine and the require +# breaks repository closure +Conflicts: ovirt-engine < 4.2 + +## TODO: increase to 140 once RHEL 7.5 is released +## In fact, cockpit 140 is required but this is eased to allow smooth +## deployment for testing in the meantime +## cockpit 140 is farther enforced in start.sh which is called by systemd +%if 0%{?fedora} >= 26 +## fedora >26 is fine +Requires: cockpit-ws >= 140 +Requires: cockpit-dashboard >= 140 +%else +Requires: cockpit-ws >= 138 +Requires: cockpit-dashboard >= 138 +%endif + +%description +This package sets cockpit-ws service (see cockpit-project.org) to provide +SSO (Single Sign On) from oVirt's Administration Portal to Cockpit running +on an oVirt's host machine. + +%prep +%setup -q + +%build + +%install +mkdir -p %{build_root_dir}/config/cockpit +mkdir -p %{buildroot}%{_usr}/lib/systemd/system/ + +cp container/config/cockpit/cockpit.conf %{build_root_dir}/config/cockpit/. + +cp container/cockpit-auth-ovirt %{build_root_dir}/. +cp container/keygen.sh %{build_root_dir}/. +cp start.sh %{build_root_dir}/. +cp prestart.sh %{build_root_dir}/. +cp ovirt-cockpit-sso.xml %{build_root_dir}/. +cp ovirt-cockpit-sso.service %{buildroot}%{_usr}/lib/systemd/system/. + +%post +HOSTNAME=$(hostname -f) +ROOT_DIR=$(echo %{app_root_dir} | sed -e 's/\\/\\\\/g; s/\//\\\//g; s/&/\\\&/g') + +case "$1" in + 1) + echo configuring firewall for ovirt-cockpit-sso service - accept 9986/tcp > %{logfile} + echo Post-installation configuration of %{name} - setting engine FQDN to: ${HOSTNAME} >> %{logfile} + + ## /bin/firewall-cmd --permanent --zone=public --new-service-from-file=%{app_root_dir}/ovirt-cockpit-sso.xml + /bin/firewall-cmd --permanent --add-port 9986/tcp >> %{logfile} + /bin/firewall-cmd --reload >> %{logfile} + ;; + 2) + ## This is an upgrade. + ;; +esac + +/bin/sed -i "s/\%\%ENGINE_URL\%\%/https:\/\/${HOSTNAME}\/ovirt-engine/g" %{app_root_dir}/config/cockpit/cockpit.conf +/bin/sed -i "s/\%\%INSTALL_DIR\%\%/${ROOT_DIR}/g" %{app_root_dir}/config/cockpit/cockpit.conf + +%postun +case "$1" in + 0) + ## package is being removed + rm %{app_root_dir}/config/cockpit/ws-certs.d || true + rm %{app_root_dir}/ca.pem || true + + ## TODO: this is not working but would be better approach: + ## /bin/firewall-cmd --permanent --zone=public --delete-service=ovirt-cockpit-sso + /bin/firewall-cmd --permanent --remove-port 9986/tcp >> %{logfile} || true + /bin/firewall-cmd --reload >> %{logfile} + ;; + 1) + ## Package is being upgraded. Do nothing. + : + ;; +esac + +# the .service file could be changed +systemctl daemon-reload + +%files +%doc README.md +%license LICENSE +%{app_root_dir}/config/cockpit/cockpit.conf +%{app_root_dir}/cockpit-auth-ovirt +%{app_root_dir}/keygen.sh +%{app_root_dir}/start.sh +%{app_root_dir}/prestart.sh +%{app_root_dir}/ovirt-cockpit-sso.xml +%{_usr}/lib/systemd/system/ovirt-cockpit-sso.service + +%config %verify(not md5 size mtime) %{app_root_dir}/config/cockpit/cockpit.conf + +%changelog +* Tue Mar 3 2020 changjie.fu - 0.1.1 +- Package Initialization