maos: point CT and Remote Key Provisioning at MAOS endpoints
- Commit
d387b22a60f5942f28be3829783b3c1af6aa9019- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-16 18:32 UTC (19 days ago)
- Parents
6b3c220
Repoint the GrapheneOS-mode Certificate Transparency and Remote Key Provisioning servers from GrapheneOS to MAOS, applied as build-time patches like the other GrapheneOS-source customizations (three new patches, wired into apply_maos_patches in build-maos.sh). Hardcoded Java hosts cannot be overridden by RRO. The tree copies of the target files remain pristine; the patches apply at build. CT (packages_modules_Connectivity_certificate_transparency.patch, packages/modules/Connectivity): Config.baseUrl() non-standard branch https://gstatic.grapheneos.org/android/certificate_transparency/ -> https://static.maproj.org/android/certificate_transparency/ (R2 mirror being built in parallel; same path layout). The VAL_STANDARD Google branch (www.gstatic.com) and VAL_OFF handling are untouched. RKP (frameworks_base_remote_key_provisioning.patch, frameworks/base): RemoteKeyProvisioningSettings GRAPHENEOS_PROXY_URL "https://remoteprovisioning.grapheneos.org/v1" -> "https://rkp.maproj.org/v1", renaming the private constant to MAOS_PROXY_URL. That rename is trivially safe: the constant is private with only its in-class getServerUrlOverride() caller (checked; the rkpd app calls getServerUrlOverride, not the field). The public GRAPHENEOS_PROXY mode int is kept, like the GNSS case names: its value is persisted in Settings.Global and referenced by RemoteProvisioningPrefController, so renaming it would be a needless cross-repo change. Owner DNS note: rkp.maproj.org is handled server-side (an HTTPS reverse proxy to Google RKP is being added to our server in parallel); no device-side DNS work in this commit. Until that proxy exists, MAOS-mode RKP provisioning will fail. Settings strings (packages_apps_Settings_ct_rkp_servers.patch, packages/apps/Settings, registered after settings.patch because its preimage is the post-settings.patch strings_ext.xml): cert_transparency_dl_grapheneos_server "GrapheneOS server" -> "MAOS servers" and remote_provisioning_enabled_grapheneos_proxy "GrapheneOS proxy" -> "MAOS servers", consistent with the SUPL/PSDS/conn-checks relabel in settings.patch. String names and the CertTransparency / RemoteProvisioning pref controllers are unchanged; the standard Google options (cert_transparency_dl_standard_server, remote_provisioning_enabled_google_server) are untouched. CertTransparencyDownloaderSetting.VAL_GRAPHENEOS and its int value are likewise kept (persisted setting, referenced by the CT downloader and Settings controller). Bypass check: grep over frameworks/, packages/ and device/ for gstatic.grapheneos.org and remoteprovisioning.grapheneos.org found only the two lines changed above. CT: Config.baseUrl() is the sole URL constructor (DownloadHelper only consumes it; the phenotype flags in Config are just flag names, no host defaults). RKP: in the default GRAPHENEOS_PROXY mode the override above is authoritative in rkpd Settings.getUrl(); the fallback (SharedPreferences URL, then remote_provisioning.hostname -> remoteprovisioning.googleapis.com from vendor/adevtool props) is reached only in STANDARD_SERVER mode, which is the intended Google path and is untouched, as is the default_hostname CBOR field that merely reports that property. Verified without a full OS build: git apply --check on pristine files passes for CT and RKP, and --reverse --check passes after applying (the idempotency probe apply_maos_patches uses). The Settings strings patch was verified sequentially: pristine strings_ext.xml + settings.patch (strings hunk) -> apply --check, apply, --reverse --check, and the patched XML parses. Also verified directly against the current ~/maos tree (predecessor patches already applied there) with git apply --check for all three patches, and bash -n on build-maos.sh. javac (prebuilts jdk21, prebuilts/sdk/37.0 public android.jar; no 37.1 jar exists in this tree) on patched vs pristine gives an identical error profile for both Java files: Config.java 5 errors, RemoteKeyProvisioningSettings.java 13 errors, all missing internal packages/symbols (android.ext.settings, android.annotation, com.android.internal.*) with zero syntax errors.
Diff
build-maos.sh
diff --git a/build-maos.sh b/build-maos.shindex a0fc881..7c4950e 100755--- a/build-maos.sh+++ b/build-maos.sh@@ -272,6 +272,8 @@ apply_maos_patches() { for spec in "build/make:platform_build.patch" "vendor/adevtool:adevtool.patch" \ "frameworks/base:frameworks_base.patch" \ "frameworks/base:frameworks_base_gnss_servers.patch" \+ "frameworks/base:frameworks_base_remote_key_provisioning.patch" \+ "packages/modules/Connectivity:packages_modules_Connectivity_certificate_transparency.patch" \ "frameworks/opt/telephony:frameworks_opt_telephony.patch" \ "packages/modules/Permission:permission_roles.patch" \ "frameworks/libs/systemui:frameworks_libs_systemui.patch" \@@ -279,6 +281,7 @@ apply_maos_patches() { "system/sepolicy:system_sepolicy.patch" \ "script:script.patch" \ "packages/apps/Settings:settings.patch" \+ "packages/apps/Settings:packages_apps_Settings_ct_rkp_servers.patch" \ "packages/apps/SetupWizard2:setupwizard2.patch" \ "external/roboto-fonts:roboto_fonts.patch" \ "packages/apps/GmsCompat:gmscompat.patch" \
patches/frameworks_base_remote_key_provisioning.patch
diff --git a/patches/frameworks_base_remote_key_provisioning.patch b/patches/frameworks_base_remote_key_provisioning.patchnew file mode 100644index 0000000..e8d1594--- /dev/null+++ b/patches/frameworks_base_remote_key_provisioning.patch@@ -0,0 +1,27 @@+diff --git a/core/java/android/ext/settings/RemoteKeyProvisioningSettings.java b/core/java/android/ext/settings/RemoteKeyProvisioningSettings.java+index 69959118c414..091ea6e82e70 100644+--- a/core/java/android/ext/settings/RemoteKeyProvisioningSettings.java++++ b/core/java/android/ext/settings/RemoteKeyProvisioningSettings.java+@@ -15,7 +15,12 @@ public class RemoteKeyProvisioningSettings {+ public static final int GRAPHENEOS_PROXY = 0;+ public static final int STANDARD_SERVER = 1;+ +- private static final String GRAPHENEOS_PROXY_URL = "https://remoteprovisioning.grapheneos.org/v1";++ // MAOS: self-hosted HTTPS reverse proxy to the Google RKP server++ // (rkp.maproj.org, DNS/proxy handled server-side). The public++ // GRAPHENEOS_PROXY mode constant is kept: its int value is persisted in++ // Settings.Global and referenced by Settings, so renaming it would be a++ // needless cross-repo change. Only this private URL constant is renamed.++ private static final String MAOS_PROXY_URL = "https://rkp.maproj.org/v1";+ + /** @hide */+ public static final IntSetting SERVER_SETTING = new IntSetting(+@@ -27,7 +32,7 @@ public class RemoteKeyProvisioningSettings {+ @Nullable+ public static String getServerUrlOverride(@NonNull Context ctx) {+ if (SERVER_SETTING.get(ctx) == GRAPHENEOS_PROXY) {+- return GRAPHENEOS_PROXY_URL;++ return MAOS_PROXY_URL;+ }+ + return null;
patches/packages_apps_Settings_ct_rkp_servers.patch
diff --git a/patches/packages_apps_Settings_ct_rkp_servers.patch b/patches/packages_apps_Settings_ct_rkp_servers.patchnew file mode 100644index 0000000..31f927d--- /dev/null+++ b/patches/packages_apps_Settings_ct_rkp_servers.patch@@ -0,0 +1,22 @@+diff --git a/res/values/strings_ext.xml b/res/values/strings_ext.xml+index a20289c..d8326f3 100644+--- a/res/values/strings_ext.xml++++ b/res/values/strings_ext.xml+@@ -55,7 +55,7 @@+ <string name="supl_disabled_summary">Will make acquiring location lock significantly slower, especially if PSDS is turned off too</string>+ + <string name="remote_provisioning_title">Attestation key provisioning</string>+- <string name="remote_provisioning_enabled_grapheneos_proxy">GrapheneOS proxy</string>++ <string name="remote_provisioning_enabled_grapheneos_proxy">MAOS servers</string>+ <string name="remote_provisioning_enabled_google_server">Google server</string>+ <string name="remote_provisioning_disabled">Off</string>+ +@@ -323,7 +323,7 @@ May cause unreliable service. Use at your own risk.+ <string name="exploit_protection_summary">Device and app security improvements</string>+ + <string name="cert_transparency_dl_title">Certificate Transparency downloads</string>+- <string name="cert_transparency_dl_grapheneos_server">GrapheneOS server</string>++ <string name="cert_transparency_dl_grapheneos_server">MAOS servers</string>+ <string name="cert_transparency_dl_standard_server">Standard (Google) server</string>+ <string name="cert_transparency_dl_off">Off</string>+ <string name="cert_transparency_dl_footer">"Certificate Transparency (CT) is an Internet standard designed to enhance the security of digital certificates. It requires Certificate Authorities (CAs) to submit all issued certificates to a public log that records them, increasing transparency and accountability in the certificate issuance process.
patches/packages_modules_Connectivity_certificate_transparency.patch
diff --git a/patches/packages_modules_Connectivity_certificate_transparency.patch b/patches/packages_modules_Connectivity_certificate_transparency.patchnew file mode 100644index 0000000..c732ede--- /dev/null+++ b/patches/packages_modules_Connectivity_certificate_transparency.patch@@ -0,0 +1,16 @@+diff --git a/networksecurity/service/src/com/android/server/net/ct/Config.java b/networksecurity/service/src/com/android/server/net/ct/Config.java+index c252d0bd2d..3aed2da5a0 100644+--- a/networksecurity/service/src/com/android/server/net/ct/Config.java++++ b/networksecurity/service/src/com/android/server/net/ct/Config.java+@@ -37,7 +37,10 @@ final class Config {+ return "https://www.gstatic.com/android/certificate_transparency/";+ }+ // VAL_OFF is handled separately+- return "https://gstatic.grapheneos.org/android/certificate_transparency/";++ // MAOS: self-hosted mirror on the static R2 bucket (static.maproj.org),++ // same /android/certificate_transparency/ path layout as the GrapheneOS++ // mirror it replaces. The VAL_STANDARD (Google) branch above is untouched.++ return "https://static.maproj.org/android/certificate_transparency/";+ }+ + static String getCommonBaseUrlPart() {