mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-13 21:12:02 +00:00
Compare commits
3 Commits
v1.14.3
...
validate_e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22700620c6 | ||
|
|
e8688d4cf5 | ||
|
|
d540be425a |
@@ -33,7 +33,7 @@ __all__ = ["DEBUG_COMMAND_ALL", "DEBUG_COMMAND_LIST",
|
|||||||
"paths", "tasks", "get_credentials_if_valid", "Encoding",
|
"paths", "tasks", "get_credentials_if_valid", "Encoding",
|
||||||
"DNSName", "getargspec", "certificate_loader",
|
"DNSName", "getargspec", "certificate_loader",
|
||||||
"write_certificate_list", "boolean", "template_str",
|
"write_certificate_list", "boolean", "template_str",
|
||||||
"urlparse", "normalize_sshpubkey"]
|
"urlparse", "normalize_sshpubkey", "Email"]
|
||||||
|
|
||||||
DEBUG_COMMAND_ALL = 0b1111
|
DEBUG_COMMAND_ALL = 0b1111
|
||||||
# Print the while command list:
|
# Print the while command list:
|
||||||
@@ -116,6 +116,7 @@ try:
|
|||||||
from ipalib.krb_utils import get_credentials_if_valid
|
from ipalib.krb_utils import get_credentials_if_valid
|
||||||
from ipapython.dnsutil import DNSName
|
from ipapython.dnsutil import DNSName
|
||||||
from ipapython import kerberos
|
from ipapython import kerberos
|
||||||
|
from ipapython.ipavalidate import Email
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ipalib.x509 import Encoding
|
from ipalib.x509 import Encoding
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ config:
|
|||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.ansible_freeipa_module import \
|
from ansible.module_utils.ansible_freeipa_module import \
|
||||||
IPAAnsibleModule, compare_args_ipa, ipalib_errors
|
IPAAnsibleModule, compare_args_ipa, ipalib_errors, Email
|
||||||
|
|
||||||
|
|
||||||
def config_show(module):
|
def config_show(module):
|
||||||
@@ -515,6 +515,13 @@ def main():
|
|||||||
msg="Argument '%s' must be between %d and %d."
|
msg="Argument '%s' must be between %d and %d."
|
||||||
% (arg, minimum, maximum))
|
% (arg, minimum, maximum))
|
||||||
|
|
||||||
|
# verify email domain
|
||||||
|
emaildomain = params.get("ipadefaultemaildomain", None)
|
||||||
|
if emaildomain:
|
||||||
|
if not Email("test@{0}".format(emaildomain)):
|
||||||
|
ansible_module.fail_json(
|
||||||
|
msg="Invalid 'emaildomain' value: %s" % emaildomain)
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
exit_args = {}
|
exit_args = {}
|
||||||
|
|
||||||
|
|||||||
@@ -581,8 +581,8 @@ def main():
|
|||||||
"https://pagure.io/freeipa/issue/9349")
|
"https://pagure.io/freeipa/issue/9349")
|
||||||
|
|
||||||
if (
|
if (
|
||||||
externalmember is not None
|
(externalmember is not None
|
||||||
or idoverrideuser is not None
|
or idoverrideuser is not None)
|
||||||
and context == "client"
|
and context == "client"
|
||||||
):
|
):
|
||||||
ansible_module.fail_json(
|
ansible_module.fail_json(
|
||||||
|
|||||||
@@ -34,6 +34,16 @@
|
|||||||
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
emaildomain: ipa.test
|
emaildomain: ipa.test
|
||||||
|
|
||||||
|
- name: Ensure the default e-mail domain cannot be set to an invalid email domain.
|
||||||
|
ipaconfig:
|
||||||
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
ipaapi_context: "{{ ipa_context | default(omit) }}"
|
||||||
|
emaildomain: invalid@emaildomain
|
||||||
|
register: invalid_emaildomain
|
||||||
|
failed_when:
|
||||||
|
invalid_emaildomain.changed
|
||||||
|
or not (invalid_emaildomain.failed and "Invalid 'emaildomain' value:" in invalid_emaildomain.msg)
|
||||||
|
|
||||||
- name: Set default shell to '/bin/sh'
|
- name: Set default shell to '/bin/sh'
|
||||||
ipaconfig:
|
ipaconfig:
|
||||||
ipaadmin_password: SomeADMINpassword
|
ipaadmin_password: SomeADMINpassword
|
||||||
|
|||||||
Reference in New Issue
Block a user