tis-thunderbird-config-template
68.0-3
Configuration for Mozilla Thunderbird - The package will not have any effect if an ADMX GPO for Thunderbird is applied
513 downloads
Download
See build result See VirusTotal scan

Description
- package : tis-thunderbird-config-template
- name : Mozilla Thunderbird Configuration
- version : 68.0-3
- categories : System and network
- maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ,Jordan ARNAUD
- installed_size :
- editor : Mozilla Foundation
- licence : wapt_public
- signature_date : 2024-03-13T17:00:29.931597
- size : 10.28 Ko
- locale : all
- target_os : windows
- impacted_process :
- architecture : all
- Homepage : https://support.mozilla.org/kb/customizing-firefox-using-policiesjson
- Depends :
Control
package : tis-thunderbird-config-template
version : 68.0-3
architecture : all
section : base
priority : optional
name : Mozilla Thunderbird Configuration
categories : System and network
maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ,Jordan ARNAUD
description : Configuration for Mozilla Thunderbird - The package will not have any effect if an ADMX GPO for Thunderbird is applied
depends : tis-thunderbird
conflicts :
maturity : PROD
locale : all
target_os : windows
min_wapt_version : 2.5
sources : https://github.com/mozilla/policy-templates/
installed_size :
impacted_process :
description_fr : Configuration pour Mozilla Thunderbird - Le paquet n'aura aucun effet si un GPO ADMX pour Thunderbird est appliqué
description_pl : Konfiguracja dla Mozilli Thunderbird - pakiet nie będzie miał żadnego wpływu, jeśli zastosowano ADMX GPO dla Thunderbirda
description_de : Konfiguration für Mozilla Thunderbird - Das Paket hat keine Auswirkungen, wenn ein ADMX GPO für Thunderbird angewendet wird
description_es : Configuración para Mozilla Thunderbird - El paquete no tendrá ningún efecto si se aplica un GPO de ADMX para Thunderbird
description_pt : Configuração para o Mozilla Thunderbird - O pacote não terá qualquer efeito se for aplicado um ADMX GPO para o Thunderbird
description_it : Configurazione per Mozilla Thunderbird - Il pacchetto non avrà alcun effetto se viene applicato un GPO ADMX per Thunderbird
description_nl : Configuratie voor Mozilla Thunderbird - Het pakket zal geen effect hebben als een ADMX GPO voor Thunderbird wordt toegepast
description_ru : Конфигурация для Mozilla Thunderbird - Пакет не будет иметь никакого эффекта, если применяется ADMX GPO для Thunderbird
audit_schedule :
editor : Mozilla Foundation
keywords :
licence : wapt_public
homepage : https://support.mozilla.org/kb/customizing-firefox-using-policiesjson
package_uuid : e48ee006-13c0-4c52-b429-046602a46743
valid_from :
valid_until :
forced_install_on :
changelog :
min_os_version :
max_os_version :
icon_sha256sum : 7891f1ca19ac8a9e41cb2963c0833bb3424a1dcc3f89e6ae484b1841a67063b2
signer : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature : w0l19UJbjGa5g1UZ46PxyIwV/RWhgREzgUhMDajixmnEP1slu33shiSb5Yj51sImIwP+zVmMA27wzX/HNkqSluaSOULfJAgIcKRf5YslVdoe/MY+BKsy3UoaVyD+2OALmBSuUdiwOeQ+tDp9tew0jD0SnwPESNm4RtbDbcqPxXUw7BhbFCtBO/mJP6RDK16IQxYCSlxsY/emTD+u5ENLVPb9CP6SiRlA9QlpY9AvqHx/OzY7F33rrVdsE3VVW3f0yya3FBV0Qzyt+FCRw23LeSg8mSwamQD4VQIt8hA25slmd3TXL41aY6+T0M6uzcWJiI5Ep0XwhdGdidtGycf/Yw==
signature_date : 2024-03-13T17:00:29.931597
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
Setup.py
# -*- coding: utf-8 -*-
from setuphelpers import *
"""
Installation procedure: https://support.mozilla.org/kb/customizing-firefox-using-policiesjson
https://github.com/thundernest/policy-templates
https://github.com/mozilla/policy-templates/
https://klaus-hartnegg.de/gpo/2018-05-26-Firefox-Policies.html
"""
# Defining variables
app_name = "Mozilla Thunderbird"
policies_file = "policies.json"
def install():
# Customise the package for your own network
if "-template" in control.package and not params.get("running_as_luti", False):
error("Please run the update_package and then customize this package for your network.")
# Installing the package
for thund in installed_softwares(app_name):
# Initializing variables
thund_dir = thund["install_location"]
thund_dist_dir = makepath(thund_dir, "distribution")
policies_path = makepath(thund_dist_dir, policies_file)
basedir_policies_file = makepath(basedir, policies_file)
# Writing Thunderbird configuration file
if not isdir(thund_dist_dir):
mkdirs(thund_dist_dir)
print("Writing Thunderbird configuration file: %s" % policies_path)
""" # Merging actual Thunderbird configuration file with defined one (may fail)
if isfile(policies_path):
old_data = json_load(policies_path)
new_data = json_load(basedir_policies_file)
data = data_merge(old_data,new_data)
json_write(policies_path, data, indent=2)
else:
data = json_load(basedir_policies_file)
json_write(policies_path, data, indent=2) """
# Forcing package Thunderbird configuration
if isfile(policies_path):
remove_file(policies_path)
filecopyto(basedir_policies_file, policies_path)
else:
filecopyto(basedir_policies_file, policies_path)
# Removing policies from registry since it bypass the policies.json file (source: https://support.mozilla.org/bm/questions/1236197)
if reg_key_exists(HKEY_LOCAL_MACHINE, r"SOFTWARE\Policies\Mozilla\Thunderbird"):
registry_deletekey(HKEY_LOCAL_MACHINE, r"SOFTWARE\Policies\Mozilla\Thunderbird", "", force=True)
def uninstall():
# Uninstalling the package
for thund in installed_softwares(app_name):
# Initializing variables
thund_dir = thund["install_location"]
thund_dist_dir = makepath(thund_dir, "distribution")
policies_path = makepath(thund_dist_dir, policies_file)
# Removing Thunderbird configuration
if isfile(policies_path):
remove_file(policies_path)
def audit():
# Verifying that the configuration is applied
for thund in installed_softwares(app_name):
# Initializing variables
thund_dir = thund["install_location"]
thund_dist_dir = makepath(thund_dir, "distribution")
policies_path = makepath(thund_dist_dir, policies_file)
if not isfile(policies_path):
# Re-executiong the package
print("Configuration is NOT applied for %s" % thund["name"])
return "WARNING"
else:
print("Configuration is correctly applied for %s" % thund["name"])
return "OK"
def json_load(json_file):
with open(json_file) as read_file:
data = json.load(read_file)
return data
def json_write(json_file, data, sort_keys=True, indent=4):
import codecs
with codecs.open(json_file, "w", encoding="utf-8") as write_file:
json.dump(data, write_file, sort_keys=sort_keys, indent=indent)
def data_merge(a, b):
"""merges b into a and return merged result
NOTE: tuples and arbitrary objects are not handled as it is totally ambiguous what should happen"""
key = None
# ## debug output
# sys.stderr.write("DEBUG: %s to %s\n" %(b,a))
try:
if a is None or isinstance(a, str) or isinstance(a, unicode) or isinstance(a, int) or isinstance(a, long) or isinstance(a, float):
# border case for first run or if a is a primitive
a = b
elif isinstance(a, list):
# lists can be only appended
if isinstance(b, list):
# merge lists
a.extend(b)
else:
# append to list
a.append(b)
elif isinstance(a, dict):
# dicts must be merged
if isinstance(b, dict):
for key in b:
if key in a:
a[key] = data_merge(a[key], b[key])
else:
a[key] = b[key]
except TypeError as e:
raise Exception('TypeError "%s" in key "%s" when merging "%s" into "%s"' % (e, key, b, a))
return a
Update_package.py
# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *
from waptpackage import PackageEntry
def update_package():
# Declaring local variables
package_updated = False
# Interact differently with Luti
if params.get("running_as_luti", False):
return "OK"
# Renaming package
if "template" in control.package:
complete_control_package(control)
complete_control_name(control)
if "template" in control.package:
error("Please rename the package.")
else:
version = str(int(control.get_software_version()) + 1)
ask_message(
control.package,
"Please note that you will still need to edit this package to apply your own configuration that is compliant with your company's internal policies. You are sole responsible for the use of this package on your network.",
48,
)
else:
version = str(int(control.get_software_version()))
# Changing version of the package
if Version(version, 4) > Version(control.get_software_version(), 4):
print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
package_updated = True
else:
print("Software version up-to-date (%s)" % Version(version))
control.set_software_version(version)
control.save_control_to_wapt()
# Validating or not update-package-sources
return package_updated
def ask_message(
title,
text,
flags=None,
raise_error=False,
):
"""
Opens a message box with customizable buttons and icons.
Args:
title (str): The title to display in the message box.
text (str): The message text to display in the message box.
flags (int): Options for buttons and icons. You can combine a message and an icon by adding their corresponding
integer values together. Possible message options:
- MB_OK (0): OK button
- MB_OKCANCEL (1): OK and Cancel buttons
- MB_ABORTRETRYIGNORE (2): Abort, Retry, and Ignore buttons
- MB_YESNOCANCEL (3): Yes, No, and Cancel buttons
- MB_YESNO (4): Yes and No buttons
Possible icon options:
- MB_ICONERROR (16): Error icon
- MB_ICONQUESTION (32): Question icon
- MB_ICONWARNING (48): Warning icon
- MB_ICONINFORMATION (64): Information icon
To combine a message and an icon, add their integer values together. For example, to display an OK button
with an information icon, use: 0 + 64 (MB_OK + MB_ICONINFORMATION).
Note: For more details and additional options, refer to the documentation at:
https://www.functionx.com/delphi/msgboxes/messagebox.htm
raise_error (bool): Whether to raise an error if no response is given by the user.
Returns:
The response code indicating the user's choice. Possible return values:
- ID_OK (1)
- ID_CANCEL (2)
- ID_ABORT (3)
- ID_RETRY (4)
- ID_IGNORE (5)
- ID_YES (6)
- ID_NO (7)
"""
import waptguihelper
if flags is None:
flags = waptguihelper.MB_ICONINFORMATION + waptguihelper.MB_OK
response = waptguihelper.message_dialog(title, text, flags)
if not response or response in (2, 3, 4) and raise_error:
raise ValueError("No response given by the user")
return response
def complete_control_package(control, control_package="", silent=False, remove_template_base_files=False):
"""Requesting that the user provide a package name to be entered into the control.package field, and offering the possibility of removing the base files (icon.png and changelog.txt) for template package usage
Args:
control (str or waptpackage.PackageEntry): The path of control file or his PackageEntry call
control_package (str) : Prefilled control_package (default: actual control_package)
silent (bool) : If True, no user input dialog will be displayed. (default: False)
remove_template_base_files (bool): Removes base files if parameter is True and str("template") in control.package (default: False)
"""
if not isinstance(control, PackageEntry):
pkg_dir = convert_control_path_to_dir(control)
control = PackageEntry().load_control_from_wapt(pkg_dir)
old_control_package = control.package
control_package = (
control_package.lower()
.replace("_", "-")
.replace("~", "-")
.replace(" ", "-")
.replace("!", "")
.replace("'", "")
.replace("(", "")
.replace(")", "")
)
control_package = "-".join([p.strip() for p in control_package.split("-") if p.strip()])
if not control_package:
control_package = control.package
# Removing template files
if "template" in control.package.lower() and remove_template_base_files:
if isfile("WAPT\\changelog.txt"):
remove_file("WAPT\\changelog.txt")
if isfile("WAPT\\icon.png"):
remove_file("WAPT\\icon.png")
if not silent:
control_package = control_package.replace("-template", "").strip()
control.package = ask_input(control.package, "You can redefine the package name", control_package)
if not control.package:
control.package = old_control_package
control.save_control_to_wapt()
return control.package
def complete_control_name(control, control_name="", silent=False):
"""Requesting that the user provide a package name to be entered into control.name field
Args:
control (str or waptpackage.PackageEntry): The path of control file or his PackageEntry call
control_name (str) : Prefilled control_name (default: control.name whitout "template" word)
silent (bool) : If True, no user input dialog will be displayed. (default: False)
"""
if not isinstance(control, PackageEntry):
pkg_dir = convert_control_path_to_dir(control)
control = PackageEntry().load_control_from_wapt(pkg_dir)
old_control_name = control.name
if silent:
control.name = control_name
else:
if not control_name:
control_name = control.name
control_name = control_name.replace("Template", "").replace("template", "").strip()
control.name = ask_input(control.name, "You can redefine the name for the self-service", control_name)
control.save_control_to_wapt()
return control.name
def ask_input(title, text, default="", stay_on_top=False, raise_error=False):
"""
Opens a dialog box with an action input.
Args:
title (str): The title for the dialog.
text (str): Indicates which value the user should type.
default (str): The default value if the user does not want to type anything.
stay_on_top (bool): Indicates if the dialog box will always stay on top. Default is False.
raise_error (bool): Whether to raise an error if no response is given by the user.
Returns:
The response from the dialog box.
"""
import waptguihelper
response = waptguihelper.input_dialog(title, text, default, stay_on_top)
if not response and not response == "" and raise_error:
error("No response given by user")
return response
4fa67d409cb11b2511253b853d16908ce766a027126415b6cfdcf02fac7d458d : setup.py
5e0a07f78ea0b5c7d22685c542e95ef022686e4e2d485c78c4755b7ebf35a87a : policies.json
8b64bb3cc40f277e8fb9481aa1ae138c29c05a5a8c9ea160b82722a7ccb0863c : update_package.py
7891f1ca19ac8a9e41cb2963c0833bb3424a1dcc3f89e6ae484b1841a67063b2 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
a7bfa6f555b8b4635e31afa73cba36c384dba89370605e47876456244a17951f : luti.json
3bd1a030e3d1219b9527afe47f800b9f26d221250886dfde0ee5a6e878dca1f2 : WAPT/control