reallyenglish.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 之前的字符串 ""
sshd_config_post 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

许可证

版权 (c) 2016 さくらいともゆき <tomoyukis@reallyenglish.com>

特此授予使用、复制、修改和分发本软件的权限,无论是否收费,只要上述版权声明和此许可声明在所有副本中出现。

本软件是按“原样”提供的,作者对本软件不作任何保证,包括所有默示的适销性和适用性保证。作者对于因使用、数据或利润损失而导致的任何特殊、直接、间接或后果性损害或因与本软件的使用或性能相关的任何损害不承担责任。

作者信息

さくらいともゆき tomoyukis@reallyenglish.com

此README由 ansible-role-init 创建。

关于项目

Configures sshd

安装
ansible-galaxy install reallyenglish.sshd
许可证
isc
下载
10.1k
拥有者