@@ -34,6 +34,12 @@ To complete this guide, you will need the following prerequisites:
34
34
35
35
To review supported operating systems, please read the [ Technical specifications] ({{< ref "/waf/fundamentals/technical-specifications.md" >}}) guide.
36
36
37
+ {{< call-out "note" >}}
38
+
39
+ To use a V5-based package, you will also need to install [ Docker] ( https://docs.docker.com/get-started/get-docker/ ) .
40
+
41
+ {{< /call-out>}}
42
+
37
43
## Platform-specific instructions
38
44
39
45
Navigate to your chosen operating system, which are alphabetically ordered.
@@ -401,3 +407,177 @@ Here are two examples of how these additions could look in configuration files:
401
407
{{%/tab%}}
402
408
403
409
{{< /tabs >}}
410
+
411
+ Once you have updated your configuration files, you can reload NGINX to apply the changes. You have two options depending on your environment:
412
+
413
+ - ` nginx -s reload `
414
+ - ` sudo systemctl reload nginx `
415
+
416
+ If you are using a V4 package, you have finished installing F5 WAF for NGINX and can look at [ Post-installation checks] ( #post-installation-checks ) .
417
+
418
+ ## Configure Docker services
419
+
420
+ {{< call-out "warning" >}}
421
+
422
+ This section ** only** applies to V5 packages.
423
+
424
+ Skip to [ Post-installation checks] ( #post-installation-checks ) if you're using a V4 package.
425
+
426
+ {{< /call-out>}}
427
+
428
+ F5 WAF for NGINX uses Docker containers for its services when installed with a V5 package, which requires some extra set-up steps.
429
+
430
+ First, create new directories for the services:
431
+
432
+ ``` shell
433
+ sudo mkdir -p /opt/app_protect/config /opt/app_protect/bd_config
434
+ ```
435
+
436
+ Then assign new owners, with ` 101:101 ` as the default UID/GID
437
+
438
+ ``` shell
439
+ sudo chown -R 101:101 /opt/app_protect/
440
+ ```
441
+
442
+ ### Configure Docker for the F5 Container Registry
443
+
444
+ Create a directory and copy your certificate and key to this directory:
445
+
446
+ ``` shell
447
+ mkdir -p /etc/docker/certs.d/private-registry.nginx.com
448
+ cp < path-to-your-nginx-repo.crt> /etc/docker/certs.d/private-registry.nginx.com/client.cert
449
+ cp < path-to-your-nginx-repo.key> /etc/docker/certs.d/private-registry.nginx.com/client.key
450
+ ```
451
+
452
+ ### Download Docker images
453
+
454
+ Download the ` waf-enforcer ` and ` waf-config-mgr ` images.
455
+
456
+ Replace ` 5.2.0 ` with the release version you are deploying.
457
+
458
+ ``` shell
459
+ docker pull private-registry.nginx.com/nap/waf-enforcer:5.2.0
460
+ docker pull private-registry.nginx.com/nap/waf-config-mgr:5.2.0
461
+ ```
462
+
463
+ ### Create and run a Docker Compose file
464
+
465
+ Create a _ docker-compose.yml_ file with the following contents in your host environment, replacing the image tag as appropriate.
466
+
467
+ ``` yaml
468
+ services :
469
+ waf-enforcer :
470
+ container_name : waf-enforcer
471
+ image : waf-enforcer:5.2.0
472
+ environment :
473
+ - ENFORCER_PORT=50000
474
+ ports :
475
+ - " 50000:50000"
476
+ volumes :
477
+ - /opt/app_protect/bd_config:/opt/app_protect/bd_config
478
+ networks :
479
+ - waf_network
480
+ restart : always
481
+
482
+ waf-config-mgr :
483
+ container_name : waf-config-mgr
484
+ image : waf-config-mgr:5.2.0
485
+ volumes :
486
+ - /opt/app_protect/bd_config:/opt/app_protect/bd_config
487
+ - /opt/app_protect/config:/opt/app_protect/config
488
+ - /etc/app_protect/conf:/etc/app_protect/conf
489
+ restart : always
490
+ network_mode : none
491
+ depends_on :
492
+ waf-enforcer :
493
+ condition : service_started
494
+
495
+ networks :
496
+ waf_network :
497
+ driver : bridge
498
+ ` ` `
499
+
500
+ {{< call-out "caution" >}}
501
+
502
+ In some operating systems, security mechanisms like SELinux or AppArmor are enabled by default, potentially blocking necessary file access for the nginx process and waf-config-mgr and waf-enforcer containers.
503
+
504
+ To ensure NGINX App Protect WAF operates smoothly without compromising security, consider setting up a custom SELinux policy or AppArmor profile.
505
+
506
+ For short-term troubleshooting, you may use permissive (SELinux) or complain (AppArmor) mode to avoid these restrictions, but this is inadvisable for prolonged use.
507
+
508
+ {{< /call-out >}}
509
+
510
+ To start the F5 WAF for NGINX services, use ` docker compose up` in the same folder as the _docker-compose.yml_ file:
511
+
512
+ ` ` ` shell
513
+ sudo docker compose up -d
514
+ ` ` `
515
+
516
+
517
+ # # Post-installation checks
518
+
519
+ Use the following steps to ensure that F5 WAF for NGINX enforcement is operational.
520
+
521
+ Check that the three processes for F5 WAF for NGINX are running using `ps aux` :
522
+
523
+ - _bd-socket-plugin_
524
+ - _nginx : master process_
525
+ - _nginx : worker process_
526
+
527
+ ` ` ` shell
528
+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
529
+ root 8 1.3 2.4 3486948 399092 ? Sl 09:11 0:02 /usr/share/ts/bin/bd-socket-plugin tmm_count 4 proc_cpuinfo_cpu_mhz 2000000 total_xml_memory 307200000 total_umu_max_size 3129344 sys_max_account_id 1024 no_static_config
530
+ root 14 0.0 0.1 71060 26680 ? S 09:11 0:00 nginx: master process /usr/sbin/nginx -c /tmp/policy/test_nginx.conf -g daemon off;
531
+ root 26 0.0 0.3 99236 52092 ? S 09:12 0:00 nginx: worker process
532
+ root 28 0.0 0.0 11788 2920 pts/0 Ss 09:12 0:00 bash
533
+ root 43 0.0 0.0 47460 3412 pts/0 R+ 09:14 0:00 ps aux
534
+ ` ` `
535
+
536
+ Verify there are no errors in the file `/var/log/nginx/error.log` and that the policy compiled successfully :
537
+
538
+ ` ` ` none
539
+ 2020/05/10 13:21:04 [notice] 402#402: APP_PROTECT { "event": "configuration_load_start", "configSetFile": "/opt/f5waf/config/config_set.json" }
540
+ 2020/05/10 13:21:04 [notice] 402#402: APP_PROTECT policy 'app_protect_default_policy' from: /etc/app_protect/conf/NginxDefaultPolicy.json compiled successfully
541
+ 2020/05/10 13:21:04 [notice] 402#402: APP_PROTECT { "event": "configuration_load_success", "software_version": "1.1.1", "attack_signatures_package":{"revision_datetime":"2019-07-16T12:21:31Z"},"completed_successfully":true}
542
+ 2020/05/10 13:21:04 [notice] 402#402: using the "epoll" event method
543
+ 2020/05/10 13:21:04 [notice] 402#402: nginx/1.17.6 (nginx-plus-r20)
544
+ 2020/05/10 13:21:04 [notice] 402#402: built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
545
+ 2020/05/10 13:21:04 [notice] 402#402: OS: Linux 3.10.0-957.27.2.el7.x86_64
546
+ 2020/05/10 13:21:04 [notice] 402#402: getrlimit(RLIMIT_NOFILE): 1048576:1048576
547
+ 2020/05/10 13:21:04 [notice] 406#406: start worker processes
548
+ 2020/05/10 13:21:04 [notice] 406#406: start worker process 407
549
+ ` ` `
550
+
551
+ Check that sending an attack signature in a request returns a response block page containing a support ID :
552
+
553
+ ` ` ` shell
554
+ Request:
555
+ http://10.240.185.211/?a=<script>
556
+
557
+ Response:
558
+ The requested URL was rejected. Please consult with your administrator.
559
+
560
+ Your support ID is: 9847191526422998597
561
+
562
+ [Go Back]
563
+ ` ` `
564
+
565
+ If you case your policy includes JSON/XML profiles, check `/var/log/app_protect/bd-socket-plugin.log` for possible errors :
566
+
567
+ ` ` ` shell
568
+ grep '|ERR' /var/log/app_protect/bd-socket-plugin.log
569
+ ` ` `
570
+
571
+ Verify that Enforcement functionality is working by checking the following request is rejected :
572
+
573
+ ` ` ` shell
574
+ curl "localhost/<script>"
575
+ ` ` `
576
+
577
+ # # Next steps
578
+
579
+ Once you have successfully installed F5 WAf for NGINX, there are some topics you may want to follow afterwards :
580
+
581
+ - [Converter tools]({{< ref "/waf/tools/converter.md" >}}), to convert existing resources from a BIG-IP environment
582
+ - [Configure policies]({{< ref "/waf/policies/configuration.md" >}}), to begin customizing your deployment
583
+ - [Changelog]({{< ref "/waf/changelog.md" >}}), to view information from the latest releases
0 commit comments