Giter Club home page Giter Club logo

Comments (5)

julienloizelet avatar julienloizelet commented on May 23, 2024 3

Hi @michacassola,
Thanks for your message.

Adding some wp-cli commands seems indeed a great idea.

But I guess I need more details on the type of command you want available.

Considering the API Key, this is already possible to set it in setting (if you know the API Key):

wp option set crowdsec_api_key ${BOUNCER_KEY}

But if you want a command to create the key itself, I think this won't be possible to have something that will work in all possible cases.

The bouncer key cannot be created with a pure PHP script, as we have to use the CrowdSec CLI cscli tool.
For example, the bouncer key can be retrieved as the result of the :

cscli bouncers add $BOUNCER_NAME -o raw

And, as the cscli command is only available on the server with the installed CrowdSec agent, it won't be possible to create it if the agent is not on the same server as the WordPress. There could also be some permission issues between the cscli user and the wp user.

For now, I guess the easiest way to script the installation of the CrowdSec plugin is to retrieve a bouncer key with the cscli command and pass it as a parameter of the wp option set command.

In my opinion, modifying the settings is already possible with the wp option set command, but we could add some command to manage the cache (clear, refresh, ...)

Please let me know if you were thinking about other wp-cli integration.

from cs-wordpress-bouncer.

julienloizelet avatar julienloizelet commented on May 23, 2024 3

Hi @michacassola,

as a first step in the integration work of WP-CLI, I added a paragraph about How to update settings with WP-CLI.

Next step would be to add some real WP-CLI command to act on the bouncer (clearing, refreshing cache for example).

Thanks

from cs-wordpress-bouncer.

LtSich avatar LtSich commented on May 23, 2024

I don't use it, as I block request on the network level, but being able to manage plugins through wp-cli is a must have for a good plugin :)

from cs-wordpress-bouncer.

michacassola avatar michacassola commented on May 23, 2024

Yeah, you are right, if all the options can be passed like that it is sufficient.
Then I would like to request documentation on how to set and change all the options of the plugin that way. :)
Thanks!

from cs-wordpress-bouncer.

julienloizelet avatar julienloizelet commented on May 23, 2024

Then I would like to request documentation on how to set and change all the options of the plugin that way. :)

I add this to my TODO list :) . I think I will provide a wp-cli example for each item in this documentation part: https://github.com/crowdsecurity/cs-wordpress-bouncer/blob/main/docs/USER_GUIDE.md#configurations

If you can't wait, you could start by looking in the wp_options table and search all items with option_name beginning by crowdsec.

Thanks

from cs-wordpress-bouncer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.