www.smiyasaka.com は、 2022 年 11月から Oracle LInux 8.X にOSを変更しました。 |
sed コマンドによる httpd-2.4.XX の |
|
=============================================
sed -i -e "1s/^#/# *** httpd-2\.4\.XX httpd-ssl\.conf(圧縮あり) ***/
#---------------------------------------------------------------------
# SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES:!DH
# SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES:!DH
# 上記の設定にする時には、下記の/SSLの#を削除
#---------------------------------------------------------------------
#/SSLCipherSuite/s/\$/\:\!DH/
#/SSLProxyCipherSuite/s/\$/\:\!DH/
#---------------------------------------------------------------------
# 上記設定にする時には、「ここから」から「ここまで」を削除
# 「ここから」
#---------------------------------------------------------------------
/SSLCipherSuite HIGH:MEDIUM:\!MD5:\!RC4:\!3DES/s/^/#/
#---------------------------------------------------------------------
# ( \ 4個で \ 1個挿入 )
#---------------------------------------------------------------------
/SSLCipherSuite HIGH:MEDIUM:\!MD5:\!RC4:\!3DES/a\#\n\
SSLCipherSuite \"TLS_AES_256_GCM_SHA384 \\\\\n\
TLS_CHACHA20_POLY1305_SHA256 \\\\\n\
ECDHE-RSA-AES128-GCM-SHA256 \\\\\n\
ECDHE-RSA-AES256-GCM-SHA384 \\\\\n\
ECDHE-RSA-AES256-SHA \\\\\n\
ECDHE-RSA-AES256-SHA384 \\\\\n\
DHE-RSA-AES256-GCM-SHA384 \\\\\n\
DHE-RSA-AES256-SHA \\\\\n\
DHE-RSA-AES256-SHA256\"\n\
#---------------------------------------------------------------------
/SSLProxyCipherSuite HIGH:MEDIUM:\!MD5:\!RC4:\!3DES/s/^/#/
#---------------------------------------------------------------------
# ( \ 4個で \ 1個挿入 )
#---------------------------------------------------------------------
/SSLProxyCipherSuite HIGH:MEDIUM:\!MD5:\!RC4:\!3DES/a\#\n\
SSLProxyCipherSuite \"TLS_AES_256_GCM_SHA384 \\\\\n\
TLS_CHACHA20_POLY1305_SHA256 \\\\\n\
ECDHE-RSA-AES128-GCM-SHA256 \\\\\n\
ECDHE-RSA-AES256-GCM-SHA384 \\\\\n\
ECDHE-RSA-AES256-SHA \\\\\n\
ECDHE-RSA-AES256-SHA384 \\\\\n\
DHE-RSA-AES256-GCM-SHA384 \\\\\n\
DHE-RSA-AES256-SHA \\\\\n\
DHE-RSA-AES256-SHA256\"\n\
#---------------------------------------------------------------------
# 「ここまで」
#---------------------------------------------------------------------
/SSLProtocol/s/-SSLv3/-SSLv2 -SSLv3/
/SSLProxyProtocol/s/-SSLv3/-SSLv2 -SSLv3/
s/DocumentRoot \"\/usr\/local\/apache2\/htdocs\"/DocumentRoot\
\"\/var\/www\/html\/HHHHHH"/g
s/ServerName www\.example\.com:443/ServerName XXXXXX:443/g
s/ServerAdmin you@example\.com/ServerAdmin XXXXXX/g
#---------------------------------------------------------------------
s/ErrorLog \"\/usr\/local\/apache2\/logs\/error_log\"/\n\
ErrorLog \"| \/usr\/local\/apache2\/bin\/rotatelogs\
\/usr\/local\/apache2\/logs\/\
HHHHHH_error_log_\%Y\%m\%d 86400 540\"/
#---------------------------------------------------------------------
/SSLEngine on/a#\n\
Header set Strict-Transport-Security\
\"max-age=315360000;includeSubDomains\"\n\
Header edit Set-Cookie \^\(\.*\)\$ \$1;HttpOnly;Secure\n\
Header always set X-Frame-Options SAMEORIGIN
#---------------------------------------------------------------------
s/\/usr\/local\/apache2\/conf\/server\.crt/\/etc\/letsencrypt\/\
live\/HHHHHH\/cert\.pem/g
s/\/usr\/local\/apache2\/conf\/server\.key/\/etc\/letsencrypt\/\
live\/HHHHHH\/privkey\.pem/g
s/#SSLCertificateChainFile\
\"\/usr\/local\/apache2\/conf\/server\-ca\.crt\
\"/SSLCertificateChainFile\
\"\/etc\/letsencrypt\/live\/HHHHHH/chain\.pem\"/g
#---------------------------------------------------------------------
s/cgi|shtml|phtml|php/cgi|pl|shtml|phtml|html|php/g
s/<Directory \"\/usr\/local\/apache2\/cgi\-bin\">/<Directory\
\"\/var\/www\/html\/HHHHHH\">/g
#---------------------------------------------------------------------
/CustomLog/s/^/#/
s/<\/VirtualHost>/#\n\
#===========================================\n\
# 不要なログの記録をさせない設定\n\
#===========================================\n\
#\n\
Include conf\/extra\/httpd-log\.conf\n\
\n\
#------------------------------------------------------------------\n\
# ここからは、圧縮設定です。\n\
#------------------------------------------------------------------\n\
#\n\
Include conf\/extra\/httpd-zgip\.conf\n\
#\n\
#---------------------------------------------------\n\
# セキュリティ対策のため、最終行に追加しておきます。\n\
# サーバ署名\(バージョンとサーバ名\)のOFF\n\
ServerSignature Off\n\
#\n\
<\/VirtualHost>/" /usr/local/apache2/conf/extra/httpd-ssl.conf
下記は、編集内容確認コマンドです。
cat -n /usr/local/apache2/conf/extra/httpd-ssl.conf
----------------------------------------------------------------------
|