Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix moving cert on Android 14 with Magisk Canary 26.4 #53

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion module/module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=adguardcert
name=AdGuard Certificate
version=v2.0
version=v2.1-beta1
versionCode=35
author=AdGuard
description=Moves AdGuard's root CA certificate from the user certificate store to the system certificate store.
Expand Down
6 changes: 5 additions & 1 deletion module/post-fs-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,18 @@ if [ -d /apex/com.android.conscrypt/cacerts ]; then
cp -f /apex/com.android.conscrypt/cacerts/* /data/local/tmp/adg-ca-copy/

# Do the same as in Magisk module
cp -f ${AG_CERT_FILE} /data/local/tmp/adg-ca-copy
cp -f ${AG_CERT_FILE} /data/local/tmp/adg-ca-copy/${AG_CERT_HASH}.0
chown -R 0:0 /data/local/tmp/adg-ca-copy
set_context /apex/com.android.conscrypt/cacerts /data/local/tmp/adg-ca-copy

# Mount directory inside APEX if it is valid, and remove temporary one.
CERTS_NUM="$(ls -1 /data/local/tmp/adg-ca-copy | wc -l)"
if [ "$CERTS_NUM" -gt 10 ]; then
mount --bind /data/local/tmp/adg-ca-copy /apex/com.android.conscrypt/cacerts
for pid in 1 $(pgrep zygote) $(pgrep zygote64); do
nsenter --mount=/proc/${pid}/ns/mnt -- \
/bin/mount --bind /data/local/tmp/adg-ca-copy /apex/com.android.conscrypt/cacerts
done
else
echo "Cancelling replacing CA storage due to safety"
fi
Expand Down