Skip to content

Commit

Permalink
Highlight with Markdown instead of Jekyll tags
Browse files Browse the repository at this point in the history
  • Loading branch information
moisseev committed Mar 30, 2024
1 parent f7f9157 commit 0ba46dd
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 39 deletions.
3 changes: 1 addition & 2 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Rspamd - rapid spam filtering system.
highlighter: rouge
plugins:
- jekyll-paginate
- jekyll-seo-tag
Expand All @@ -22,4 +21,4 @@ markdown: kramdown

kramdown:
input: GFM
Syntax_highlighter: rouge
syntax_highlighter: rouge
53 changes: 31 additions & 22 deletions _posts/2013-09-07-universal-configuration-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ For example, you can write the same configuration in the following ways:

* in nginx like:

{% highlight nginx %}
~~~nginx
param = value;
section {
param = value;
Expand All @@ -36,11 +36,11 @@ section {
}
}
}
{% endhighlight %}
~~~

* or in JSON:

{% highlight json %}
~~~json
{
"param": "value",
"param1": "value1",
Expand All @@ -58,63 +58,69 @@ section {
]
}
}
{% endhighlight %}
~~~

## Improvements to the json notation.

There are various things that makes json parsing more convenient for editing:

* Braces are not necessary to enclose the top object: it is automatically treated as object:

{% highlight json %}
~~~json
"key": "value"
{% endhighlight %}
~~~

is the equivalent to:
{% highlight json %}

~~~json
{"key": "value"}
{% endhighlight %}
~~~

* There is no requirement of quotes for strings and keys, moreover, `:` sign may be replaced with `=` sign or even skipped for objects:

{% highlight nginx %}
~~~nginx
key = value;
section {
key = value;
}
{% endhighlight %}
~~~

is the equivalent to:
{% highlight json %}

~~~json
{
"key": "value",
"section": {
"key": "value"
}
}
{% endhighlight %}
~~~

* No commas mess: you can safely place a comma or semicolon for the last element in array or object:

{% highlight json %}
~~~json
{
"key1": "value",
"key2": "value",
}
{% endhighlight %}
~~~

* Non-unique keys in an object are allowed and automatically converted to the arrays internally:

{% highlight json %}
~~~json
{
"key": "value1",
"key": "value2"
}
{% endhighlight %}
~~~

is converted to:
{% highlight json %}

~~~json
{
"key": ["value1", "value2"]
}
{% endhighlight %}
~~~

* Numbers can have suffixes to specify standard multipliers:
* `[kKmMgG]` - standard 10 base multipliers (so `1k` is translated to 1000)
Expand All @@ -131,23 +137,26 @@ RCL supports different style of comments:
* multiline: `/* ... */`

Multiline comments may be nested:
{% highlight c %}

~~~c
# Sample single line comment
/*
some comment
/* nested comment */
end of comment
*/
{% endhighlight %}
~~~

RCL supports external macroes both multiline and single line ones:
{% highlight nginx %}

~~~nginx
.macro "sometext";
.macro {
Some long text
....
};
{% endhighlight %}
~~~

There are two internal macroes provided by RCL:

* `include` - read a file `/path/to/file` or an url `http://example.com/file` and include it to the current place of
Expand Down
6 changes: 3 additions & 3 deletions doc/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ dns {

or, if you want some backup as a last resort, you can use `master-slave` [rotation](configuration/upstream.html) as following:

~~~ucl
~~~ ucl
# local.d/options.inc
dns {
nameserver = "master-slave:127.0.0.1,8.8.8.8";
Expand All @@ -83,12 +83,12 @@ dns {

If you use large scale DNS system you might want to set up `hash` rotation algorithm. It will significantly increase cache hit rate and reduce number of recursive queries if you have more than one upstream resolver:

~~~ucl
``` ucl
# local.d/options.inc
dns {
nameserver = "hash:10.0.0.1,10.1.0.1,10.3.0.1";
}
~~~
```

Rspamd uses consistent hashing and has some tolerance to the configuration changes.

Expand Down
30 changes: 18 additions & 12 deletions doc/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ It is assumed that you are using your operating system's package manager (e.g. `
main.cf
</a>
<div id="main_cf" class="collapse collapse-block">
<pre class="highlight"><code>

~~~sh
# TLS setup (we assume the same certs for IMAP and SMTP here)
smtpd_tls_cert_file = /etc/letsencrypt/live/your.domain/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/your.domain/privkey.pem
Expand Down Expand Up @@ -114,7 +115,8 @@ smtpd_relay_restrictions = check_recipient_access hash:/etc/postfix/access, reje
smtpd_milters = inet:localhost:11332
milter_default_action = accept
milter_protocol = 6
</code></pre>
~~~

</div></div>

You also need to create maps for access control and virtual aliases:
Expand Down Expand Up @@ -395,7 +397,8 @@ The WebUI is managed by a controller worker, but for added functionality such as

<div class="d-grid gap-4">
<a class="btn btn-info btn-code collapsed" data-bs-toggle="collapse" data-bs-target="#nginx_cf"><i class="fa-regular fa-square-caret-down fa-pull-right"></i>nginx.conf</a><div id="nginx_cf" class="collapse collapse-block">
{% highlight nginx %}

~~~nginx
worker_processes 2;
user www-data www-data;
Expand Down Expand Up @@ -450,22 +453,25 @@ http {
server_tokens off;
}
}
{% endhighlight %}
~~~

</div>
</div>

You might also use subdirs, as suggested by [@julienmalik](https://github.com/julienmalik){:target="&#95;blank"}:

<div class="d-grid gap-4">
<a class="btn btn-info btn-code collapsed" data-bs-toggle="collapse" data-bs-target="#nginx_cf1"><i class="fa-regular fa-square-caret-down fa-pull-right"></i>nginx.conf</a><div id="nginx_cf1" class="collapse collapse-block">
{% highlight nginx %}

~~~nginx
location /rspamd/ {
proxy_pass http://localhost:11334/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
{% endhighlight %}
~~~

</div>
</div>

Expand Down Expand Up @@ -506,11 +512,11 @@ For more advanced proxy usage, please see the corresponding [documentation]({{ s

Starting with version 1.1, it is now possible to utilize Redis as a backend for statistics and caching of learned messages. Redis is particularly recommended for clustered configurations as it enables concurrent learning and checking, and also performs very quickly. To configure Redis, you can specify the `redis` backend for a classifier, and the cache will automatically be set to the same servers.

{% highlight hcl %}
~~~hcl
# /etc/rspamd/local.d/classifier-bayes.conf
servers = "127.0.0.1";
backend = "redis";
{% endhighlight %}
~~~

Please review the full [statistics documentation]({{ site.baseurl }}/doc/configuration/statistic.html) for further information as well as the [Redis configuration documentation]({{ site.baseurl }}/doc/configuration/redis.html) if you plan to use Redis.

Expand Down Expand Up @@ -660,13 +666,13 @@ See [here]({{ site.url }}{{ site.baseurl }}/doc/rspamadm.html) for more informat

It is also useful to have a simple `Sieve` script to place all messages marked as spam in the `Junk` folder. Here is an example of such a script (~/.dovecot.sieve):

{% highlight nginx %}
~~~nginx
require ["fileinto"];
if header :is "X-Spam" "Yes" {
fileinto "Junk";
}
{% endhighlight %}
~~~

It is also possible to set up Rspamc to learn by forwarding messages to a specific email address. I recommend using `/etc/aliases` for these purposes and `mail-redirect` command (e.g. provided by [Mail Redirect addon](https://addons.mozilla.org/en-GB/thunderbird/addon/mailredirect/){:target="&#95;blank"} for `Thunderbird` MUA). The desired aliases could be the following:

Expand All @@ -679,9 +685,9 @@ There is also an add-on for Thunderbird MUA written by Alexander Moisseev to vis

To enable extended spam headers in [Milter headers module]({{ site.baseurl }}/doc/modules/milter_headers.html) add the following line to `local.d/milter_headers.conf`:

{% highlight hcl %}
~~~hcl
extended_spam_headers = true;
{% endhighlight %}
~~~

To enable headers in Exim refer to the "Integration with Exim MTA" section of the [MTA integration]({{ site.baseurl }}/doc/integration.html) document.

Expand Down

0 comments on commit 0ba46dd

Please sign in to comment.