You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$remediation = $bouncer->getRemediationForIp($blockedIp);// Return "ban", "captcha" or "bypass"
56
56
```
57
57
58
-
View [`docs/getting-started.md`](https://github.com/crowdsecurity/php-cs-bouncer/blob/main/docs/complete-guide.md) to learn how to include this library in your project in minutes.
58
+
View [`docs/complete-guide.md`](https://github.com/crowdsecurity/php-cs-bouncer/blob/main/docs/complete-guide.md) to learn how to include this library in your project in minutes.
59
59
60
60
## Future
61
-
- Retrieve cache items with pagination
62
-
- Release 1.0.0 version
63
-
- Direct CAPI support
64
-
- Support more cache systems (Apcu, Couchbase, Doctrine, Pdo)
61
+
- Retrieve decisions stored in cache using pagination
62
+
- Direct CAPI support (no LAPI required)
63
+
- Support more cache systems (Apcu, Couchbase, Doctrine -SQL or MongoDB-, Pdo...)
If now, you run the php script against the `2.3.4.5` IP:
142
+
Now, if you run the php script against the `2.3.4.5` IP:
141
143
142
144
```bash
143
-
docker-compose run php php check-ip.php 2.3.4.5
145
+
docker-compose run app php check-ip.php 2.3.4.5
144
146
```
145
147
146
148
LAPI will advise you to ban this IP as it's within the 2.3.4.5/30 range.
147
149
148
150
## The cache system
149
151
150
-
If you script this script twice, LAPI will not be called, the cache system will relay the information.
152
+
If you run this script twice, LAPI will not be called, the cache system will relay the information.
151
153
152
154
Let's try to stop the `crowdsec` container and re-run the script with the "bad" IP:
153
155
154
156
```bash
155
157
docker-compose stop crowdsec
156
-
docker-compose run php php check-ip.php 2.3.4.5
158
+
docker-compose run app php check-ip.php 2.3.4.5
157
159
```
158
160
159
161
For this IP, the cache system will never ask LAPI anymore for the duration of the decision.
160
162
161
163
Note: By default, a "bypass" decision is stored in the cache for 10 min. You can change this duration while instantiating the library.
162
164
163
-
Don't forget to start the crowdsec before continuing :-)
165
+
Don't forget to restart the crowdsec container before continuing :-)
164
166
165
167
```bash
166
168
docker-compose start crowdsec
@@ -224,7 +226,7 @@ $cacheAdapter = new RedisAdapter(RedisAdapter::createConnection('redis://redis:6
224
226
...
225
227
```
226
228
227
-
Or, if `Memcached` is more adapter to your needs than `Redis`:
229
+
Or, if `Memcached` is more adapted than `Redis` to your needs:
228
230
229
231
```php
230
232
<?php
@@ -244,7 +246,7 @@ $cacheAdapter = new MemcachedAdapter(MemcachedAdapter::createConnection('memcach
244
246
You will still be able to verify IPs, but the cache system will be extremely efficient!
245
247
246
248
```bash
247
-
docker-compose run php php check-ip.php 2.3.4.5
249
+
docker-compose run app php check-ip.php 2.3.4.5
248
250
```
249
251
250
252
Congrats! Now you use a very efficient cache layer!
@@ -253,7 +255,7 @@ Congrats! Now you use a very efficient cache layer!
253
255
254
256
## Cap remediation level
255
257
256
-
For some websites, it's a critical action to ban access to users (ex: e-commerce). In some case, we prefer to let user access to the website, even if CrowdSec says "ban it!".
258
+
In some cases, it's a critical action to ban access to users (ex: e-commerce). We prefer to let user access to the website, even if CrowdSec says "ban it!".
257
259
258
260
Fortunately, this library allows you to cap the remediation to a certain level.
259
261
@@ -271,7 +273,7 @@ $bouncer->configure([
271
273
Now if you call one more time:
272
274
273
275
```bash
274
-
docker-compose run php php check-ip.php 2.3.4.5
276
+
docker-compose run app php check-ip.php 2.3.4.5
275
277
```
276
278
277
279
The library will cap the value to `captcha` level.
0 commit comments