linux – 当master从命令行运行时,puppet master REST API在乘客工作时返回403

我正在使用puppet install中提供的标准auth.conf,用于通过Nginx下的乘客运行的puppet master.但是对于大多数目录,文件和证书请求,我得到403响应.

### Authenticated paths - these apply only when the client
### has a valid certificate and is thus authenticated

# allow nodes to retrieve their own catalog
path ~ ^/catalog/([^/]+)$
method find
allow $1

# allow nodes to retrieve their own node deFinition
path ~ ^/node/([^/]+)$
method find
allow $1

# allow all nodes to access the certificates services
path ~ ^/certificate_revocation_list/ca
method find 
allow *

# allow all nodes to store their reports
path /report
method save
allow *

# unconditionally allow access to all file services
# which means in practice that fileserver.conf will
# still be used
path /file
allow *

### Unauthenticated ACL,for clients for which the current master doesn't
### have a valid certificate; we allow authenticated users,too,because
### there isn't a great harm in letting that request through.

# allow access to the master CA
path /certificate/ca
auth any
method find
allow *

path /certificate/
auth any
method find
allow *

path /certificate_request
auth any
method find,save
allow *

path /facts
auth any
method find,search
allow *

# this one is not stricly necessary,but it has the merit
# of showing the default policy,which is deny everything else
path /
auth any

然而,当我在客户端上收到此错误时,Puppet master似乎没有跟随此

[amisr1@blramisr195602 ~]$sudo puppet agent --no-daemonize --verbose --server bangvmpllda02.XXXXX.com
[sudo] password for amisr1: 
Starting Puppet client version 3.0.1
Warning: Unable to fetch my node deFinition,but the agent run will continue:
Warning: Error 403 on SERVER: Forbidden request: XX.XXX.XX.XX(XX.XXX.XX.XX) access to /certificate_revocation_list/ca [find] at :110
Info: Retrieving plugin
Error: /File[/var/lib/puppet/lib]: Failed to generate additional resources using 'eval_generate: Error 403 on SERVER: Forbidden request: XX.XXX.XX.XX(XX.XXX.XX.XX) access to /file_Metadata/plugins [search] at :110
Error: /File[/var/lib/puppet/lib]: Could not evaluate: Error 403 on SERVER: Forbidden request: XX.XXX.XX.XX(XX.XXX.XX.XX) access to /file_Metadata/plugins [find] at :110 Could not retrieve file Metadata for puppet://devops.XXXXX.com/plugins: Error 403 on SERVER: Forbidden request: XX.XXX.XX.XX(XX.XXX.XX.XX) access to /file_Metadata/plugins [find] at :110
Error: Could not retrieve catalog from Remote Server: Error 403 on SERVER: Forbidden request: XX.XXX.XX.XX(XX.XXX.XX.XX) access to /catalog/blramisr195602.XXXXX.com [find] at :110
Using cached catalog
Error: Could not retrieve catalog; skipping run
Error: Could not send report: Error 403 on SERVER: Forbidden request: XX.XXX.XX.XX(XX.XXX.XX.XX) access to /report/blramisr195602.XXXXX.com [save] at :110

和服务器日志显示

XX.XXX.XX.XX - - [10/Dec/2012:14:46:52 +0530] "GET /production/certificate_revocation_list/ca? HTTP/1.1" 403 102 "-" "Ruby"
XX.XXX.XX.XX - - [10/Dec/2012:14:46:52 +0530] "GET /production/file_Metadatas/plugins?links=manage&recurse=true&&ignore=---+%0A++-+%22.svn%22%0A++-+CVS%0A++-+%22.git%22&checksum_type=md5 HTTP/1.1" 403 95 "-" "Ruby"
XX.XXX.XX.XX - - [10/Dec/2012:14:46:52 +0530] "GET /production/file_Metadata/plugins? HTTP/1.1" 403 93 "-" "Ruby"
XX.XXX.XX.XX - - [10/Dec/2012:14:46:53 +0530] "POST /production/catalog/blramisr195602.XXXXX.com HTTP/1.1" 403 106 "-" "Ruby"
XX.XXX.XX.XX - - [10/Dec/2012:14:46:53 +0530] "PUT /production/report/blramisr195602.XXXXX.com HTTP/1.1" 403 105 "-" "Ruby"

文件服务器配置文件如下(并按照他们在puppet站点上的说法进行操作,最好在auth.conf中调节访问以获取文件服务器,然后允许文件服务器到服务器全部)

[files]
  path /apps/puppet/files
  allow *
[private]
  path /apps/puppet/private/%H
  allow *
[modules]
  allow *

我使用的是服务器和客户端版本3

Nginx已使用以下选项编译

Nginx version: Nginx/1.3.9
built by gcc 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) 
TLS SNI support enabled
configure arguments: --prefix=/apps/Nginx --conf-path=/apps/Nginx/Nginx.conf --pid-path=/apps/Nginx/run/Nginx.pid --error-log-path=/apps/Nginx/logs/error.log --http-log-path=/apps/Nginx/logs/access.log --with-http_ssl_module --with-http_gzip_static_module --add-module=/usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/ext/Nginx --add-module=/apps/Downloads/Nginx/Nginx-auth-ldap-master/

和标准的Nginx puppet master conf

server {
ssl                on;
listen                     8140 ssl;
server_name        _;

passenger_enabled          on;
passenger_set_cgi_param    HTTP_X_CLIENT_DN $ssl_client_s_dn; 
passenger_set_cgi_param    HTTP_X_CLIENT_VERIFY $ssl_client_verify; 
passenger_min_instances    5;

access_log                 logs/puppet_access.log;
error_log                  logs/puppet_error.log;

root                       /apps/Nginx/html/rack/public;

ssl_certificate            /var/lib/puppet/ssl/certs/bangvmpllda02.XXXXXX.com.pem;
ssl_certificate_key        /var/lib/puppet/ssl/private_keys/bangvmpllda02.XXXXXX.com.pem;
ssl_crl                    /var/lib/puppet/ssl/ca/ca_crl.pem;
ssl_client_certificate     /var/lib/puppet/ssl/certs/ca.pem;
ssl_ciphers                SSLv2:-LOW:-EXPORT:RC4+RSA;
ssl_prefer_server_ciphers  on;
ssl_verify_client          optional;
ssl_verify_depth           1;
ssl_session_cache          shared:SSL:128m;
ssl_session_timeout        5m;
}

Puppet正在从提到的文件获取正确的设置,因为config print命令指向/ etc / puppet

[amisr1@bangvmpllDA02 puppet]$sudo puppet config print | grep conf
async_storeconfigs = false
authconfig = /etc/puppet/namespaceauth.conf
autosign = /etc/puppet/autosign.conf
catalog_cache_terminus = store_configs
confdir = /etc/puppet
config = /etc/puppet/puppet.conf
config_file_name = puppet.conf
config_version = ""
configprint = all
configtimeout = 120
dblocation = /var/lib/puppet/state/clientconfigs.sqlite3
deviceconfig = /etc/puppet/device.conf
fileserverconfig = /etc/puppet/fileserver.conf
genconfig = false
hiera_config = /etc/puppet/hiera.yaml
localconfig = /var/lib/puppet/state/localconfig
name = config
rest_authconfig = /etc/puppet/auth.conf
storeconfigs = true
storeconfigs_backend = puppetdb
tagmap = /etc/puppet/tagmail.conf
thin_storeconfigs = false

我检查了这个VM上的防火墙规则;允许80,443,8140,3000.我是否还需要调整auth.conf的任何细节才能使其正常工作?

更新

我在puppet master中添加了详细的日志记录并重新启动了Nginx;这是我在日志中看到的其他信息

Mon Dec 10 18:19:15 +0530 2012 Puppet (err): Could not resolve 10.209.47.31: no name for 10.209.47.31
Mon Dec 10 18:19:15 +0530 2012 access[/] (info): defaulting to no access for 10.209.47.31
Mon Dec 10 18:19:15 +0530 2012 Puppet (warning): Denying access: Forbidden request: 10.209.47.31(10.209.47.31) access to /file_Metadata/plugins [find] at :111
Mon Dec 10 18:19:15 +0530 2012 Puppet (err): Forbidden request: 10.209.47.31(10.209.47.31) access to /file_Metadata/plugins [find] at :111
10.209.47.31 - - [10/Dec/2012:18:19:15 +0530] "GET /production/file_Metadata/plugins? HTTP/1.1" 403 93 "-" "Ruby"

在代理机器上,facter fqdn和hostname都返回一个完全限定的主机名

[amisr1@blramisr195602 ~]$sudo facter fqdn
blramisr195602.XXXXXXX.com

然后,我更新了要添加的代理配置

dns_alt_names = 10.209.47.31

清除master和agent上的所有证书并重新生成证书,并使用选项–allow-dns-alt-names在master上签名

[amisr1@bangvmpllDA02 ~]$sudo puppet cert sign blramisr195602.XXXXXX.com

Error: CSR 'blramisr195602.XXXXXX.com' contains subject alternative names (DNS:10.209.47.31,DNS:blramisr195602.XXXXXX.com),which are 
disallowed. Use `puppet cert --allow-dns-alt-names sign blramisr195602.XXXXXX.com` to sign this request.

[amisr1@bangvmpllDA02 ~]$sudo puppet cert --allow-dns-alt-names sign blramisr195602.XXXXXX.com

Signed certificate request for blramisr195602.XXXXXX.com
Removing file Puppet::SSL::CertificateRequest blramisr195602.XXXXXX.com at '/var/lib/puppet/ssl/ca/requests/blramisr195602.XXXXXX.com.pem'

然而,这也无济于事;我和以前一样犯了同样的错误.不知道为什么在日志中它显示了按IP而不是主机名比较访问规则.是否有任何Nginx配置可以改变这种行为?

最佳答案
我把它与我们在Nginx上的另一个设置进行了比较;似乎问题是由于属性

ssl_client_header = SSL_CLIENT_S_D
ssl_client_verify_header = SSL_CLIENT_VERIFY

出现在master的puppet.conf中.从那里评论它们并在Nginx中保留它们的配置解决了问题.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


###进入nginx 目录cd /usr/local/nginx###递归显示 2 级目录tree -L 2 ./一、conf 目录conf 目录:存放nginx 配置文件的目录fastcgi.conf:存放fastcgi 相关的配置 fastcgi.conf.default:fastcgi.conf 的原始备份文件,用于还原 fastcgi_params:fastcgi 相关参数文件 fastcgi_params.default:fastcgi_params 的原始...
在cmd命令窗口输入下面命令进行查看 tasklist /fi "imagename eq nginx.exe"
Nginx显示500错误原因和解决方法
linux系统下启停nginx的命令
nginx 的 default_server 指令可以定义默认的 server出处理一些没有成功匹配 server_name 的请求1.显示定义2.指定Server_name3.隐式定义这三种方式都可禁止 ip 直接访问且 1,3同时可以禁止未绑定域名的访问(比如泛解析了主域名)。如果没有显式定义,则会选取第一个定义的 server 作为 default_server。http {# 显示的定义一个 default serverserver {}}
Nginx是一款轻量级的 Web 服务器、反向代理服务器,由于它的内存占用少,启动极快,高并发能力强,在互联网项目中广泛应用。
一、 什么是负载均衡?什么是负载均衡?记得第一次接触 Nginx 是在实验室,那时候在服务器部署网站需要用 Nginx 。Nginx 是一个服务组件,用来反向代理、负载平衡和 HTTP 缓存等。那么这里的 负载均衡 是什么?负载均衡(LB,Load Balance),是一种技术解决方案。用来在多个资源(一般是服务器)中分配负载,达到最优化资源使用,避免过载。资源,相当于每个服务实例的执行操作单元,负载均衡就是将大量的数据处理操作分摊到多个操作单元进行执行,用来解决互联网分布式系统..
Nginx 的 HttpUpstreamModule 提供对后端(backend)服务器的简单负载均衡。一个最简单的 upstream 写法如下:upstream backend { server backend1.example.com; server backend2.example.com; server.backend3.example.com;}ser...
一、alias location   /view {       alias /opt/view;        index  index.html index.htm;       access_log on;       expires 30d;  }  alias 是目录别名的意思,指的是绝对路径。因此按照以上配置的话,如果请求路径是 /view/hello.html,...
现在假设有三台主机,他们的ip分别为:A: 192.168.1.167B: 192.168.1.168C: 192.168.1.169nginx作为代理服务器部署在主机 A 上面,B 和 C 作为两台应用服务器。现在想实现通过A访问B和C,有以下两种方式:一、通过不同的listen实现对B和C的访问,实现方式如下:在nginx.conf中添加两个serverserver {...
Nginx作为一个轻量级的HTTP服务器,相比Apache优势也是比较明显的,在性能上它占用资源少,能支持更高更多的并发连接,从而达到提高访问效率;在功能上它是一款非常优秀的代理服务器与负载均衡服务器;在安装配置上它安装,配置都比较简单。关于Nginx部署、配置的文章公众号已经发布过很多:深度总结|深入浅出NginxHTTP服务器Nginx服务介绍续Nginx优化配置详解1...
原文连接:https://www.cnblogs.com/coder-yoyo/p/6346595.html nginx配置location总结location匹配顺序"="前缀指令匹配,如果匹配成功,则停止其他匹配 普通字符串指令匹配,顺序是从长到短,匹配成功的location如果使用^~,则停止其他匹配(正则匹配) 正则表达式指令匹配,按照配置文件里的顺序,成功就停止其他匹...
location语法:location [=|~|~*|^~] /uri/ { … } 默认:否上下文:server这个指令随URL不同而接受不同的结构。你可以配置使用常规字符串和正则表达式。如果使用正则表达式,你必须使用 ~* 前缀选择不区分大小写的匹配或者 ~ 选择区分大小写的匹配。确定 哪个location 指令匹配一个特定指令,常规字符串第一个测试。常规字符串匹配请求的开始...
Nginx中,set $para $1,$1表示路径中正则表达式匹配的第一个参数。以下是一个示例,用以实验$1,$2。如: location ~/abc/(.*)/(.*) { set $para1 $1 set $para2 $2 content_by_lua_block { ngx.say(ngx.var...
假如在域名b.com下,有一个html页面test.html,访问路径为:http://b.com/test.html;如果要防止别人在iframe下访问该页面,则可以通过nginx配置实现。举例如下:现有页面a.html,http://a.com/a.html,该页面有一个iframe,src=http://b.com/test.html<!DOCTYPE html>...
一 location匹配路径末尾没有 /此时proxy_pass后面的路径必须拼接location的路径: 1 2 3 4 5 6 7 8 location /sta { proxy_redirect off; proxy_set_headerHos...
Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:百度、京东、新浪、网易、腾讯、淘宝等。 也许你听过以上关于Nginx的美妙的事情,您可能已经很喜欢它了,正在考虑如何提高Nginx服务...
在需要真实的流量做旁路测试的时候,我们就可以使用 nginx 来做流量的拷贝1 Nginx Mirror 模块nginx 自1.13.4 版本开始,自带一个ngx_http_mirror_module,使用起来非常简单,只要在需要 mirror 的 location 处添加 mirror 关键字就行Copy 123456789 location / { mirror /mirror; proxy_pass http://ba.
nginx作为静态服务器时,可以提高访问的速度,默认配置下,nginx响应头中会返回:Etag、Last-Modified等信息。这样客户端(比如浏览器)再次访问时,时常会携带请求头:If-Modified-Since,此值为上次响应头中Last-Modified对应的值,那么nginx在收到资源请求时,将会比较If-Modified-Since的值,是否与文件最后的修改时间相等,如果相等就返回304,否则返回200。 所以,如果让nginx每次否返回200,则需要将相应的响应头去掉,即...
原文连接:https://www.jianshu.com/p/0850db5af284$host变量的官方解释$host:in this order of precedence: host name from the request line, or host name from the “Host” request header field, or the server name...