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

magisk: Better hiddens #166

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 13 additions & 3 deletions magisk/service.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/system/bin/sh
# Conditional MagiskHide properties

MODDIR=${0%/*}

maybe_set_prop() {
local prop="$1"
local contains="$2"
Expand All @@ -20,12 +22,20 @@ maybe_set_prop vendor.boot.mode recovery unknown
maybe_set_prop ro.boot.hwc CN GLOBAL
maybe_set_prop ro.boot.hwcountry China GLOBAL

resetprop --delete ro.build.selinux
# Kernel cmdline
chmod 0640 /proc/cmdline

# SELinux permissive
resetprop --delete ro.build.selinux

if [[ "$(cat /sys/fs/selinux/enforce)" == "0" ]]; then
chmod 640 /sys/fs/selinux/enforce
chmod 440 /sys/fs/selinux/policy
echo "1" > "${MODDIR}/enforce"

chmod 0640 "${MODDIR}/enforce"
chmod 0640 /sys/fs/selinux/enforce
chmod 0440 /sys/fs/selinux/policy

mount -o bind "${MODDIR}/enforce /sys/fs/selinux/enforce"
fi

# Late props which must be set after boot_completed
Expand Down
3 changes: 3 additions & 0 deletions magisk/system.prop
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ vendor.boot.vbmeta.device_state=locked
ro.build.type=user
ro.debuggable=0
ro.secure=1

# SELinux
ro.boot.selinux=enforcing