mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-04-28 07:20:19 +00:00
hardening: Reindent
This commit is contained in:
parent
21818ae592
commit
ac4d74b6d9
@ -35,24 +35,24 @@ if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for flag in "${!hardeningEnableMap[@]}"; do
|
for flag in "${!hardeningEnableMap[@]}"; do
|
||||||
case $flag in
|
case $flag in
|
||||||
pie)
|
pie)
|
||||||
if [[ ! ("$*" =~ " -shared " || "$*" =~ " -static ") ]]; then
|
if [[ ! ("$*" =~ " -shared " || "$*" =~ " -static ") ]]; then
|
||||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling LDFlags -pie >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling LDFlags -pie >&2; fi
|
||||||
hardeningLDFlags+=('-pie')
|
hardeningLDFlags+=('-pie')
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
relro)
|
relro)
|
||||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling relro >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling relro >&2; fi
|
||||||
hardeningLDFlags+=('-z' 'relro')
|
hardeningLDFlags+=('-z' 'relro')
|
||||||
;;
|
;;
|
||||||
bindnow)
|
bindnow)
|
||||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling bindnow >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling bindnow >&2; fi
|
||||||
hardeningLDFlags+=('-z' 'now')
|
hardeningLDFlags+=('-z' 'now')
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Ignore unsupported. Checked in Nix that at least *some*
|
# Ignore unsupported. Checked in Nix that at least *some*
|
||||||
# tool supports each flag.
|
# tool supports each flag.
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -35,38 +35,38 @@ if (( "${NIX_DEBUG:-0}" >= 1 )); then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for flag in "${!hardeningEnableMap[@]}"; do
|
for flag in "${!hardeningEnableMap[@]}"; do
|
||||||
case $flag in
|
case $flag in
|
||||||
fortify)
|
fortify)
|
||||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling fortify >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling fortify >&2; fi
|
||||||
hardeningCFlags+=('-O2' '-D_FORTIFY_SOURCE=2')
|
hardeningCFlags+=('-O2' '-D_FORTIFY_SOURCE=2')
|
||||||
;;
|
;;
|
||||||
stackprotector)
|
stackprotector)
|
||||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling stackprotector >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling stackprotector >&2; fi
|
||||||
hardeningCFlags+=('-fstack-protector-strong' '--param' 'ssp-buffer-size=4')
|
hardeningCFlags+=('-fstack-protector-strong' '--param' 'ssp-buffer-size=4')
|
||||||
;;
|
;;
|
||||||
pie)
|
pie)
|
||||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling CFlags -fPIE >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling CFlags -fPIE >&2; fi
|
||||||
hardeningCFlags+=('-fPIE')
|
hardeningCFlags+=('-fPIE')
|
||||||
if [[ ! ("$*" =~ " -shared " || "$*" =~ " -static ") ]]; then
|
if [[ ! ("$*" =~ " -shared " || "$*" =~ " -static ") ]]; then
|
||||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling LDFlags -pie >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling LDFlags -pie >&2; fi
|
||||||
hardeningCFlags+=('-pie')
|
hardeningCFlags+=('-pie')
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
pic)
|
pic)
|
||||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling pic >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling pic >&2; fi
|
||||||
hardeningCFlags+=('-fPIC')
|
hardeningCFlags+=('-fPIC')
|
||||||
;;
|
;;
|
||||||
strictoverflow)
|
strictoverflow)
|
||||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling strictoverflow >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling strictoverflow >&2; fi
|
||||||
hardeningCFlags+=('-fno-strict-overflow')
|
hardeningCFlags+=('-fno-strict-overflow')
|
||||||
;;
|
;;
|
||||||
format)
|
format)
|
||||||
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling format >&2; fi
|
if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling format >&2; fi
|
||||||
hardeningCFlags+=('-Wformat' '-Wformat-security' '-Werror=format-security')
|
hardeningCFlags+=('-Wformat' '-Wformat-security' '-Werror=format-security')
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Ignore unsupported. Checked in Nix that at least *some*
|
# Ignore unsupported. Checked in Nix that at least *some*
|
||||||
# tool supports each flag.
|
# tool supports each flag.
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user