Skip to content

Commit c153682

Browse files
authored
Merge pull request #36 from crowdsecurity/custom-remediation-templates
custom remediation templates
2 parents c0f8860 + f022b0b commit c153682

File tree

7 files changed

+142
-40
lines changed

7 files changed

+142
-40
lines changed

docs/api/Bouncer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public static getAccessForbiddenHtmlTemplate (void)
157157

158158
Returns a default "CrowdSec 403" HTML template to display to a web browser using a banned IP.
159159

160-
160+
The input $config should match the TemplateConfiguration input format.
161161

162162
**Parameters**
163163

@@ -181,7 +181,7 @@ public static getCaptchaHtmlTemplate (void)
181181

182182
Returns a default "CrowdSec Captcha" HTML template to display to a web browser using a captchable IP.
183183

184-
184+
The input $config should match the TemplateConfiguration input format.
185185

186186
**Parameters**
187187

src/Bouncer.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,34 @@ public function getRemediationForIp(string $ip): string
110110

111111
/**
112112
* Returns a default "CrowdSec 403" HTML template to display to a web browser using a banned IP.
113+
* The input $config should match the TemplateConfiguration input format.
113114
*/
114-
public static function getAccessForbiddenHtmlTemplate(bool $hideCrowdSecMentions = false): string
115+
public static function getAccessForbiddenHtmlTemplate(array $config): string
115116
{
117+
// Process template configuration.
118+
$configuration = new TemplateConfiguration();
119+
$processor = new Processor();
120+
$config = $processor->processConfiguration($configuration, [$config]);
121+
116122
ob_start();
117-
displayAccessForbiddenTemplate($hideCrowdSecMentions);
123+
displayAccessForbiddenTemplate($config);
118124

119125
return ob_get_clean();
120126
}
121127

122128
/**
123129
* Returns a default "CrowdSec Captcha" HTML template to display to a web browser using a captchable IP.
130+
* The input $config should match the TemplateConfiguration input format.
124131
*/
125-
public static function getCaptchaHtmlTemplate(bool $error, string $captchaImageSrc, string $captchaResolutionFormUrl, bool $hideCrowdSecMentions = false): string
132+
public static function getCaptchaHtmlTemplate(bool $error, string $captchaImageSrc, string $captchaResolutionFormUrl, array $config): string
126133
{
134+
// Process template configuration.
135+
$configuration = new TemplateConfiguration();
136+
$processor = new Processor();
137+
$config = $processor->processConfiguration($configuration, [$config]);
138+
127139
ob_start();
128-
displayCaptchaTemplate($error, $captchaImageSrc, $captchaResolutionFormUrl, $hideCrowdSecMentions);
140+
displayCaptchaTemplate($error, $captchaImageSrc, $captchaResolutionFormUrl, $config);
129141

130142
return ob_get_clean();
131143
}

src/RestClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function request(
111111
}
112112

113113
if ($status < 200 || $status >= 300) {
114-
throw new BouncerException("unexpected response status: {$status}\n".$response);
114+
throw new BouncerException("unexpected response status from $this->baseUri$endpoint: $status\n".$response);
115115
}
116116
$data = json_decode($response, true);
117117

src/TemplateConfiguration.php

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?php
2+
3+
namespace CrowdSecBouncer;
4+
5+
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
6+
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
7+
use Symfony\Component\Config\Definition\ConfigurationInterface;
8+
9+
/**
10+
* The template configuration. You'll be able to configure text and colors of the captcha wall and the ban wall.
11+
*
12+
* @author CrowdSec team
13+
*
14+
* @see https://crowdsec.net CrowdSec Official Website
15+
*
16+
* @copyright Copyright (c) 2020+ CrowdSec
17+
* @license MIT License
18+
*/
19+
class TemplateConfiguration implements ConfigurationInterface
20+
{
21+
/**
22+
* {@inheritdoc}
23+
*/
24+
public function getConfigTreeBuilder()
25+
{
26+
$treeBuilder = new TreeBuilder('config');
27+
/** @var $rootNode ArrayNodeDefinition */
28+
$rootNode = $treeBuilder->getRootNode();
29+
$rootNode
30+
->children()
31+
->arrayNode('color')
32+
->addDefaultsIfNotSet()
33+
->children()
34+
->arrayNode('text')
35+
->addDefaultsIfNotSet()
36+
->children()
37+
->scalarNode('primary')->defaultValue('black')->end()
38+
->scalarNode('secondary')->defaultValue('#AAA')->end()
39+
->scalarNode('button')->defaultValue('white')->end()
40+
->scalarNode('error_message')->defaultValue('#b90000')->end()
41+
->end()
42+
->end()
43+
->arrayNode('background')
44+
->addDefaultsIfNotSet()
45+
->children()
46+
->scalarNode('page')->defaultValue('#eee')->end()
47+
->scalarNode('container')->defaultValue('white')->end()
48+
->scalarNode('button')->defaultValue('#626365')->end()
49+
->scalarNode('button_hover')->defaultValue('#333')->end()
50+
->end()
51+
->end()
52+
->end()
53+
->end()
54+
->arrayNode('text')
55+
->addDefaultsIfNotSet()
56+
->children()
57+
->arrayNode('captcha_wall')
58+
->addDefaultsIfNotSet()
59+
->children()
60+
->scalarNode('tab_title')->defaultValue('Oops..')->end()
61+
->scalarNode('title')->defaultValue('Hmm, sorry but...')->end()
62+
->scalarNode('subtitle')->defaultValue('Please complete the security check.')->end()
63+
->scalarNode('refresh_image_link')->defaultValue('refresh image')->end()
64+
->scalarNode('captcha_placeholder')->defaultValue('Type here...')->end()
65+
->scalarNode('send_button')->defaultValue('CONTINUE')->end()
66+
->scalarNode('error_message')->defaultValue('Please try again.')->end()
67+
->scalarNode('footer')->defaultValue('')->end()
68+
->end()
69+
->end()
70+
->arrayNode('ban_wall')
71+
->addDefaultsIfNotSet()
72+
->children()
73+
->scalarNode('tab_title')->defaultValue('Oops..')->end()
74+
->scalarNode('title')->defaultValue('🤭 Oh!')->end()
75+
->scalarNode('subtitle')->defaultValue('This page is protected against cyber attacks and your IP has been banned by our system.')->end()
76+
->scalarNode('footer')->defaultValue('')->end()
77+
->end()
78+
->end()
79+
->end()
80+
->end()
81+
->booleanNode('hide_crowdsec_mentions')->defaultValue(false)->end()
82+
->scalarNode('custom_css')->defaultValue(null)->end()
83+
->end();
84+
85+
return $treeBuilder;
86+
}
87+
}

src/templates/_base.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
2-
function crowdSecBaseTemplatePart1(): void
2+
function crowdSecBaseTemplatePart1($config, $tabTitle): void
33
{ ?>
44
<!DOCTYPE html>
55
<html lang="en">
66

77
<head>
8-
<title>Oops..</title>
8+
<title><?php echo htmlentities($tabTitle, \ENT_QUOTES); ?></title>
99
<meta content="text/html; charset=utf-8" />
1010
<style>
1111
* {
@@ -15,10 +15,11 @@ function crowdSecBaseTemplatePart1(): void
1515

1616
html {
1717
height: 100%;
18+
color:<?php echo htmlentities($config['color']['text']['primary'], \ENT_QUOTES); ?>;
1819
}
1920

2021
body {
21-
background: #eee;
22+
background: <?php echo htmlentities($config['color']['background']['page'], \ENT_QUOTES); ?>;
2223
font-family: Arial, Helvetica, sans-serif;
2324
height: 100%;
2425
}
@@ -31,7 +32,7 @@ function crowdSecBaseTemplatePart1(): void
3132
}
3233

3334
.main {
34-
background: white;
35+
background: <?php echo htmlentities($config['color']['background']['container'], \ENT_QUOTES); ?>;
3536
padding: 50px 50px 30px 50px;
3637
box-shadow: rgba(0, 0, 0, 0.2) 0px 3px 3px -2px, rgba(0, 0, 0, 0.14) 0px 3px 4px 0px, rgba(0, 0, 0, 0.12) 0px 1px 8px 0px;
3738
border-radius: 10px;
@@ -55,7 +56,7 @@ function crowdSecBaseTemplatePart1(): void
5556
.powered {
5657
margin-top: 30px;
5758
font-size: small;
58-
color: #AAA;
59+
color: <?php echo htmlentities($config['color']['text']['secondary'], \ENT_QUOTES); ?>;
5960
}
6061

6162
.warning {
@@ -72,8 +73,9 @@ function crowdSecBaseTemplatePart1(): void
7273
}
7374

7475
a {
75-
color: #AAA;
76+
color: <?php echo htmlentities($config['color']['text']['secondary'], \ENT_QUOTES); ?>;
7677
}
78+
<?php echo htmlentities($config['custom_css'], \ENT_QUOTES); ?>
7779
</style>
7880
</head>
7981
<?php }
@@ -90,9 +92,10 @@ function newImage() {
9092
<div class="container">
9193
<div class="main">
9294
<?php }
93-
function crowdSecBaseTemplatePart3(bool $hideCrowdSecMentions): void
95+
function crowdSecBaseTemplatePart3(array $config, $footer): void
9496
{
95-
if ($hideCrowdSecMentions) { ?>
97+
if (strlen($footer)) {?><p class="footer"><?php echo htmlentities($footer, \ENT_QUOTES); ?></p><?php }
98+
if (!$config['hide_crowdsec_mentions']) { ?>
9699
<p class="powered">This security check has been powered by
97100
<svg class="logo" width="33.92" height="33.76" viewBox="0 0 254.4 253.2">
98101
<defs>
@@ -103,15 +106,15 @@ function crowdSecBaseTemplatePart3(bool $hideCrowdSecMentions): void
103106
<path d="M170 52h84.4v201.2H170zm0 0" />
104107
</clipPath>
105108
</defs>
106-
<path d="M59.3 128.4c1.4 2.3 2.5 4.6 3.4 7-1-4.1-2.3-8.1-4.3-12-3.1-6-7.8-5.8-10.7 0-2 4-3.2 8-4.3 12.1 1-2.4 2-4.8 3.4-7.1 3.4-5.8 8.8-6 12.5 0M207.8 128.4a42.9 42.9 0 013.4 7c-1-4.1-2.3-8.1-4.3-12-3.2-6-7.8-5.8-10.7 0-2 4-3.3 8-4.3 12.1.9-2.4 2-4.8 3.4-7.1 3.4-5.8 8.8-6 12.5 0M134.6 92.9c2 3.5 3.6 7 4.8 10.7-1.3-5.4-3-10.6-5.6-15.7-4-7.5-9.7-7.2-13.3 0a75.4 75.4 0 00-5.6 16c1.2-3.8 2.7-7.4 4.7-11 4.1-7.2 10.6-7.5 15 0M43.8 136.8c.9 4.6 3.7 8.3 7.3 9.2 0 2.7 0 5.5.2 8.2.3 3.3.4 6.6 1 9.6.3 2.3 1 2.2 1.3 0 .5-3 .6-6.3 1-9.6l.2-8.2c3.5-1 6.4-4.6 7.2-9.2a17.8 17.8 0 01-9 2.4c-3.5 0-6.6-1-9.2-2.4M192.4 136.8c.8 4.6 3.7 8.3 7.2 9.2 0 2.7 0 5.5.3 8.2.3 3.3.4 6.6 1 9.6.3 2.3.9 2.2 1.2 0 .6-3 .7-6.3 1-9.6.2-2.7.3-5.5.2-8.2 3.6-1 6.4-4.6 7.3-9.2a17.8 17.8 0 01-9.1 2.4c-3.4 0-6.6-1-9.1-2.4M138.3 104.6c-3.1 1.9-7 3-11.3 3-4.3 0-8.2-1.1-11.3-3 1 5.8 4.5 10.3 9 11.5 0 3.4 0 6.8.3 10.2.4 4.1.5 8.2 1.2 12 .4 2.9 1.2 2.7 1.6 0 .7-3.8.8-7.9 1.2-12 .3-3.4.3-6.8.3-10.2 4.5-1.2 8-5.7 9-11.5" fill="#AAA" />
107-
<path d="M51 146c0 2.7.1 5.5.3 8.2.3 3.3.4 6.6 1 9.6.3 2.3 1 2.2 1.3 0 .5-3 .6-6.3 1-9.6l.2-8.2c3.5-1 6.4-4.6 7.2-9.2a17.8 17.8 0 01-9 2.4c-3.5 0-6.6-1-9.2-2.4.9 4.6 3.7 8.3 7.3 9.2M143.9 105c-1.9-.4-3.5-1.2-4.9-2.3 1.4 5.6 2.5 11.3 4 17 1.2 5 2 10 2.4 15 .6 7.8-4.5 14.5-10.9 14.5h-15c-6.4 0-11.5-6.7-11-14.5.5-5 1.3-10 2.6-15 1.3-5.3 2.3-10.5 3.6-15.7-2.2 1.2-4.8 1.9-7.7 2-4.7.1-9.4-.3-14-1-4-.4-6.7-3-8-6.7-1.3-3.4-2-7-3.3-10.4-.5-1.5-1.6-2.8-2.4-4.2-.4-.6-.8-1.2-.9-1.8v-7.8a77 77 0 0124.5-3c6.1 0 12 1 17.8 3.2 4.7 1.7 9.7 1.8 14.4 0 9-3.4 18.2-3.8 27.5-3 4.9.5 9.8 1.6 14.8 2.4v8.2c0 .6-.3 1.5-.7 1.7-2 .9-2.2 2.7-2.7 4.5-.9 3.2-1.8 6.4-2.9 9.5a11 11 0 01-8.8 7.7 40.6 40.6 0 01-18.4-.2m29.4 80.6c-3.2-26.8-6.4-50-8.9-60.7a14.3 14.3 0 0014.1-14h.4a9 9 0 005.6-16.5 14.3 14.3 0 00-3.7-27.2 9 9 0 00-6.9-14.6c2.4-1.1 4.5-3 5.8-5 3.4-5.3 4-29-8-44.4-5-6.3-9.8-2.5-10 1.8-1 13.2-1.1 23-4.5 34.3a9 9 0 00-16-4.1 14.3 14.3 0 00-28.4 0 9 9 0 00-16 4.1c-3.4-11.2-3.5-21.1-4.4-34.3-.3-4.3-5.2-8-10-1.8-12 15.3-11.5 39-8.1 44.4 1.3 2 3.4 3.9 5.8 5a9 9 0 00-7 14.6 14.3 14.3 0 00-3.6 27.2A9 9 0 0075 111h.5a14.5 14.5 0 0014.3 14c-4 17.2-10 66.3-15 111.3l-1.3 13.4a1656.4 1656.4 0 01106.6 0l-1.4-12.7-5.4-51.3" fill="#AAA" />
109+
<path d="M59.3 128.4c1.4 2.3 2.5 4.6 3.4 7-1-4.1-2.3-8.1-4.3-12-3.1-6-7.8-5.8-10.7 0-2 4-3.2 8-4.3 12.1 1-2.4 2-4.8 3.4-7.1 3.4-5.8 8.8-6 12.5 0M207.8 128.4a42.9 42.9 0 013.4 7c-1-4.1-2.3-8.1-4.3-12-3.2-6-7.8-5.8-10.7 0-2 4-3.3 8-4.3 12.1.9-2.4 2-4.8 3.4-7.1 3.4-5.8 8.8-6 12.5 0M134.6 92.9c2 3.5 3.6 7 4.8 10.7-1.3-5.4-3-10.6-5.6-15.7-4-7.5-9.7-7.2-13.3 0a75.4 75.4 0 00-5.6 16c1.2-3.8 2.7-7.4 4.7-11 4.1-7.2 10.6-7.5 15 0M43.8 136.8c.9 4.6 3.7 8.3 7.3 9.2 0 2.7 0 5.5.2 8.2.3 3.3.4 6.6 1 9.6.3 2.3 1 2.2 1.3 0 .5-3 .6-6.3 1-9.6l.2-8.2c3.5-1 6.4-4.6 7.2-9.2a17.8 17.8 0 01-9 2.4c-3.5 0-6.6-1-9.2-2.4M192.4 136.8c.8 4.6 3.7 8.3 7.2 9.2 0 2.7 0 5.5.3 8.2.3 3.3.4 6.6 1 9.6.3 2.3.9 2.2 1.2 0 .6-3 .7-6.3 1-9.6.2-2.7.3-5.5.2-8.2 3.6-1 6.4-4.6 7.3-9.2a17.8 17.8 0 01-9.1 2.4c-3.4 0-6.6-1-9.1-2.4M138.3 104.6c-3.1 1.9-7 3-11.3 3-4.3 0-8.2-1.1-11.3-3 1 5.8 4.5 10.3 9 11.5 0 3.4 0 6.8.3 10.2.4 4.1.5 8.2 1.2 12 .4 2.9 1.2 2.7 1.6 0 .7-3.8.8-7.9 1.2-12 .3-3.4.3-6.8.3-10.2 4.5-1.2 8-5.7 9-11.5" fill="<?php echo htmlentities($config['color']['text']['secondary'], \ENT_QUOTES); ?>" />
110+
<path d="M51 146c0 2.7.1 5.5.3 8.2.3 3.3.4 6.6 1 9.6.3 2.3 1 2.2 1.3 0 .5-3 .6-6.3 1-9.6l.2-8.2c3.5-1 6.4-4.6 7.2-9.2a17.8 17.8 0 01-9 2.4c-3.5 0-6.6-1-9.2-2.4.9 4.6 3.7 8.3 7.3 9.2M143.9 105c-1.9-.4-3.5-1.2-4.9-2.3 1.4 5.6 2.5 11.3 4 17 1.2 5 2 10 2.4 15 .6 7.8-4.5 14.5-10.9 14.5h-15c-6.4 0-11.5-6.7-11-14.5.5-5 1.3-10 2.6-15 1.3-5.3 2.3-10.5 3.6-15.7-2.2 1.2-4.8 1.9-7.7 2-4.7.1-9.4-.3-14-1-4-.4-6.7-3-8-6.7-1.3-3.4-2-7-3.3-10.4-.5-1.5-1.6-2.8-2.4-4.2-.4-.6-.8-1.2-.9-1.8v-7.8a77 77 0 0124.5-3c6.1 0 12 1 17.8 3.2 4.7 1.7 9.7 1.8 14.4 0 9-3.4 18.2-3.8 27.5-3 4.9.5 9.8 1.6 14.8 2.4v8.2c0 .6-.3 1.5-.7 1.7-2 .9-2.2 2.7-2.7 4.5-.9 3.2-1.8 6.4-2.9 9.5a11 11 0 01-8.8 7.7 40.6 40.6 0 01-18.4-.2m29.4 80.6c-3.2-26.8-6.4-50-8.9-60.7a14.3 14.3 0 0014.1-14h.4a9 9 0 005.6-16.5 14.3 14.3 0 00-3.7-27.2 9 9 0 00-6.9-14.6c2.4-1.1 4.5-3 5.8-5 3.4-5.3 4-29-8-44.4-5-6.3-9.8-2.5-10 1.8-1 13.2-1.1 23-4.5 34.3a9 9 0 00-16-4.1 14.3 14.3 0 00-28.4 0 9 9 0 00-16 4.1c-3.4-11.2-3.5-21.1-4.4-34.3-.3-4.3-5.2-8-10-1.8-12 15.3-11.5 39-8.1 44.4 1.3 2 3.4 3.9 5.8 5a9 9 0 00-7 14.6 14.3 14.3 0 00-3.6 27.2A9 9 0 0075 111h.5a14.5 14.5 0 0014.3 14c-4 17.2-10 66.3-15 111.3l-1.3 13.4a1656.4 1656.4 0 01106.6 0l-1.4-12.7-5.4-51.3" fill="<?php echo htmlentities($config['color']['text']['secondary'], \ENT_QUOTES); ?>" />
108111
<g clip-path="url(#a)">
109-
<path d="M83.5 136.6l-2.3.7c-5 1-9.8 1-14.8-.2-1.4-.3-2.7-1-3.8-1.9l3.1 13.7c1 4 1.7 8 2 12 .5 6.3-3.6 11.6-8.7 11.6H46.9c-5.1 0-9.2-5.3-8.7-11.6.3-4 1-8 2-12 1-4.2 1.8-8.5 2.9-12.6-1.8 1-3.9 1.5-6.3 1.6a71 71 0 01-11.1-.7 7.7 7.7 0 01-6.5-5.5c-1-2.7-1.6-5.6-2.6-8.3-.4-1.2-1.3-2.3-2-3.4-.2-.4-.6-1-.6-1.4v-6.3c6.4-2 13-2.6 19.6-2.5 4.9.1 9.6 1 14.2 2.6 3.9 1.4 7.9 1.5 11.7 0 1.8-.7 3.6-1.2 5.5-1.6a13 13 0 01-1.6-15.5A18.3 18.3 0 0159 73.1a11.5 11.5 0 00-17.4 8.1 7.2 7.2 0 00-12.9 3.3c-2.7-9-2.8-17-3.6-27.5-.2-3.4-4-6.5-8-1.4C7.5 67.8 7.9 86.9 10.6 91c1.1 1.7 2.8 3.1 4.7 4a7.2 7.2 0 00-5.6 11.7 11.5 11.5 0 00-2.9 21.9 7.2 7.2 0 004.5 13.2h.3c0 .6 0 1.1.2 1.7.9 5.4 5.6 9.5 11.3 9.5A1177.2 1177.2 0 0010 253.2c18.1-1.5 38.1-2.6 59.5-3.4.4-4.6.8-9.3 1.4-14 1.2-11.6 3.3-30.5 5.7-49.7 2.2-18 4.7-36.3 7-49.5" fill="#AAA" />
112+
<path d="M83.5 136.6l-2.3.7c-5 1-9.8 1-14.8-.2-1.4-.3-2.7-1-3.8-1.9l3.1 13.7c1 4 1.7 8 2 12 .5 6.3-3.6 11.6-8.7 11.6H46.9c-5.1 0-9.2-5.3-8.7-11.6.3-4 1-8 2-12 1-4.2 1.8-8.5 2.9-12.6-1.8 1-3.9 1.5-6.3 1.6a71 71 0 01-11.1-.7 7.7 7.7 0 01-6.5-5.5c-1-2.7-1.6-5.6-2.6-8.3-.4-1.2-1.3-2.3-2-3.4-.2-.4-.6-1-.6-1.4v-6.3c6.4-2 13-2.6 19.6-2.5 4.9.1 9.6 1 14.2 2.6 3.9 1.4 7.9 1.5 11.7 0 1.8-.7 3.6-1.2 5.5-1.6a13 13 0 01-1.6-15.5A18.3 18.3 0 0159 73.1a11.5 11.5 0 00-17.4 8.1 7.2 7.2 0 00-12.9 3.3c-2.7-9-2.8-17-3.6-27.5-.2-3.4-4-6.5-8-1.4C7.5 67.8 7.9 86.9 10.6 91c1.1 1.7 2.8 3.1 4.7 4a7.2 7.2 0 00-5.6 11.7 11.5 11.5 0 00-2.9 21.9 7.2 7.2 0 004.5 13.2h.3c0 .6 0 1.1.2 1.7.9 5.4 5.6 9.5 11.3 9.5A1177.2 1177.2 0 0010 253.2c18.1-1.5 38.1-2.6 59.5-3.4.4-4.6.8-9.3 1.4-14 1.2-11.6 3.3-30.5 5.7-49.7 2.2-18 4.7-36.3 7-49.5" fill="<?php echo htmlentities($config['color']['text']['secondary'], \ENT_QUOTES); ?>" />
110113
</g>
111114
<g clip-path="url(#b)">
112-
<path d="M254.4 118.2c0-5.8-4.2-10.5-9.7-11.4a7.2 7.2 0 00-5.6-11.7c2-.9 3.6-2.3 4.7-4 2.7-4.2 3.1-23.3-6.5-35.5-4-5.1-7.8-2-8 1.4-.8 10.5-.9 18.5-3.6 27.5a7.2 7.2 0 00-12.8-3.3 11.5 11.5 0 00-17.8-7.9 18.4 18.4 0 01-4.5 22 13 13 0 01-1.3 15.2c2.4.5 4.8 1 7.1 2 3.8 1.3 7.8 1.4 11.6 0 7.2-2.8 14.6-3 22-2.4 4 .4 7.9 1.2 12 1.9l-.1 6.6c0 .5-.2 1.2-.5 1.3-1.7.7-1.8 2.2-2.2 3.7l-2.3 7.6a8.8 8.8 0 01-7 6.1c-5 1-10 1-14.9-.2-1.5-.3-2.8-1-3.9-1.9 1.2 4.5 2 9.1 3.2 13.7 1 4 1.6 8 2 12 .4 6.3-3.6 11.6-8.8 11.6h-12c-5.2 0-9.3-5.3-8.8-11.6.4-4 1-8 2-12 1-4.2 1.9-8.5 3-12.6-1.8 1-4 1.5-6.3 1.6-3.7 0-7.5-.3-11.2-.7a7.7 7.7 0 01-3.7-1.5c3.1 18.4 7.1 51.2 12.5 100.9l.6 5.3.8 7.9c21.4.7 41.5 1.9 59.7 3.4L243 243l-4.4-41.2a606 606 0 00-7-48.7 11.5 11.5 0 0011.2-11.2h.4a7.2 7.2 0 004.4-13.2c4-1.8 6.8-5.8 6.8-10.5" fill="#AAA" />
115+
<path d="M254.4 118.2c0-5.8-4.2-10.5-9.7-11.4a7.2 7.2 0 00-5.6-11.7c2-.9 3.6-2.3 4.7-4 2.7-4.2 3.1-23.3-6.5-35.5-4-5.1-7.8-2-8 1.4-.8 10.5-.9 18.5-3.6 27.5a7.2 7.2 0 00-12.8-3.3 11.5 11.5 0 00-17.8-7.9 18.4 18.4 0 01-4.5 22 13 13 0 01-1.3 15.2c2.4.5 4.8 1 7.1 2 3.8 1.3 7.8 1.4 11.6 0 7.2-2.8 14.6-3 22-2.4 4 .4 7.9 1.2 12 1.9l-.1 6.6c0 .5-.2 1.2-.5 1.3-1.7.7-1.8 2.2-2.2 3.7l-2.3 7.6a8.8 8.8 0 01-7 6.1c-5 1-10 1-14.9-.2-1.5-.3-2.8-1-3.9-1.9 1.2 4.5 2 9.1 3.2 13.7 1 4 1.6 8 2 12 .4 6.3-3.6 11.6-8.8 11.6h-12c-5.2 0-9.3-5.3-8.8-11.6.4-4 1-8 2-12 1-4.2 1.9-8.5 3-12.6-1.8 1-4 1.5-6.3 1.6-3.7 0-7.5-.3-11.2-.7a7.7 7.7 0 01-3.7-1.5c3.1 18.4 7.1 51.2 12.5 100.9l.6 5.3.8 7.9c21.4.7 41.5 1.9 59.7 3.4L243 243l-4.4-41.2a606 606 0 00-7-48.7 11.5 11.5 0 0011.2-11.2h.4a7.2 7.2 0 004.4-13.2c4-1.8 6.8-5.8 6.8-10.5" fill="<?php echo htmlentities($config['color']['text']['secondary'], \ENT_QUOTES); ?>" />
113116
</g>
114-
<path d="M180 249.6h.4a6946 6946 0 00-7.1-63.9l5.4 51.3 1.4 12.6M164.4 125c2.5 10.7 5.7 33.9 8.9 60.7a570.9 570.9 0 00-8.9-60.7M74.8 236.3l-1.4 13.4 1.4-13.4" fill="#AAA" />
117+
<path d="M180 249.6h.4a6946 6946 0 00-7.1-63.9l5.4 51.3 1.4 12.6M164.4 125c2.5 10.7 5.7 33.9 8.9 60.7a570.9 570.9 0 00-8.9-60.7M74.8 236.3l-1.4 13.4 1.4-13.4" fill="<?php echo htmlentities($config['color']['text']['secondary'], \ENT_QUOTES); ?>" />
115118
</svg>
116119
<a href="https://crowdsec.net/" target="_blank" rel="noopener">CrowdSec</a>
117120
</p>

src/templates/access-forbidden.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
require_once __DIR__.'/_base.php';
3-
function displayAccessForbiddenTemplate(bool $hideCrowdSecMentions): void
3+
function displayAccessForbiddenTemplate(array $config): void
44
{
5-
crowdSecBaseTemplatePart1();
5+
crowdSecBaseTemplatePart1($config, $config['text']['ban_wall']['tab_title']);
66
crowdSecBaseTemplatePart2(); ?>
7-
<h1>🤭 Oh!</h1>
8-
<p class="desc">This page is protected against cyber attacks and your IP has been banned by our system.</p>
9-
<?php crowdSecBaseTemplatePart3($hideCrowdSecMentions);
7+
<h1><?php echo htmlentities($config['text']['ban_wall']['title'], \ENT_QUOTES); ?></h1>
8+
<p class="desc"><?php echo htmlentities($config['text']['ban_wall']['subtitle'], \ENT_QUOTES); ?></p>
9+
<?php crowdSecBaseTemplatePart3($config, $config['text']['ban_wall']['footer']);
1010
} ?>

0 commit comments

Comments
 (0)