apache-require/convert.sed
Brice Waegeneire ca18a45319 Dirty commit
2021-01-12 15:02:38 +01:00

29 lines
739 B
Sed

# This script dumbly migrate from Apache's configuration 2.2 to 2.4.
#
# Here are it's current quirk:
# - it will modify config even if it's written to be cross compatible between thoses version
# - it assume "Allow from" only specifies IPs
# Order
/Order[[:blank:]]*deny,allow/Id
# * Deny
# s/Deny[[:blank:]]*from[[:blank:]]*all/Require all denied/I
/Deny[[:blank:]]*from[[:blank:]]*all/I {
N
s/.?\([[:blank:]]*\)Allow[[:blank:]]*from/\1Require ip/I
s/Deny[[:blank:]]*from[[:blank:]]*all/Require all denied/I
}
s/Deny from env=/Require not env /I
# * Allow
s/Allow[[:blank:]]*from[[:blank:]]*all/Require all granted/I
s/Allow[[:blank:]]*from/Require ip/I
# * Satisfy
# It's the default value
/Satisfy[[:blank:]]*any/Id