作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在通过 Ansible 设置 UFW 规则。我能够安装它,启动它并拒绝一切。然后我尝试允许来自 http、https 和 ssh 的连接。所有为这些项目添加允许的尝试都会遇到如下错误:
failed: [lempy1] (item={u'service': u'http'}) => {"failed": true, "item": {"service": "http"}, "msg": "ERROR: Could not find a profile matching 'http'\n"}
failed: [lempy1] (item={u'service': u'https'}) => {"failed": true, "item": {"service": "https"}, "msg": "ERROR: Could not find a profile matching 'https'\n"}
failed: [lempy1] (item={u'service': u'ssh'}) => {"failed": true, "item": {"service": "ssh"}, "msg": "ERROR: Could not find a profile matching 'ssh'\n"}
---
- name: Install ufw
apt: name=ufw state=present
tags:
- security
- name: Allow webservery things
ufw:
rule: allow
name: '{{item.service}}'
with_items:
- service: http
- service: https
- service: ssh
tags:
- security
- name: Start ufw
ufw: state=enabled policy=deny
tags:
- security
sudo ufw allow http
时,我能够正确添加服务, ETC。
最佳答案
如 ufw module docs 中所述,名称(或应用程序)参数使用在 /etc/ufw/applications.d
中注册的应用程序它具有 INI 格式,看起来像这样:
[CUPS]
title=Common UNIX Printing System server
description=CUPS is a printing system with support for IPP, samba, lpd, and other protocols.
ports=631
ufw allow application-profile
允许在
/etc/ufw/applications.d
中定义的应用程序或
/etc/services
为
/etc/ufw/applications.d
中未定义的内容打开 iptables .
/usr/sbin/ufw allow from any to any app 'application-profile'
/etc/ufw/applications.d
列出并且不会阅读
/etc/services
.
- name: Allow webservery things
ufw:
rule: allow
port: '{{ item }}'
with_items:
- '{{ http_port }}'
- '{{ https_port }}'
- '{{ ssh_port }}'
tags:
- security
http_port: 80
https_port: 443
ssh_port: 22
关于Ansible ufw 模块错误 : Could not find a profile matching 'xxxxx' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37268358/
我是一名优秀的程序员,十分优秀!