adambirds.configure-sshd
ansible-role-sshd
配置 sshd。
需求
无
角色变量
变量 | 描述 | 默认值 |
---|---|---|
sshd_user |
sshd 的用户名 |
sshd |
sshd_group |
sshd 的组名 |
{{ __sshd_group }} |
sshd_service |
sshd 的服务名 |
{{ __sshd_service }} |
sshd_conf_dir |
存放 sshd 配置文件的目录路径 |
{{ __sshd_conf_dir }} |
sshd_conf |
sshd_config 的路径 |
{{ sshd_conf_dir }}/sshd_config |
sshd_sftp_server |
sftp-server(8) 的路径 |
{{ __sshd_sftp_server }} |
sshd_config |
sshd_config 的字典 |
{"PermitRootLogin"=>"without-password", "PasswordAuthentication"=>"no", "UseDNS"=>"no", "UsePAM"=>"no", "Subsystem"=>"sftp {{ sshd_sftp_server }}"} |
sshd_config_pre |
sshd_config(5) 在 sshd_config 之前的字符串 |
"" |
sshd_config_post |
sshd_config(5) 在 sshd_config 之后的字符串 |
"" |
sshd_config_match |
Match 关键字的列表,见下文 |
[] |
ssh_config_match
该变量是一个字典列表,创建 Match
块。
键 | 值 |
---|---|
condition |
Match 的条件 |
keyword |
指令和数值对的字典 |
示例:
sshd_config_match:
- condition: User foo
keyword:
X11Forwarding: "yes"
生成的块:
Match User foo
X11Forwarding yes
Debian
变量 | 默认值 |
---|---|
__sshd_group |
ssh |
__sshd_conf_dir |
/etc/ssh |
__sshd_sftp_server |
/usr/lib/sftp-server |
__sshd_service |
ssh |
FreeBSD
变量 | 默认值 |
---|---|
__sshd_group |
sshd |
__sshd_conf_dir |
/etc/ssh |
__sshd_sftp_server |
/usr/libexec/sftp-server |
__sshd_service |
sshd |
OpenBSD
变量 | 默认值 |
---|---|
__sshd_group |
sshd |
__sshd_conf_dir |
/etc/ssh |
__sshd_sftp_server |
/usr/libexec/sftp-server |
__sshd_service |
sshd |
RedHat
变量 | 默认值 |
---|---|
__sshd_group |
ssh |
__sshd_conf_dir |
/etc/ssh |
__sshd_sftp_server |
/usr/lib/sftp-server |
__sshd_service |
sshd.service |
依赖
无
示例剧本
- hosts: localhost
roles:
- ansible-role-sshd
vars:
sshd_config:
PermitRootLogin: without-password
PasswordAuthentication: "no"
Port: 22
UseDNS: "no"
UsePAM: "no"
Subsystem: "sftp {{ sshd_sftp_server }}"
sshd_config_match:
- condition: User foo
keyword:
X11Forwarding: "yes"
- condition: User bar
keyword:
X11Forwarding: "no"
sshd_config_pre: |
Port 2022
sshd_config_post: |
Match Address 192.168.1.1
PasswordAuthentication yes
许可证
Copyright (c) 2016 Tomoyuki Sakurai <tomoyukis@reallyenglish.com>
特此授权使用、复制、修改和分发本软件,出于任何目的,无论是否收费,条件是以上版权声明和本授权声明出现在所有副本中。
该软件是“按原样”提供的,作者对此软件不提供任何保证,包括所有默示的商品性和适用性保证。在任何情况下,作者均不对因使用、数据或利润损失而导致的任何特殊、直接、间接或后果性损害负责,无论是由于合约、过失或其他侵权行为,均不负责与本软件的使用或性能相关的损害。
作者信息
Tomoyuki Sakurai tomoyukis@reallyenglish.com
此 README 由 ansible-role-init 创建。