tis-firefox-config-template
68.3-6
Configuration pour Mozilla Firefox - Le paquet n'aura aucun effet si une GPO ADMX pour Firefox est appliquée
1475 téléchargements
Voir le résultat de la construction Voir l'analyse de VirusTotal
Description
- package : tis-firefox-config-template
- name : Mozilla Firefox Configuration
- version : 68.3-6
- categories : System and network
- maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ,Gaëtan SEGAT,Jordan ARNAUD
- installed_size :
- editor : Mozilla Foundation
- licence : wapt_public
- signature_date : 2024-03-13T16:00:07.943725
- size : 13.36 Ko
- locale : all
- target_os : windows
- impacted_process : firefox
- architecture : all
- Page d'accueil : https://support.mozilla.org/kb/customizing-firefox-using-policiesjson
control
package : tis-firefox-config-template
version : 68.3-6
architecture : all
section : base
priority : optional
name : Mozilla Firefox Configuration
categories : System and network
maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ,Gaëtan SEGAT,Jordan ARNAUD
description : Configuration for Mozilla Firefox - The package will not have any effect if an ADMX GPO for Firefox is applied
depends :
conflicts :
maturity : PROD
locale : all
target_os : windows
min_wapt_version : 2.5
sources : https://github.com/mozilla/policy-templates/
installed_size :
impacted_process : firefox
description_fr : Configuration pour Mozilla Firefox - Le paquet n'aura aucun effet si une GPO ADMX pour Firefox est appliquée
description_pl : Konfiguracja dla Mozilli Firefox - pakiet nie będzie miał żadnego wpływu, jeśli zastosowano ADMX GPO dla Firefoxa
description_de : Konfiguration für Mozilla Firefox - Das Paket hat keine Auswirkungen, wenn ein ADMX GPO für Firefox angewendet wird
description_es : Configuración para Mozilla Firefox - El paquete no tendrá ningún efecto si se aplica un GPO de ADMX para Firefox
description_pt : Configuração para Mozilla Firefox - O pacote não terá qualquer efeito se for aplicado um ADMX GPO para Firefox
description_it : Configurazione per Mozilla Firefox - Il pacchetto non avrà alcun effetto se viene applicato un GPO ADMX per Firefox
description_nl : Configuratie voor Mozilla Firefox - Het pakket zal geen effect hebben als een ADMX GPO voor Firefox wordt toegepast
description_ru : Конфигурация для Mozilla Firefox - Пакет не будет иметь никакого эффекта, если применяется ADMX GPO для Firefox
audit_schedule :
editor : Mozilla Foundation
keywords :
licence : wapt_public
homepage : https://support.mozilla.org/kb/customizing-firefox-using-policiesjson
package_uuid : 997eed65-0686-417d-9567-2a1185c1334f
valid_from :
valid_until :
forced_install_on :
changelog :
min_os_version :
max_os_version :
icon_sha256sum : 0750ff4649741284d4b6140fbca1d53a7a3e41215d524181a139e761db490311
signer : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature : yhYoRMS9/WZrqWNctkBLM6mnrEn9ROwXOHb7YpEfAhu4QiVOyk2tVF1tIP++GrEk2euD8cTV+01wIu1rBmMMJKiu/1aO0Ebmlx+ybB/rmyrESq5dmXwxcy5CNGrAHYIysHAxf1atE4O5aosbxP3e+NCFwcyvgqLufIu+HRW18U4fLVZnLFvwlDyEbhLfciAiwnjCxsU7wPAIRO7YKi4Hgw/RgcPrA/c+SgmzHk1DJj46p70OZXnmxbbycynz90H5+ebax8KW4lKhy6N1Y0ydBxRVaLsU/icwmR54efDGBdWc/ZSwZP+yYiY975lWB7rfzbz8xRGmNJFWYAs9I2H/+A==
signature_date : 2024-03-13T16:00:07.943725
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
from setuphelpers import *
# Installation procedure: https://support.mozilla.org/kb/customizing-firefox-using-policiesjson
# https://klaus-hartnegg.de/gpo/2018-05-26-Firefox-Policies.html
# Use Add-ons Enterprise Policy Generator to create policies.json an copy in WAPT package folder:
# https://addons.mozilla.org/firefox/addon/enterprise-policy-generator/
# Defining variables
app_name = "Mozilla Firefox"
policies_file = "policies.json"
def install():
# Is a Firefox application present on the workstation
registry_app = installed_softwares(app_name)
if params.get("running_as_luti", False):
WAPT.install("tis-firefox")
elif not registry_app:
error("The Firefox does not present in the workstation")
# Installing the package
for ffox in installed_softwares(app_name):
# Initializing variables
ffox_dir = ffox["install_location"]
ffox_dist_dir = makepath(ffox_dir, "distribution")
policies_path = makepath(ffox_dist_dir, policies_file)
killalltasks(control.impacted_process.split(","))
# Create distribution folder if not present
if not isdir(ffox_dist_dir):
mkdirs(ffox_dist_dir)
# Forcing package Firefox configuration
if isfile(policies_path):
remove_file(policies_path)
# Copy Firefox configuration
filecopyto(policies_file, policies_path)
# Removing policies from registry since it bypass the policies.json file (source: https://support.mozilla.org/bm/questions/1236197)
ffox_policies_reg_path = r"SOFTWARE\Policies\Mozilla\Firefox"
if reg_key_exists(HKEY_LOCAL_MACHINE, ffox_policies_reg_path):
registry_deletekey(HKEY_LOCAL_MACHINE, ffox_policies_reg_path, "", force=True)
def uninstall():
# Uninstalling the package
for ffox in installed_softwares(app_name):
# Initializing variables
ffox_dir = ffox["install_location"]
ffox_dist_dir = makepath(ffox_dir, "distribution")
policies_path = makepath(ffox_dist_dir, policies_file)
# Removing Firefox configuration
if isfile(policies_path):
remove_file(policies_path)
# Adding Minimal configuration for Firefox you may use the package "tis-config-firefox" for further options
if not isfile(policies_path):
registry_set(HKEY_LOCAL_MACHINE, r"SOFTWARE\Policies\Mozilla\Firefox", "DisableAppUpdate", 1, REG_DWORD)
registry_set(HKEY_LOCAL_MACHINE, r"SOFTWARE\Policies\Mozilla\Firefox", "DisableTelemetry", 1, REG_DWORD)
def audit():
# Verifying that the configuration is applied
for ffox in installed_softwares(app_name):
# Initializing variables
ffox_dir = ffox["install_location"]
ffox_dist_dir = makepath(ffox_dir, "distribution")
policies_path = makepath(ffox_dist_dir, policies_file)
if not isfile(policies_path):
print("WARNING: Configuration is NOT applied for %s, Re-applying" % ffox["name"])
install()
return "WARNING"
else:
print("OK: Configuration is correctly applied for %s" % ffox["name"])
return "OK"
print("WARNING: Firefox is NOT installed")
return "WARNING"
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"):
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
f81e4f85d5a65c52e03993350d71e044d9d0b9a429db5b47573724bdf5ff372a : setup.py
: __pycache__
e8acc464d1fd9805e4ba4c44ca95f77ec4f66ff0fda155404210e11960610515 : policies.json
23f3d9a8f8aafd1cd8136b19e9273164425a5422f6621e60b47bf213daba985a : update_package.py
0750ff4649741284d4b6140fbca1d53a7a3e41215d524181a139e761db490311 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
ca13187e6d5faee86d8f08a0466678d5dbf5b3fbdb9c44b2741dd3b518c4bb14 : luti.json
25b857557808630a05e35b0659d4f0f25807df9f40ac76de74a647072a6dfa2b : WAPT/control