Skip to content

Commit

Permalink
docs(*): Move table of contents title
Browse files Browse the repository at this point in the history
  • Loading branch information
julienloizelet committed Oct 7, 2024
1 parent 5fcd8a2 commit d3025db
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 112 deletions.
2 changes: 1 addition & 1 deletion doc/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ npm install -g doctoc
Then, run it in the root folder:

```bash
doctoc README.md --maxlevel 4 && doctoc docs/* --maxlevel 4
doctoc doc/* --maxlevel 4
```

## Release process
Expand Down
15 changes: 6 additions & 9 deletions doc/INSTALLATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

## Installation Guide

**Table of Contents**

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [Requirements](#requirements)
- [Installation](#installation)
Expand All @@ -23,7 +23,6 @@

<!-- END doctoc generated TOC please keep comment here to allow auto update -->


## Requirements

- Magento >= 2.3
Expand All @@ -32,7 +31,7 @@

Use `Composer` by simply adding `crowdsec/magento2-module-engine` as a dependency:

composer require crowdsec/magento2-module-engine
composer require crowdsec/magento2-module-engine

## Post Installation

Expand All @@ -48,15 +47,12 @@ After enabling the module, the Magento 2 system must be upgraded.

If the system mode is set to production, run the compile command first. This is not necessary for the developer mode.


bin/magento setup:di:compile

Then run the upgrade command:


bin/magento setup:upgrade


### Clear Cache

The Magento 2 cache should be cleared by running the flush command.
Expand All @@ -69,7 +65,6 @@ At last, you have to deploy the static content:

bin/magento setup:static-content:deploy -f


## Troubleshooting

### Higher matching error
Expand Down Expand Up @@ -104,12 +99,15 @@ To avoid this error and install the latest known Packagist release `y.y.y`, you
}
},
```

And then run the same command:

```bash
composer require crowdsec/magento2-module-engine --no-plugins
```

As an alternative, you can also exclude the `crowdsec/magento2-module-engine` from the `repo.magento.com` repository:

```
"repositories": {
"0": {
Expand All @@ -120,6 +118,5 @@ As an alternative, you can also exclude the `crowdsec/magento2-module-engine` fr
},
```

Thus, running `composer require crowdsec/magento2-module-engine` will always pick up the latest `y.y.y` Packagist
Thus, running `composer require crowdsec/magento2-module-engine` will always pick up the latest `y.y.y` Packagist
release.

18 changes: 8 additions & 10 deletions doc/TECHNICAL_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,28 @@

## Technical notes

**Table of Contents**

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [CrowdSec Remediation Engine](#crowdsec-remediation-engine)
- [Why `crowdsec/magento-symfony-cache` dependency?](#why-crowdsecmagento-symfony-cache-dependency)
- [The `crowdsec_engine_detected_alert` event](#the-crowdsec_engine_detected_alert-event)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->


## CrowdSec Remediation Engine

This extension is mainly based on the CrowdSec Remediation Engine PHP SDK library. It is an open source library whose
This extension is mainly based on the CrowdSec Remediation Engine PHP SDK library. It is an open source library whose
code you can find [here](https://github.com/crowdsecurity/php-remediation-engine).


## Why `crowdsec/magento-symfony-cache` dependency?

This `CrowdSec_Engine` module depends on the [CrowdSec Remediation Engine library `crowdsec/remediation-engine`](https://github.com/crowdsecurity/php-remediation-engine) that comes with`symfony/cache` as dependency (`v5` or `v6`).

Since Magento `2.4.4`, a fresh installation on PHP 8 will lock a `3.0.0` version of `psr/cache`. And it also installs a `v2.2.11` version of `web-token/jwt-framework` that locks a `v4.4.45` version of`symfony/http-kernel`.


As a `v5` version of `symfony/cache` required `^1.0|^2.0` version of `psr/cache`, and a `v6` version of `symfony/cache` conflicts with `symfony/http-kernel` <5.4, it is impossible to require any version of the`symfony/cache` package.

That's why we needed to create a fork of `symfony/cache` that we called `crowdsec/magento-symfony-cache`.
Expand All @@ -37,22 +35,21 @@ The `v1` version of `crowdsec/magento-symfony-cache` only requires some specific
For PHP >= `8.0.2`, we provide a compatible `v2` version of `crowdsec/magento-symfony-cache`.
This `v2` version replaces the specified `5.x.y` version of `symfony/cache` : we use a copy of `5.x.y` files and allow `psr/cache` `3.0`. We also copy some `6.0.z` files to have compatible PHP 8 method signatures.

_Update_: Since Magento `2.4.6`, it is possible to install `symfony/cache` because the required version of
`web-token/jwt-framework` is `3.1`. But, in order to keep compatibility with `2.4.4` and `2.4.5`, we have to
_Update_: Since Magento `2.4.6`, it is possible to install `symfony/cache` because the required version of
`web-token/jwt-framework` is `3.1`. But, in order to keep compatibility with `2.4.4` and `2.4.5`, we have to
keep this `crowdsec/magento-symfony-cache` dependency.


## The `crowdsec_engine_detected_alert` event

This module listens to a `crowdsec_engine_detected_alert` event whose purpose is to send a ban signal for a given IP
This module listens to a `crowdsec_engine_detected_alert` event whose purpose is to send a ban signal for a given IP
and a given scenario.

You have to dispatch this event and pass an `alert` array with at least two required indexes:

- `ip`: the IP you want to signal
- `scenario`: the name of the scenario that triggered the alert.

Optionally, you can pass a timestamp (integer) as a value of a `last_event_date` key.
Optionally, you can pass a timestamp (integer) as a value of a `last_event_date` key.

For example, you can have your own class that will dispatch the `crowdsec_engine_detected_alert` event:

Expand Down Expand Up @@ -87,4 +84,5 @@ class YourClass
}

```

This way, an event will be stored in the `crowdsec_event` table with an `alert_triggered` status and the following `crowdsec_engine_push_signals` executed cron job will push it as a ban signal.
Loading

0 comments on commit d3025db

Please sign in to comment.