Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export Coraza to C #67

Closed
jptosso opened this issue Aug 9, 2021 · 1 comment
Closed

Export Coraza to C #67

jptosso opened this issue Aug 9, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@jptosso
Copy link
Member

jptosso commented Aug 9, 2021

We need C wrappers in order to connect with other programs like Nginx and Apache.

We are going to copy the functions used by modsecurity but replacing msc_ with coraza_.

A sample would be:

#include "coraza/coraza.h"


char main_rule_uri[] = "basic_rules.conf";

int main (int argc, char **argv)
{
    Coraza *waf = NULL;
    Parser *parser = NULL
    Transaction *transaction = NULL;
    waf = coraza_init();

    parser = coraza_parser(waf);
    coraza_parser_read_file(main_rule_uri);

    transaction = coraza_new_transaction(waf);

    coraza_process_connection(transaction, "127.0.0.1");
    coraza_process_uri(transaction, "http://www.modsecurity.org/test?key1=value1&key2=value2&key3=value3&test=args&test=test");
    coraza_process_request_headers(transaction);
    coraza_process_request_body(transaction);
    coraza_process_response_headers(transaction);
    coraza_process_response_body(transaction);

    return 0;
}
@jptosso jptosso added the enhancement New feature or request label Aug 9, 2021
@jptosso
Copy link
Member Author

jptosso commented Nov 14, 2021

Moved to issue #100

@jptosso jptosso closed this as completed Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant