Nginx はインストールされているが ModSecurity が追加されていない状況を示すために、次の操作では、最初に Nginx をインストールし、次に ModSecurity モジュールを追加します。 ModSecurity は、nginx と完全に互換性のあるオープンソースのクロスプラットフォーム Web アプリケーション ファイアウォール (WAF) エンジンです。nginx によって公式に推奨されている WAF であり、OWASP ルールをサポートしています。 中国語ウェブサイト: http://www.modsecurity.cn 実際の適用については、http://www.modsecurity.cn/practice/ を参照してください。 1. ダウンロード1. Nginxをダウンロードする http://nginx.org/download/nginx-1.14.2.tar.gz をダウンロードしてください 2. ModSecurityのダウンロード http://www.modsecurity.cn/download/modsecurity/modsecurity-v3.0.4.tar.gz をダウンロードしてください 2. 展開1.Nginxのデプロイメント1.1 インストールの依存関係 yum インストール -y pcre* openssl* gcc c++ make 1.2 解凍したファイルをコンパイルしてインストールする tar -xvf nginx-1.14.2.tar.gz nginx-1.14.2をインストールします 構成モジュール ./CONFIGURE ---PREFIX =/usr/local/nginx - sbin-path =/usr/local/nginx/sbin/nginx - conf-path =/usr/nginx/conf/nginx.conf -error-log-path =/var/log/nginx/error.log-http-log-path = bar/var/var/var /nginx/nginx.pid - lock-path =/var/lock/nginx.lock.lock - user = nginx - group = nginx -with-http_ssl_module -with-http_stub_status_module -with-http_gzip_static_module -htp-hptpats/tmp-bodule-bodule-bodule-bodule-body-body ttp-proxy-temp-path =/var/tmp/nginx/proxy/-http-fastcgi-temp-path =/var/tmp/nginx/fcgi/ - http-uwsgi-temp-path =/var/tmp/nginx/uwsgi-http-scgi-temp-p-ppat -PCREで コンパイルの実行 作る インストールする アカウントとディレクトリを作成する ユーザー追加 nginx -s /sbin/nologin mkdir /var/tmp/nginx/ 2. ModSecurityの展開2.1 インストールの依存関係 yum install -y gcc-c++ flex bison yajl yajl-devel curl-devel curl GeoIP-devel doxygen zlib-devel pcre-devel lmdb-devel libxml2-devel ssdeep-devel lua-devel libtool autoconf automake 2.2 解凍したファイルをコンパイルしてインストールする tar -xvf modsecurity-v3.0.4.tar.gz cd modsecurity-v3.0.4/ コンパイルしてインストールする ./configure 作る インストールする cp modsecurity.conf-推奨 /usr/local/modsecurity/modsecurity.conf cp unicode.mapping /usr/local/modsecurity/ 3. ModSecurityモジュールを追加する3.1 Nginx コンパイルパラメータを表示する nginx の sbin ディレクトリに nginx の sbin ディレクトリを作成します。 3.2 ModSecurityモジュールをダウンロードする git クローン https://github.com/SpiderLabs/ModSecurity-nginx.git または、https://github.com/SpiderLabs/ModSecurity-nginx からダウンロードしてください。 3.3 Nginxを再コンパイルする 減圧モジュール ModSecurity-nginx-master.zip を解凍します。 #インストールパッケージをダウンロードする場合のみ、git cloneの場合は不要 コンパイルしてインストールする ./CONFIGURE ---PREFIX =/usr/local/nginx - sbin-path =/usr/local/nginx/sbin/nginx - conf-path =/usr/nginx/conf/nginx.conf -error-log-path =/var/log/nginx/error.log-http-log-path = bar/var/var/var /nginx/nginx.pid - lock-path =/var/lock/nginx.lock.lock - user = nginx - group = nginx -with-http_ssl_module -with-http_stub_status_module -with-http_gzip_static_module -htp-hptpats/tmp-bodule-bodule-bodule-bodule-body-body ttp-proxy-temp-path =/var/tmp/nginx/proxy/-http-fastcgi-temp-path =/var/tmp/nginx/fcgi/ - http-uwsgi-temp-path =/var/tmp/nginx/uwsgi-http-scgi-temp-p-ppat -with-pcre -add-module = ../modsecurity-nginx #ここに注意/ModSecurity-nginx パスを作成 インストールする /usr/local/nginx/sbin/nginx -V #ModSecurityモジュールがすでに利用可能であることを確認します プロフィールを追加する /usr/local/nginx/conf/modsecurity ディレクトリに移動します。 cp /usr/local/modsecurity/modsecurity.conf /usr/local/nginx/conf/modsecurity/ cp /usr/local/modsecurity/unicode.mapping /usr/local/nginx/conf/modsecurity/ 4. Nginx仮想ホストを構成する4.1 仮想ホストの設定 vim /usr/local/nginx/conf/nginx.conf modsecurity オン; modsecurity_rules_file /usr/local/nginx/conf/modsecurity/modsecurity.conf; #httpノードに追加するとグローバル構成が示され、serverノードに追加すると特定のWebサイトの構成が示されます 4.2Modsecurityの設定 下記のコマンドを実行して、 /usr/local/nginx/conf/modsecurity/modsecurity.conf を編集します。 #次の部分を変更する SecRuleEngine On SecAuditLogParts ABCDEFHZ #設定ファイルに /usr/local/nginx/conf/modsecurity/crs-setup.conf を追加します /usr/local/nginx/conf/modsecurity/rules/*.conf を含める 4.3 ルールファイルのダウンロード http://www.modsecurity.cn/download/corerule/owasp-modsecurity-crs-3.3-dev.zip をダウンロードしてください #ModsecurityChinese ウェブサイトのダウンロード wget https://github.com/coreruleset/coreruleset #github ダウンロード 4.4 構成ルール owasp-modsecurity-crs-3.3-dev.zip を解凍します。 cd owasp-modsecurity-crs-3.3-dev/ cp crs-setup.conf.example /usr/local/nginx/conf/modsecurity/crs-setup.conf cp -r ルール /usr/local/nginx/conf/modsecurity/ cd /usr/local/nginx/conf/modsecurity/rules mv REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf mv RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf.example RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf 4.5 テスト #ブラウザまたはcurlアクセステスト、403を返す curl -I 'http://localhost/?id=1 AND 1=1' Nginx+ModSecurity セキュリティ モジュールの導入実装に関するこの記事はこれで終わりです。Nginx ModSecurity 導入に関するより詳しい内容については、123WORDPRESS.COM の過去の記事を検索するか、以下の関連記事を引き続きご覧ください。今後とも 123WORDPRESS.COM をよろしくお願いいたします。 以下もご興味があるかもしれません:
|
<<: Vue+ElementUI で超大規模なフォーム例を処理する方法
>>: CSS リンク アドレスの後に疑問符 (?) を追加すると、どのような意味になりますか?
1. Nginx サービス基盤Nginx (エンジン x) は、パフォーマンスの最適化のために特別...
目次1. 繰り返し宣言1.1 変数1.2 しましょう1.3 定数2. 可変プロモーション2.1 変数...
目次シナリオ分析発達要約するシナリオ分析システムでは、1 つのモジュールに 3 つのサブモジュールが...
目次質問: 1. 最初の試み2. 合理的な分析3. 問題解決(1) pthread_join()の使...
簡単な説明これは CSS3 のクールな 3D キューブのプリロード効果です。この特殊効果は、シンプル...
Pantherは新人としてスタートし、今もまだ新人ですが、人々から学び、学んだことを時々皆さんと共有...
テーブルを作成テーブルテーブル名を作成create table if not exists 表名 m...
Nexus は RestApi を提供していますが、一部の API はまだ Groovy と組み合わ...
<br />最近、UCDChina は「インターフェース上のテキストに注意を払う」という...
上図のように、パディング値は時計回り(右上、右下)の複合属性であり、パディングの内側の余白がボックス...
序文:私はずっと、SQL 文がどのように、どのような順序で実行されるのかを知りたいと思っていました。...
歴史的な理由により、MySQL レプリケーションは、REDO ログではなく論理バイナリ ログに基づい...
1 はじめにApache Storm は、Hadoop と同様に、大量のデータを処理するために使用で...
IPSec の概要IPSec (インターネット プロトコル セキュリティ): ネットワーク層と適用さ...
もうナンセンスじゃない、郵便番号HTML部分 <div class="positio...