@@ -219,7 +219,7 @@ Finally, run
219
219
220
220
221
221
``` bash
222
- ddev exec BOUNCER_KEY=your-bouncer-key AGENT_TLS_PATH=/var/www/html/cfssl LAPI_URL=http ://crowdsec:8080
222
+ ddev exec BOUNCER_KEY=your-bouncer-key AGENT_TLS_PATH=/var/www/html/cfssl LAPI_URL=https ://crowdsec:8080
223
223
MEMCACHED_DSN=memcached://memcached:11211 REDIS_DSN=redis://redis:6379 /usr/bin/php ./my-own-modules/crowdsec-php-lib/vendor/bin/phpunit --testdox --colors --exclude-group ignore ./my-own-modules/crowdsec-php-lib/tests/Integration/IpVerificationTest.php
224
224
```
225
225
@@ -230,14 +230,14 @@ and`GeoLite2-Country.mmdb`. You can download these databases by creating a maxmi
230
230
Then, you can run:
231
231
232
232
``` bash
233
- ddev exec BOUNCER_KEY=your-bouncer-key AGENT_TLS_PATH=/var/www/html/cfssl LAPI_URL=http ://crowdsec:8080
233
+ ddev exec BOUNCER_KEY=your-bouncer-key AGENT_TLS_PATH=/var/www/html/cfssl LAPI_URL=https ://crowdsec:8080
234
234
/usr/bin/php ./my-own-modules/crowdsec-php-lib/vendor/bin/phpunit --testdox --colors --exclude-group ignore ./my-own-modules/crowdsec-php-lib/tests/Integration/GeolocationTest.php
235
235
```
236
236
237
237
** N.B** : If you want to test with ` curl ` instead of ` file_get_contents ` calls to LAPI, you have to add ` USE_CURL=1 ` in
238
238
the previous commands.
239
239
240
- ** N.B** : If you want to test with ` tls ` authentification, you have to add ` BOUNCER_TLS_PATH ` environment varibale
240
+ ** N.B** : If you want to test with ` tls ` authentification, you have to add ` BOUNCER_TLS_PATH ` environment variable
241
241
and specify the path where you store certificates and keys. For example:
242
242
243
243
``` bash
@@ -386,7 +386,7 @@ ddev xdebug
386
386
387
387
To generate a html report, you can run:
388
388
``` bash
389
- ddev exec XDEBUG_MODE=coverage BOUNCER_KEY=your-bouncer-key LAPI_URL=http ://crowdsec:8080
389
+ ddev exec XDEBUG_MODE=coverage BOUNCER_KEY=your-bouncer-key LAPI_URL=https ://crowdsec:8080
390
390
MEMCACHED_DSN=memcached://memcached:11211 REDIS_DSN=redis://redis:6379 /usr/bin/php ./my-own-modules/crowdsec-php-lib/tools/coding-standards/vendor/bin/phpunit --configuration ./my-own-modules/crowdsec-php-lib/tools/coding-standards/phpunit/phpunit.xml
391
391
392
392
```
@@ -397,7 +397,7 @@ You should find the main report file `dashboard.html` in `tools/coding-standards
397
397
If you want to generate a text report in the same folder:
398
398
399
399
``` bash
400
- ddev exec XDEBUG_MODE=coverage BOUNCER_KEY=your-bouncer-key LAPI_URL=http ://crowdsec:8080
400
+ ddev exec XDEBUG_MODE=coverage BOUNCER_KEY=your-bouncer-key LAPI_URL=https ://crowdsec:8080
401
401
MEMCACHED_DSN=memcached://memcached:11211 REDIS_DSN=redis://redis:6379 /usr/bin/php ./my-own-modules/crowdsec-php-lib/tools/coding-standards/vendor/bin/phpunit --configuration ./my-own-modules/crowdsec-php-lib/tools/coding-standards/phpunit/phpunit.xml --coverage-text=./my-own-modules/crowdsec-php-lib/tools/coding-standards/phpunit/code-coverage/report.txt
402
402
```
403
403
@@ -519,7 +519,7 @@ Let's add the `max_remediation_level` configuration with `captcha` value:
519
519
``` php
520
520
$configs = [
521
521
'api_key' => $bouncerKey,
522
- 'api_url' => 'http ://crowdsec:8080',
522
+ 'api_url' => 'https ://crowdsec:8080',
523
523
'fs_cache_path' => __DIR__ . '/.cache'
524
524
'max_remediation_level' => 'captcha' // <== ADD THIS LINE
525
525
];
@@ -543,7 +543,7 @@ Replace:
543
543
``` php
544
544
$configs = [
545
545
'api_key' => $bouncerKey,
546
- 'api_url' => 'http ://crowdsec:8080',
546
+ 'api_url' => 'https ://crowdsec:8080',
547
547
'fs_cache_path' => __DIR__ . '/.cache',
548
548
];
549
549
```
@@ -553,7 +553,7 @@ with:
553
553
``` php
554
554
$configs = [
555
555
'api_key' => $bouncerKey,
556
- 'api_url' => 'http ://crowdsec:8080',
556
+ 'api_url' => 'https ://crowdsec:8080',
557
557
'cache_system' => 'redis',
558
558
'redis_dsn' => 'redis://redis:6379'
559
559
];
@@ -564,7 +564,7 @@ Or, if `Memcached` is more adapted than `Redis` to your needs:
564
564
``` php
565
565
$configs = [
566
566
'api_key' => $bouncerKey,
567
- 'api_url' => 'http ://crowdsec:8080',
567
+ 'api_url' => 'https ://crowdsec:8080',
568
568
'cache_system' => 'memcached',
569
569
'memcached_dsn' => 'memcached://memcached:11211'
570
570
];
@@ -610,7 +610,7 @@ Try with the `full-example-live-mode.php` file:
610
610
611
611
612
612
` ` ` bash
613
- ddev exec php my-own-modules/crowdsec-php-lib/scripts/full-example-live-mode.php < YOUR_BOUNCER_KEY> 1.2.3.4 http ://crowdsec:8080
613
+ ddev exec php my-own-modules/crowdsec-php-lib/scripts/full-example-live-mode.php < YOUR_BOUNCER_KEY> 1.2.3.4 https ://crowdsec:8080
614
614
` ` `
615
615
616
616
# ### Simulate LAPI down by using a bad url
@@ -619,7 +619,7 @@ If you run this script twice, LAPI will not be called, the cache system will rel
619
619
You can this behaviour by testing with a bad LAPI url.
620
620
621
621
` ` ` bash
622
- ddev exec php my-own-modules/crowdsec-php-lib/scripts/full-example-live-mode.php < YOUR_BOUNCER_KEY> 1.2.3.4 http ://crowdsec:BAD
622
+ ddev exec php my-own-modules/crowdsec-php-lib/scripts/full-example-live-mode.php < YOUR_BOUNCER_KEY> 1.2.3.4 https ://crowdsec:BAD
623
623
` ` `
624
624
625
625
As you can see, you can check the API event if LAPI is down. This is because of the caching system.
@@ -641,7 +641,7 @@ ddev exec php my-own-modules/crowdsec-php-lib/scripts/clear-cache.php <YOUR_BOUN
641
641
One more time, get the remediation for the IP " 1.2.3.4" :
642
642
643
643
` ` ` bash
644
- ddev exec php my-own-modules/crowdsec-php-lib/scripts/full-example-live-mode.php < YOUR_BOUNCER_KEY> 1.2.3.4 http ://crowdsec:8080
644
+ ddev exec php my-own-modules/crowdsec-php-lib/scripts/full-example-live-mode.php < YOUR_BOUNCER_KEY> 1.2.3.4 https ://crowdsec:8080
645
645
` ` `
646
646
647
647
This is a ban (and cache miss) as you can see in your terminal logs.
@@ -652,7 +652,7 @@ This is a ban (and cache miss) as you can see in your terminal logs.
652
652
This library interacts with a CrowdSec agent that you have installed on an accessible server.
653
653
654
654
The easiest way to interact with the local API (LAPI) is to use the ` cscli` tool,but it is also possible to contact it
655
- through a certain URL (e.g. ` http ://crowdsec:8080` ).
655
+ through a certain URL (e.g. ` https ://crowdsec:8080` ).
656
656
657
657
# ## Use the CrowdSec cli (`cscli`)
658
658
@@ -739,10 +739,10 @@ Then, you should use some `curl` calls to contact the LAPI.
739
739
For example, you can get the list of decisions with commands like:
740
740
741
741
` ` ` bash
742
- curl -H " X-Api-Key: <YOUR_BOUNCER_KEY>" http ://crowdsec:8080/v1/decisions | jq
743
- curl -H " X-Api-Key: <YOUR_BOUNCER_KEY>" http ://crowdsec:8080/v1/decisions? ip=1.2.3.4 | jq
744
- curl -H " X-Api-Key: <YOUR_BOUNCER_KEY>" http ://crowdsec:8080/v1/decisions/stream? startup=true | jq
745
- curl -H " X-Api-Key: <YOUR_BOUNCER_KEY>" http ://crowdsec:8080/v1/decisions/stream | jq
742
+ curl -H " X-Api-Key: <YOUR_BOUNCER_KEY>" https ://crowdsec:8080/v1/decisions | jq
743
+ curl -H " X-Api-Key: <YOUR_BOUNCER_KEY>" https ://crowdsec:8080/v1/decisions? ip=1.2.3.4 | jq
744
+ curl -H " X-Api-Key: <YOUR_BOUNCER_KEY>" https ://crowdsec:8080/v1/decisions/stream? startup=true | jq
745
+ curl -H " X-Api-Key: <YOUR_BOUNCER_KEY>" https ://crowdsec:8080/v1/decisions/stream | jq
746
746
` ` `
747
747
748
748
# # Commit message
0 commit comments