mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-11-24 20:10:20 +01:00
039aa32606
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
278 lines
15 KiB
Django/Jinja
278 lines
15 KiB
Django/Jinja
{% macro render_option(key,value,indent=true) %}
|
|
{% if value is defined %}
|
|
{% if value is sameas true %}
|
|
{% if indent %} {% endif %}
|
|
{{ key }} yes
|
|
{% elif value is sameas false %}
|
|
{% if indent %} {% endif %}
|
|
{{ key }} no
|
|
{% elif value is string or value is number %}
|
|
{% if indent %} {% endif %}
|
|
{{ key }} {{ value | string }}
|
|
{% else %}
|
|
{% for i in value %}
|
|
{% if indent %} {% endif %}
|
|
{{ key }} {{ i | string }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
{% macro body_option(key,override) %}
|
|
{% set value = undefined %}
|
|
{% if override is defined %}
|
|
{% set value = override %}
|
|
{% elif sshd[key] is defined %}
|
|
{% set value = sshd[key] %}
|
|
{% elif sshd_main_config_file is not none
|
|
and sshd_config_file | dirname != sshd_main_config_file | dirname %}
|
|
{# Do not use the defaults from main file to avoid recursion #}
|
|
{% elif __sshd_defaults[key] is defined and not sshd_skip_defaults %}
|
|
{% if key == 'HostKey' and __sshd_fips_mode %}
|
|
{% set value = __sshd_defaults[key] | difference(__sshd_hostkeys_nofips) %}
|
|
{% else %}
|
|
{% set value = __sshd_defaults[key] %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{{ render_option(key,value) -}}
|
|
{% endmacro %}
|
|
{% macro match_block(match_list) %}
|
|
{% if match_list["Condition"] is defined %}
|
|
{% set match_list = [ match_list ]%}
|
|
{% endif %}
|
|
{% if match_list is iterable %}
|
|
{% for match in match_list %}
|
|
Match {{ match["Condition"] }}
|
|
{{ render_option("AcceptEnv",match["AcceptEnv"],true) -}}
|
|
{{ render_option("AllowAgentForwarding",match["AllowAgentForwarding"],true) -}}
|
|
{{ render_option("AllowGroups",match["AllowGroups"],true) -}}
|
|
{{ render_option("AllowStreamLocalForwarding",match["AllowStreamLocalForwarding"],true) -}}
|
|
{{ render_option("AllowTcpForwarding",match["AllowTcpForwarding"],true) -}}
|
|
{{ render_option("AllowUsers",match["AllowUsers"],true) -}}
|
|
{{ render_option("AuthenticationMethods",match["AuthenticationMethods"],true) -}}
|
|
{{ render_option("AuthorizedKeysCommand",match["AuthorizedKeysCommand"],true) -}}
|
|
{{ render_option("AuthorizedKeysCommandUser",match["AuthorizedKeysCommandUser"],true) -}}
|
|
{{ render_option("AuthorizedKeysFile",match["AuthorizedKeysFile"],true) -}}
|
|
{{ render_option("AuthorizedPrincipalsCommand",match["AuthorizedPrincipalsCommand"],true) -}}
|
|
{{ render_option("AuthorizedPrincipalsCommandUser",match["AuthorizedPrincipalsCommandUser"],true) -}}
|
|
{{ render_option("AuthorizedPrincipalsFile",match["AuthorizedPrincipalsFile"],true) -}}
|
|
{{ render_option("Banner",match["Banner"],true) -}}
|
|
{{ render_option("CASignatureAlgorithms",match["CASignatureAlgorithms"],true) -}}
|
|
{{ render_option("ChrootDirectory",match["ChrootDirectory"],true) -}}
|
|
{{ render_option("ChannelTimeout",match["ChannelTimeout"],true) -}}
|
|
{{ render_option("ClientAliveCountMax",match["ClientAliveCountMax"],true) -}}
|
|
{{ render_option("ClientAliveInterval",match["ClientAliveInterval"],true) -}}
|
|
{{ render_option("DenyGroups",match["DenyGroups"],true) -}}
|
|
{{ render_option("DenyUsers",match["DenyUsers"],true) -}}
|
|
{{ render_option("DisableForwarding",match["DisableForwarding"],true) -}}
|
|
{{ render_option("ExposeAuthInfo",match["ExposeAuthInfo"],true) -}}
|
|
{{ render_option("ForceCommand",match["ForceCommand"],true) -}}
|
|
{{ render_option("GatewayPorts",match["GatewayPorts"],true) -}}
|
|
{{ render_option("GSSAPIAuthentication",match["GSSAPIAuthentication"],true) -}}
|
|
{{ render_option("HostbasedAcceptedKeyTypes",match["HostbasedAcceptedKeyTypes"],true) -}}
|
|
{{ render_option("HostbasedAcceptedAlgorithms",match["HostbasedAcceptedAlgorithms"],true) -}}
|
|
{{ render_option("HostbasedAuthentication",match["HostbasedAuthentication"],true) -}}
|
|
{{ render_option("HostbasedUsesNameFromPacketOnly",match["HostbasedUsesNameFromPacketOnly"],true) -}}
|
|
{{ render_option("IgnoreRhosts",match["IgnoreRhosts"],true) -}}
|
|
{{ render_option("Include",match["Include"],true) -}}
|
|
{{ render_option("IPQoS",match["IPQoS"],true) -}}
|
|
{{ render_option("KbdInteractiveAuthentication",match["KbdInteractiveAuthentication"],true) -}}
|
|
{{ render_option("KerberosAuthentication",match["KerberosAuthentication"],true) -}}
|
|
{{ render_option("LogLevel",match["LogLevel"],true) -}}
|
|
{{ render_option("MaxAuthTries",match["MaxAuthTries"],true) -}}
|
|
{{ render_option("MaxSessions",match["MaxSessions"],true) -}}
|
|
{{ render_option("PasswordAuthentication",match["PasswordAuthentication"],true) -}}
|
|
{{ render_option("PermitEmptyPasswords",match["PermitEmptyPasswords"],true) -}}
|
|
{{ render_option("PermitListen",match["PermitListen"],true) -}}
|
|
{{ render_option("PermitOpen",match["PermitOpen"],true) -}}
|
|
{{ render_option("PermitRootLogin",match["PermitRootLogin"],true) -}}
|
|
{{ render_option("PermitTTY",match["PermitTTY"],true) -}}
|
|
{{ render_option("PermitTunnel",match["PermitTunnel"],true) -}}
|
|
{{ render_option("PermitUserRC",match["PermitUserRC"],true) -}}
|
|
{{ render_option("PubkeyAcceptedKeyTypes",match["PubkeyAcceptedKeyTypes"],true) -}}
|
|
{{ render_option("PubkeyAcceptedAlgorithms",match["PubkeyAcceptedAlgorithms"],true) -}}
|
|
{{ render_option("PubkeyAuthentication",match["PubkeyAuthentication"],true) -}}
|
|
{{ render_option("PubkeyAuthOptions",match["PubkeyAuthOptions"],true) -}}
|
|
{{ render_option("RDomain",match["RDomain"],true) -}}
|
|
{{ render_option("RekeyLimit",match["RekeyLimit"],true) -}}
|
|
{{ render_option("RevokedKeys",match["RevokedKeys"],true) -}}
|
|
{{ render_option("RequiredRSASize",match["RequiredRSASize"],true) -}}
|
|
{{ render_option("RhostsRSAAuthentication",match["RhostsRSAAuthentication"],true) -}}
|
|
{{ render_option("RSAAuthentication",match["RSAAuthentication"],true) -}}
|
|
{{ render_option("RSAMinSize",match["RSAMinSize"],true) -}}
|
|
{{ render_option("SetEnv",match["SetEnv"],true) -}}
|
|
{{ render_option("StreamLocalBindMask",match["StreamLocalBindMask"],true) -}}
|
|
{{ render_option("StreamLocalBindUnlink",match["StreamLocalBindUnlink"],true) -}}
|
|
{{ render_option("TrustedUserCAKeys",match["TrustedUserCAKeys"],true) -}}
|
|
{{ render_option("UnusedConnectionTimeout",match["UnusedConnectionTimeout"],true) -}}
|
|
{{ render_option("X11DisplayOffset",match["X11DisplayOffset"],true) -}}
|
|
{{ render_option("X11MaxDisplays",match["X11MaxDisplays"],true) -}}
|
|
{{ render_option("X11Forwarding",match["X11Forwarding"],true) -}}
|
|
{{ render_option("X11UseLocalHost",match["X11UseLocalHost"],true) -}}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
{% macro match_iterate_block(match_list) %}
|
|
{% if match_list | type_debug == "list" %}
|
|
{% for match in match_list %}
|
|
{{ match_block(match) -}}
|
|
{% endfor %}
|
|
{% else %}
|
|
{{ match_block(match_list) -}}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
{{ body_option("Port",sshd_Port) -}}
|
|
{{ body_option("AddressFamily",sshd_AddressFamily) -}}
|
|
{{ body_option("ListenAddress",sshd_ListenAddress) -}}
|
|
{{ body_option("Protocol",sshd_Protocol) -}}
|
|
{{ body_option("HostKey",sshd_HostKey) -}}
|
|
{{ body_option("AcceptEnv",sshd_AcceptEnv) -}}
|
|
{{ body_option("AllowAgentForwarding",sshd_AllowAgentForwarding) -}}
|
|
{{ body_option("AllowGroups",sshd_AllowGroups) -}}
|
|
{{ body_option("AllowStreamLocalForwarding",sshd_AllowStreamLocalForwarding) -}}
|
|
{{ body_option("AllowTcpForwarding",sshd_AllowTcpForwarding) -}}
|
|
{{ body_option("AllowUsers",sshd_AllowUsers) -}}
|
|
{{ body_option("AuthenticationMethods",sshd_AuthenticationMethods) -}}
|
|
{{ body_option("AuthorizedKeysCommand",sshd_AuthorizedKeysCommand) -}}
|
|
{{ body_option("AuthorizedKeysCommandUser",sshd_AuthorizedKeysCommandUser) -}}
|
|
{{ body_option("AuthorizedKeysFile",sshd_AuthorizedKeysFile) -}}
|
|
{{ body_option("AuthorizedPrincipalsCommand",sshd_AuthorizedPrincipalsCommand) -}}
|
|
{{ body_option("AuthorizedPrincipalsCommandUser",sshd_AuthorizedPrincipalsCommandUser) -}}
|
|
{{ body_option("AuthorizedPrincipalsFile",sshd_AuthorizedPrincipalsFile) -}}
|
|
{{ body_option("Banner",sshd_Banner) -}}
|
|
{{ body_option("CASignatureAlgorithms",sshd_CASignatureAlgorithms) -}}
|
|
{{ body_option("ChallengeResponseAuthentication",sshd_ChallengeResponseAuthentication) -}}
|
|
{{ body_option("ChannelTimeout",sshd_ChannelTimeout) -}}
|
|
{{ body_option("ChrootDirectory",sshd_ChrootDirectory) -}}
|
|
{{ body_option("Ciphers",sshd_Ciphers) -}}
|
|
{{ body_option("ClientAliveCountMax",sshd_ClientAliveCountMax) -}}
|
|
{{ body_option("ClientAliveInterval",sshd_ClientAliveInterval) -}}
|
|
{{ body_option("Compression",sshd_Compression) -}}
|
|
{{ body_option("DebianBanner",sshd_DebianBanner) -}}
|
|
{{ body_option("DenyGroups",sshd_DenyGroups) -}}
|
|
{{ body_option("DenyUsers",sshd_DenyUsers) -}}
|
|
{{ body_option("DisableForwarding",sshd_DisableForwarding) -}}
|
|
{{ body_option("ExposeAuthenticationMethods",sshd_ExposeAuthenticationMethods) -}}
|
|
{{ body_option("ExposeAuthInfo",sshd_ExposeAuthInfo) -}}
|
|
{{ body_option("FingerprintHash",sshd_FingerprintHash) -}}
|
|
{{ body_option("ForceCommand",sshd_ForceCommand) -}}
|
|
{{ body_option("GatewayPorts",sshd_GatewayPorts) -}}
|
|
{{ body_option("GSSAPIAuthentication",sshd_GSSAPIAuthentication) -}}
|
|
{{ body_option("GSSAPICleanupCredentials",sshd_GSSAPICleanupCredentials) -}}
|
|
{{ body_option("GSSAPIEnablek5users",sshd_GSSAPIEnablek5users) -}}
|
|
{{ body_option("GSSAPIKeyExchange",sshd_GSSAPIKeyExchange) -}}
|
|
{{ body_option("GSSAPIKexAlgorithms",sshd_GSSAPIKexAlgorithms) -}}
|
|
{{ body_option("GSSAPIStoreCredentialsOnRekey",sshd_GSSAPIStoreCredentialsOnRekey) -}}
|
|
{{ body_option("GSSAPIStrictAcceptorCheck",sshd_GSSAPIStrictAcceptorCheck) -}}
|
|
{{ body_option("HPNBufferSize",sshd_HPNBufferSize) -}}
|
|
{{ body_option("HPNDisabled",sshd_HPNDisabled) -}}
|
|
{{ body_option("HostCertificate",sshd_HostCertificate) -}}
|
|
{{ body_option("HostKeyAgent",sshd_HostKeyAgent) -}}
|
|
{{ body_option("HostKeyAlgorithms",sshd_HostKeyAlgorithms) -}}
|
|
{{ body_option("HostbasedAcceptedKeyTypes",sshd_HostbasedAcceptedKeyTypes) -}}
|
|
{{ body_option("HostbasedAcceptedAlgorithms",sshd_HostbasedAcceptedAlgorithms) -}}
|
|
{{ body_option("HostbasedAuthentication",sshd_HostbasedAuthentication) -}}
|
|
{{ body_option("HostbasedUsesNameFromPacketOnly",sshd_HostbasedUsesNameFromPacketOnly) -}}
|
|
{{ body_option("Include",sshd_Include) -}}
|
|
{{ body_option("IPQoS",sshd_IPQoS) -}}
|
|
{{ body_option("IgnoreRhosts",sshd_IgnoreRhosts) -}}
|
|
{{ body_option("IgnoreUserKnownHosts",sshd_IgnoreUserKnownHosts) -}}
|
|
{{ body_option("KbdInteractiveAuthentication",sshd_KbdInteractiveAuthentication) -}}
|
|
{{ body_option("KerberosAuthentication",sshd_KerberosAuthentication) -}}
|
|
{{ body_option("KerberosGetAFSToken",sshd_KerberosGetAFSToken) -}}
|
|
{{ body_option("KerberosOrLocalPasswd",sshd_KerberosOrLocalPasswd) -}}
|
|
{{ body_option("KerberosTicketCleanup",sshd_KerberosTicketCleanup) -}}
|
|
{{ body_option("KerberosUniqueTicket",sshd_KerberosUniqueTicket) -}}
|
|
{{ body_option("KerberosUniqueCCache",sshd_KerberosUniqueCCache) -}}
|
|
{{ body_option("KerberosUseKuserok",sshd_KerberosUseKuserok) -}}
|
|
{{ body_option("KexAlgorithms",sshd_KexAlgorithms) -}}
|
|
{{ body_option("KeyRegenerationInterval",sshd_KeyRegenerationInterval) -}}
|
|
{{ body_option("LogLevel",sshd_LogLevel) -}}
|
|
{{ body_option("LogVerbose",sshd_LogVerbose) -}}
|
|
{{ body_option("LoginGraceTime",sshd_LoginGraceTime) -}}
|
|
{{ body_option("MACs",sshd_MACs) -}}
|
|
{{ body_option("MaxAuthTries",sshd_MaxAuthTries) -}}
|
|
{{ body_option("MaxSessions",sshd_MaxSessions) -}}
|
|
{{ body_option("MaxStartups",sshd_MaxStartups) -}}
|
|
{{ body_option("ModuliFile",sshd_ModuliFile) -}}
|
|
{{ body_option("NoneEnabled",sshd_NoneEnabled) -}}
|
|
{{ body_option("PasswordAuthentication",sshd_PasswordAuthentication) -}}
|
|
{{ body_option("PermitEmptyPasswords",sshd_PermitEmptyPasswords) -}}
|
|
{{ body_option("PermitListen",sshd_PermitListen) -}}
|
|
{{ body_option("PermitOpen",sshd_PermitOpen) -}}
|
|
{{ body_option("PermitRootLogin",sshd_PermitRootLogin) -}}
|
|
{{ body_option("PermitTTY",sshd_PermitTTY) -}}
|
|
{{ body_option("PermitTunnel",sshd_PermitTunnel) -}}
|
|
{{ body_option("PermitUserEnvironment",sshd_PermitUserEnvironment) -}}
|
|
{{ body_option("PermitUserRC",sshd_PermitUserRC) -}}
|
|
{{ body_option("PerSourceMaxStartups",sshd_PerSourceMaxStartups) -}}
|
|
{{ body_option("PerSourceNetBlockSize",sshd_PerSourceNetBlockSize) -}}
|
|
{{ body_option("PidFile",sshd_PidFile) -}}
|
|
{{ body_option("PrintLastLog",sshd_PrintLastLog) -}}
|
|
{{ body_option("PrintMotd",sshd_PrintMotd) -}}
|
|
{{ body_option("PubkeyAcceptedKeyTypes",sshd_PubkeyAcceptedKeyTypes) -}}
|
|
{{ body_option("PubkeyAcceptedAlgorithms",sshd_PubkeyAcceptedAlgorithms) -}}
|
|
{{ body_option("PubkeyAuthOptions",sshd_PubkeyAuthOptions) -}}
|
|
{{ body_option("PubkeyAuthentication",sshd_PubkeyAuthentication) -}}
|
|
{{ body_option("RSAAuthentication",sshd_RSAAuthentication) -}}
|
|
{{ body_option("RSAMinSize",sshd_RSAMinSize) -}}
|
|
{{ body_option("RekeyLimit",sshd_RekeyLimit) -}}
|
|
{{ body_option("RequiredRSASize",sshd_RequiredRSASize) -}}
|
|
{{ body_option("RevokedKeys",sshd_RevokedKeys) -}}
|
|
{{ body_option("RDomain",sshd_RDomain) -}}
|
|
{{ body_option("RhostsRSAAuthentication",sshd_RhostsRSAAuthentication) -}}
|
|
{{ body_option("SecurityKeyProvider",sshd_SecurityKeyProvider) -}}
|
|
{{ body_option("SetEnv",sshd_SetEnv) -}}
|
|
{{ body_option("ServerKeyBits",sshd_ServerKeyBits) -}}
|
|
{{ body_option("ShowPatchLevel",sshd_ShowPatchLevel) -}}
|
|
{{ body_option("StreamLocalBindMask",sshd_StreamLocalBindMask) -}}
|
|
{{ body_option("StreamLocalBindUnlink",sshd_StreamLocalBindUnlink) -}}
|
|
{{ body_option("StrictModes",sshd_StrictModes) -}}
|
|
{{ body_option("Subsystem",sshd_Subsystem) -}}
|
|
{{ body_option("SyslogFacility",sshd_SyslogFacility) -}}
|
|
{{ body_option("TCPKeepAlive",sshd_TCPKeepAlive) -}}
|
|
{{ body_option("TcpRcvBufPoll",sshd_TcpRcvBufPoll) -}}
|
|
{{ body_option("TrustedUserCAKeys",sshd_TrustedUserCAKeys) -}}
|
|
{{ body_option("UnusedConnectionTimeout",sshd_UnusedConnectionTimeout) -}}
|
|
{{ body_option("UseDNS",sshd_UseDNS) -}}
|
|
{{ body_option("UseLogin",sshd_UseLogin) -}}
|
|
{{ body_option("UsePAM",sshd_UsePAM) -}}
|
|
{{ body_option("UsePrivilegeSeparation",sshd_UsePrivilegeSeparation) -}}
|
|
{{ body_option("VersionAddendum",sshd_VersionAddendum) -}}
|
|
{{ body_option("X11DisplayOffset",sshd_X11DisplayOffset) -}}
|
|
{{ body_option("X11MaxDisplays",sshd_X11MaxDisplays) -}}
|
|
{{ body_option("X11Forwarding",sshd_X11Forwarding) -}}
|
|
{{ body_option("X11UseLocalhost",sshd_X11UseLocalhost) -}}
|
|
{{ body_option("XAuthLocation",sshd_XAuthLocation) -}}
|
|
{% if sshd['Match'] is defined %}
|
|
{{ match_iterate_block(sshd['Match']) -}}
|
|
{% endif %}
|
|
{% if sshd_match is defined %}
|
|
{{ match_iterate_block(sshd_match) -}}
|
|
{% endif %}
|
|
{% if sshd_match_1 is defined %}
|
|
{{ match_block(sshd_match_1) -}}
|
|
{% endif %}
|
|
{% if sshd_match_2 is defined %}
|
|
{{ match_block(sshd_match_2) -}}
|
|
{% endif %}
|
|
{% if sshd_match_3 is defined %}
|
|
{{ match_block(sshd_match_3) -}}
|
|
{% endif %}
|
|
{% if sshd_match_4 is defined %}
|
|
{{ match_block(sshd_match_4) -}}
|
|
{% endif %}
|
|
{% if sshd_match_5 is defined %}
|
|
{{ match_block(sshd_match_5) -}}
|
|
{% endif %}
|
|
{% if sshd_match_6 is defined %}
|
|
{{ match_block(sshd_match_6) -}}
|
|
{% endif %}
|
|
{% if sshd_match_7 is defined %}
|
|
{{ match_block(sshd_match_7) -}}
|
|
{% endif %}
|
|
{% if sshd_match_8 is defined %}
|
|
{{ match_block(sshd_match_8) -}}
|
|
{% endif %}
|
|
{% if sshd_match_9 is defined %}
|
|
{{ match_block(sshd_match_9) -}}
|
|
{% endif %}
|