Provision the iCloud Thunderbird profile on GNOME desktops

Seed a Thunderbird profile on ikaros and nymph with the iCloud account
already declared: IMAP imap.mail.me.com:993 over SSL/TLS, SMTP
smtp.mail.me.com:587 over STARTTLS, identity and folder mapping, one
CalDAV calendar and one CardDAV address book.

Account defaults are rendered into a managed user.js because Thunderbird
rewrites prefs.js on exit, while user.js is re-applied at every start.
profiles.ini is seeded only when absent so a profile list Thunderbird
already owns is never replaced.

The address comes from vault_icloud_email and the display name from
vault_personal_full_name. The app-specific password is deliberately not
stored: Thunderbird requests it on first use and keeps it in its own
credential store.

Validated by rendering the templates and running Thunderbird 158 headless
against a sandbox profile: the account was accepted, Local Folders was
created by Thunderbird itself, the CalDAV calendar registered as default
and the CardDAV directory instantiated its abook-icloud.sqlite.
This commit is contained in:
2026-11-01 19:30:10 +01:00
parent 4e8665a7d4
commit 1e40a867e7
7 changed files with 176 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
// Managed by Ansible from profile_desktop_gnome (tag: thunderbird).
// Thunderbird rewrites prefs.js on exit, so the declared defaults live here
// and are re-applied at every start. Do not edit this file by hand.
//
// The account password is intentionally absent: iCloud mail requires an
// app-specific password, which Thunderbird prompts for and stores in its own
// credential store on first use.
// Mail account
user_pref("mail.accountmanager.accounts", "account1");
user_pref("mail.accountmanager.defaultaccount", "account1");
user_pref("mail.account.account1.server", "server1");
user_pref("mail.account.account1.identities", "id1");
user_pref("mail.server.server1.type", "imap");
user_pref("mail.server.server1.hostname", "{{ thunderbird_icloud_imap_host }}");
user_pref("mail.server.server1.port", {{ thunderbird_icloud_imap_port }});
user_pref("mail.server.server1.socketType", 3);
user_pref("mail.server.server1.authMethod", 3);
user_pref("mail.server.server1.userName", "{{ thunderbird_icloud_email }}");
user_pref("mail.server.server1.name", "{{ thunderbird_icloud_account_name }}");
user_pref("mail.server.server1.directory-rel", "[ProfD]ImapMail/{{ thunderbird_icloud_imap_host }}");
user_pref("mail.server.server1.directory", "{{ user_home }}/.thunderbird/{{ thunderbird_profile_dir }}/ImapMail/{{ thunderbird_icloud_imap_host }}");
user_pref("mail.server.server1.max_cached_connections", 5);
user_pref("mail.server.server1.check_new_mail", true);
user_pref("mail.server.server1.check_time", 10);
user_pref("mail.server.server1.login_at_startup", true);
user_pref("mail.server.server1.empty_trash", false);
user_pref("mail.identity.id1.fullName", "{{ thunderbird_full_name }}");
user_pref("mail.identity.id1.useremail", "{{ thunderbird_icloud_email }}");
user_pref("mail.identity.id1.valid", true);
user_pref("mail.identity.id1.smtpServer", "smtp1");
user_pref("mail.identity.id1.compose_html", true);
user_pref("mail.identity.id1.fcc_folder", "mailbox://{{ thunderbird_icloud_email }}@{{ thunderbird_icloud_imap_host }}/Sent%20Messages");
user_pref("mail.identity.id1.draft_folder", "mailbox://{{ thunderbird_icloud_email }}@{{ thunderbird_icloud_imap_host }}/Drafts");
user_pref("mail.smtpservers", "smtp1");
user_pref("mail.smtpserver.smtp1.hostname", "{{ thunderbird_icloud_smtp_host }}");
user_pref("mail.smtpserver.smtp1.port", {{ thunderbird_icloud_smtp_port }});
user_pref("mail.smtpserver.smtp1.try_ssl", 2);
user_pref("mail.smtpserver.smtp1.authMethod", 3);
user_pref("mail.smtpserver.smtp1.username", "{{ thunderbird_icloud_email }}");
user_pref("mail.smtpserver.smtp1.description", "{{ thunderbird_icloud_account_name }} SMTP");
// Calendar (CalDAV). Calendars are discovered from the registry branch.
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.type", "caldav");
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.name", "{{ thunderbird_icloud_account_name }}");
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.uri", "{{ thunderbird_icloud_caldav_url }}");
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.username", "{{ thunderbird_icloud_email }}");
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.refreshInterval", 30);
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.readOnly", false);
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.disabled", false);
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.color", "#3a87ad");
user_pref("calendar.list.sortOrder", "{{ thunderbird_icloud_calendar_id }}");
// Address book (CardDAV). dirType 102 is nsIAbManager.CARDDAV_DIRECTORY_TYPE.
user_pref("ldap_2.servers.icloud.dirType", 102);
user_pref("ldap_2.servers.icloud.uid", "{{ thunderbird_icloud_addressbook_uid }}");
user_pref("ldap_2.servers.icloud.description", "{{ thunderbird_icloud_account_name }}");
user_pref("ldap_2.servers.icloud.filename", "abook-icloud.sqlite");
user_pref("ldap_2.servers.icloud.isOffline", false);
user_pref("ldap_2.servers.icloud.position", 3);
user_pref("ldap_2.servers.icloud.carddav.url", "{{ thunderbird_icloud_carddav_url }}");
user_pref("ldap_2.servers.icloud.carddav.username", "{{ thunderbird_icloud_email }}");