---
- name: Get or generate a pre authentication key
shell: |
KEY=$(/opt/zimbra/bin/zmprov getDomain {{ item }} zimbrapreauthkey | perl -ne '/^(?:zimbraP|p)reAuthKey: (.*)/ && print $1')
[ -z $KEY ] && KEY=$(/opt/zimbra/bin/zmprov generateDomainPreAuthKey {{ item }} | perl -ne '/^(?:zimbraP|p)reAuthKey: (.*)/ && print $1')
echo $KEY
become_user: zimbra
register: zcs_preauthkeys
changed_when: False
loop: "{{ wh_mail_domains }}"
tags: mail
- name: Install preauth pages
template: src=../zimbra/templates/cas_preauth.jsp.j2 dest=/opt/zimbra/jetty/webapps/zimbra/public/preauth_{{ item.item }}.jsp owner=zimbra group=zimbra
loop: "{{ zcs_preauthkeys.results }}"
notify: restart zmmailboxd
tags: mail
- name: Install admin preauth pages
template: src=../zimbra/templates/cas_preauth_admin.jsp.j2 dest=/opt/zimbra/jetty/webapps/zimbraAdmin/public/preauth_{{ item.item }}.jsp owner=zimbra group=zimbra
loop: "{{ zcs_preauthkeys.results }}"
notify: restart zmmailboxd
tags: mail
- name: Configure CAS filters
blockinfile:
path: /opt/zimbra/jetty/etc/zimbra.web.xml.in
block: |2
CasSingleSignOutFilter
org.jasig.cas.client.session.SingleSignOutFilter
casServerUrlPrefix
https://sso-cl.fws.fr/cas
CasSingleSignOutFilter
/*
org.jasig.cas.client.session.SingleSignOutHttpSessionListener
{% for item in wh_clients | default([]) %}
{% if item.mail is defined and item.mail.enabled is defined and item.mail.enabled and item.mail.domain is defined %}
CasAuthenticationFilter{{ item.name }}
org.jasig.cas.client.authentication.AuthenticationFilter
casServerLoginUrl
https://sso-cl.fws.fr/cas/login
serverName
{{ item.mail.vhosts | first }}
CasAuthenticationFilter{{ item.name }}
/public/preauth_{{ item.mail.domain }}.jsp
CasValidationFilter{{ item.name }}
org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter
casServerUrlPrefix
https://sso-cl.fws.fr/cas
serverName
{{ item.mail.vhosts | first }}
redirectAfterValidation
true
CasValidationFilter{{ item.name }}
/*
{% else %}
{% endif %}
{% endfor %}
CasHttpServletRequestWrapperFilter
org.jasig.cas.client.util.HttpServletRequestWrapperFilter
CasHttpServletRequestWrapperFilter
/public/*
COOKIE
marker: ''
insertafter: ''
validate: xmllint %s
notify: restart zmmailboxd
tags: zcs