Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156774278
D28418.id84330.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D28418.id84330.diff
View Options
diff --git a/usr.sbin/bsdinstall/scripts/hardening b/usr.sbin/bsdinstall/scripts/hardening
--- a/usr.sbin/bsdinstall/scripts/hardening
+++ b/usr.sbin/bsdinstall/scripts/hardening
@@ -28,6 +28,20 @@
: ${DIALOG_OK=0}
+set_aslr_sysctls()
+{
+ for bit in 32 64; do
+ if ! sysctl -Nq kern.elf$bit.aslr.enable >/dev/null; then
+ continue
+ fi
+ cat >> $BSDINSTALL_TMPETC/sysctl.conf.hardening <<-EOF
+ kern.elf$bit.aslr.enable=1
+ kern.elf$bit.aslr.pie_enable=1
+ kern.elf$bit.aslr.honor_sbrk=0
+ EOF
+ done
+}
+
echo -n > $BSDINSTALL_TMPETC/rc.conf.hardening
echo -n > $BSDINSTALL_TMPETC/sysctl.conf.hardening
echo -n > $BSDINSTALL_TMPBOOT/loader.conf.hardening
@@ -48,6 +62,7 @@
"8 disable_sendmail" "Disable Sendmail service" ${disable_sendmail:-off} \
"9 secure_console" "Enable console password prompt" ${secure_console:-off} \
"10 disable_ddtrace" "Disallow DTrace destructive-mode" ${disable_ddtrace:-off} \
+ "11 enable_aslr" "Enable address layout randomization" ${enable_aslr:-off} \
2>&1 1>&3 )
exec 3>&-
@@ -86,6 +101,9 @@
disable_ddtrace)
echo 'security.bsd.allow_destructive_dtrace=0' >> $BSDINSTALL_TMPBOOT/loader.conf.hardening
;;
+ enable_aslr)
+ set_aslr_sysctls
+ ;;
esac
done
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 17, 6:40 AM (4 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33180164
Default Alt Text
D28418.id84330.diff (1 KB)
Attached To
Mode
D28418: bsdinstall: add knob to set ASLR sysctls
Attached
Detach File
Event Timeline
Log In to Comment