Changeset - 065740010e44
[Not reviewed]
0 4 0
Branko Majic (branko) - 2 years ago 2023-11-19 16:53:27
branko@majic.rs
MAR-181: Drop deprecated directory for storing the LDAP auth module for Prosody.
4 files changed with 26 insertions and 49 deletions:
0 comments (0 inline, 0 general)
roles/xmpp_server/molecule/default/prepare.yml
Show inline comments
 
@@ -151,12 +151,20 @@
 

	
 
    - name: Install Prosody (from Prosody repository)
 
      apt:
 
        name: prosody-0.11
 
        state: present
 

	
 
    - name: Set-up directory for storing additional Prosody modules
 
      file:
 
        path: "/usr/local/lib/prosody/modules/"
 
        state: directory
 
        owner: root
 
        group: root
 
        mode: 0755
 

	
 
- hosts: clients
 
  become: true
 
  tasks:
 

	
 
    - name: Install tool for testing TCP connectivity
 
      apt:
roles/xmpp_server/molecule/default/tests/test_default.py
Show inline comments
 
@@ -26,41 +26,12 @@ def test_prosody_user(host):
 
    Tests if Prosody user has been set-up correctly to access TLS material.
 
    """
 

	
 
    assert 'ssl-cert' in host.user('prosody').groups
 

	
 

	
 
def test_prosody_modules_directory(host):
 
    """
 
    Tests if directory for storing additional Prosody modules is set-up
 
    correctly.
 
    """
 

	
 
    directory = host.file('/usr/local/lib/prosody/modules')
 

	
 
    assert directory.is_directory
 
    assert directory.user == 'root'
 
    assert directory.group == 'root'
 
    assert directory.mode == 0o755
 

	
 

	
 
def test_prosody_mod_auth_ldap(host):
 
    """
 
    Tests if Prosody module mod_auth_ldap has been deployed correctly.
 
    """
 

	
 
    module = host.file('/usr/local/lib/prosody/modules/mod_auth_ldap.lua')
 

	
 
    assert module.is_file
 
    assert module.user == 'root'
 
    assert module.group == 'root'
 
    assert module.mode == 0o644
 
    assert 'module:provides("auth", provider);' in module.content_string
 
    assert 'mod_auth_ldap' in module.content_string
 

	
 

	
 
def test_prosody_configuration_file(host):
 
    """
 
    Tests if Prosody configuration file has correct permissions.
 
    """
 

	
 
    with host.sudo():
roles/xmpp_server/molecule/default/tests/test_deprecated.py
Show inline comments
 
@@ -152,6 +152,17 @@ def test_prosody_apt_key_is_absent(host, apt_key):
 
def test_prosody_repository_is_absent(host):
 
    """
 
    Tests if Prosody repository is absent.
 
    """
 

	
 
    assert not host.file("/etc/apt/sources.list.d/packages_prosody_im_debian.list").exists
 

	
 

	
 
def test_prosody_modules_directory_is_absent(host):
 
    """
 
    Tests if directory for storing deprecated Prosody modules has been
 
    correctly removed.
 
    """
 

	
 
    directory = host.file('/usr/local/lib/prosody/')
 

	
 
    assert not directory.exists
roles/xmpp_server/tasks/main.yml
Show inline comments
 
@@ -23,12 +23,19 @@
 
    src: prosody_backports_pin.j2
 
    dest: /etc/apt/preferences.d/prosody
 
    owner: root
 
    group: root
 
    mode: 0644
 

	
 
- name: Drop directory for storing custom Prosody modules (deprecation)
 
  file:
 
    path: "/usr/local/lib/prosody/"
 
    state: absent
 
  notify:
 
    - Restart Prosody
 

	
 
- name: Collect information about installed packages
 
  package_facts:
 

	
 
- name: Uninstall Prosody from project-provided repository
 
  apt:
 
    name: prosody
 
@@ -137,32 +144,12 @@
 
    src: "cron_check_prosody_certificate"
 
    dest: "/etc/cron.d/check_prosody_certificate"
 
    owner: root
 
    group: root
 
    mode: 0644
 

	
 
- name: Set-up directory for storing additional Prosody modules
 
  file:
 
    path: "/usr/local/lib/prosody/modules/"
 
    state: directory
 
    owner: root
 
    group: root
 
    mode: 0755
 

	
 
- name: Deploy the Prosody mod_auth_ldap module
 
  get_url:
 
    url: "https://hg.prosody.im/prosody-modules/raw-file/tip/mod_auth_ldap/mod_auth_ldap.lua"
 
    dest: "/usr/local/lib/prosody/modules/mod_auth_ldap.lua"
 

	
 
- name: Set-up file permissions for the Prosody mod_auth_ldap module
 
  file:
 
    dest: "/usr/local/lib/prosody/modules/mod_auth_ldap.lua"
 
    owner: root
 
    group: root
 
    mode: 0644
 

	
 
- name: Deploy Prosody configuration file
 
  template:
 
    src: "prosody.cfg.lua.j2"
 
    dest: "/etc/prosody/prosody.cfg.lua"
 
    owner: root
 
    group: prosody
0 comments (0 inline, 0 general)