openSUSE:WebYaST 安装/配置
YaST Web 服务配置
安装和配置
所有配置都应在软件包的 POST 安装部分完成。安装软件包后,将配置一个仅运行在 "yastws" 系统帐户下的带有 YaST Web 服务的 nginx 服务器。该 HTTP 服务器配置为仅 "localhost",端口为 4984。这可以在文件 /etc/yastws/nginx.conf 中更改。因此,您可以启动服务器
rcyastws start
使用浏览器,网址为
https://:4984
以 "root" 用户登录。在软件包安装期间,所有访问权限都已授予 "root"。对于其他用户,您需要按照以下部分所述授予权限
API 策略
每个 YaST Web 服务调用都涉及访问权限,这些权限可以为每个用户定义。这些权限由 PolicyKit 在文件 /usr/share/PolicyKit/policy/org.opensuse.yast.webservice.policy 中处理。如果您在使用 API 时遇到权限错误,请查看 Web 服务器日志文件,以获取缺少哪些权限的信息
Action: org.opensuse.yast.webservice.run-yastmodule User: schubi Result: no Action: org.opensuse.yast.webservice.run-yastmodule-lan User: schubi Result: yes
可以使用 "polkit-auth" 调用设置这些权限,例如
polkit-auth --user schubi --grant org.opensuse.yast.webservice.run-yastmodule-lan
或者可以重置为
polkit-auth --user schubi --revoke org.opensuse.yast.webservice.run-yastmodule-lan
为了清理或授予所有权限,您可以使用此软件包提供的 ruby 脚本 policyKit-rights.rb
> policyKit-right.rb Usage: policyKit-right.rb --user --action (show|grant|revoke) NOTE: This programm should be run by user root This call grant/revoke ALL permissions for the YaST Webservice. In order to grant/revoke single rights use: polkit-auth --user (--grant|-revoke) In order to show all possible permissions use: polkit-action
主机名和端口
这些设置可以在 /etc/yastws/nginx.conf 或 /etc/yastwc/nginx.conf 中更改
...
..
.
server {
listen 4984;
server_name localhost;
.
..
...
HTTPS 协议
SSL
在开始为 YaST Web 客户端配置 nginx 之前,我们需要获取 SSL 证书。如果您正在创建自己的证书,可以按照以下说明操作
openssl req -new -x509 -keyout host.pem -out host.pem -days 365 -nodes
如果您已经拥有一个 .crt 和 .key 文件的证书,则需要将它们合并到一个 .pem 文件中
cat host.key host.crt > host.pem
这两种方法都会生成一个 .pem 文件,通常命名为 host.pem,其中 "host" 是您使用证书的服务器名称。此文件可以存储在系统上的任何位置,因为 nginx 配置会采用到它的显式路径。通常,证书存储在 /etc/ssl/certs/ 中。
配置 nginx
将这些条目添加到 /etc/yastws/nginx.conf 或 /etc/yastwc/nginx.conf
例如:/etc/yastwc/nginx.conf
server {
listen 54984;
server_name 0.0.0.0;
root /srv/www/yast/public;
passenger_enabled on;
rails_framework_spawner_idle_time 300;
rails_app_spawner_idle_time 300;
ssl on;
ssl_certificate /etc/lighttpd/certs/webyast.pem;
ssl_certificate_key /etc/lighttpd/certs/webyast.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
}
并使用以下命令重启服务器
rcyastws restart
或
rcyastwc restart
现在您可以使用 HTTPS 协议登录。