Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Téo GODDET
lemonldap-ng
Commits
3bee7401
Commit
3bee7401
authored
Feb 12, 2021
by
Christophe Maudoux
🐛
Browse files
display headers (#2458)
parent
6e1efc8b
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/DevOps.pm
View file @
3bee7401
...
...
@@ -72,6 +72,7 @@ q"I refuse to compile rules.json when useSafeJail isn't activated! Yes I know, I
}
}
$class
->
logger
->
debug
("
DevOps handler called by
$vhost
");
$class
->
locationRulesInit
(
undef
,
{
$vhost
=>
$json
->
{
rules
}
}
);
$class
->
headersInit
(
undef
,
{
$vhost
=>
$json
->
{
headers
}
}
);
$class
->
tsv
->
{
lastVhostUpdate
}
->
{
$vhost
}
=
time
;
...
...
lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Tree.pm
View file @
3bee7401
...
...
@@ -775,12 +775,6 @@ sub tree {
form
=>
'
simpleInputContainer
',
nodes
=>
[
'
checkState
',
'
checkStateSecret
',
],
},
{
title
=>
'
devOpsCheck
',
help
=>
'
checkdevops.html
',
form
=>
'
simpleInputContainer
',
nodes
=>
['
checkDevOps
'],
},
{
title
=>
'
checkUsers
',
help
=>
'
checkuser.html
',
...
...
@@ -805,6 +799,12 @@ sub tree {
},
]
},
{
title
=>
'
devOpsCheck
',
help
=>
'
checkdevops.html
',
form
=>
'
simpleInputContainer
',
nodes
=>
['
checkDevOps
'],
},
{
title
=>
'
impersonation
',
help
=>
'
impersonation.html
',
...
...
lemonldap-ng-manager/site/htdocs/static/struct.json
View file @
3bee7401
This diff is collapsed.
Click to expand it.
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CheckDevOps.pm
View file @
3bee7401
...
...
@@ -68,6 +68,7 @@ sub display {
sub
run
{
my
(
$self
,
$req
)
=
@_
;
my
(
$msg
,
$alert
);
my
$headers
=
[]
;
# Check token
if
(
$self
->
ottRule
->
(
$req
,
{}
)
)
{
...
...
@@ -107,15 +108,23 @@ sub run {
my
$json
=
eval
{
from_json
(
$req
->
param
('
checkDevOpsFile
')
)
};
if
(
$@
)
{
$self
->
userLogger
->
error
("
CheckDevOps: bad 'rules.json' file ($@)
");
$msg
=
'
PE
'
.
PE_BAD_DEVOPS_FILE
;
$alert
=
'
alert-danger
';
$json
=
'';
$json
=
'';
$self
->
userLogger
->
error
("
CheckDevOps: bad 'rules.json' file ($@)
");
}
else
{
my
$vhost
=
$self
->
p
->
HANDLER
->
resolveAlias
(
$req
);
$self
->
p
->
HANDLER
->
headersInit
(
undef
,
{
$vhost
=>
$json
->
{
headers
}
}
);
$self
->
p
->
HANDLER
->
locationRulesInit
(
undef
,
{
$vhost
=>
$json
->
{
rules
}
}
);
$headers
=
$self
->
p
->
HANDLER
->
checkHeaders
(
$req
,
$req
->
userData
);
my
$list
=
join
'
,
',
map
{
"
$_
->{key}:
$_
->{value}
"
}
@$headers
;
$self
->
logger
->
debug
("
CheckDevOps compiled headers:
$list
");
$msg
=
'
checkDevOps
';
$alert
=
'
alert-info
';
$json
=
$req
->
param
('
checkDevOpsFile
');
$self
->
logger
->
debug
("
CheckDevOps provided file:
$json
");
}
my
$params
=
{
...
...
@@ -126,6 +135,7 @@ sub run {
MSG
=>
$msg
,
ALERTE
=>
$alert
,
FILE
=>
$json
,
HEADERS
=>
$headers
,
TOKEN
=>
(
$self
->
ottRule
->
(
$req
,
{}
)
?
$self
->
ott
->
createToken
()
...
...
lemonldap-ng-portal/site/templates/bootstrap/checkdevops.tpl
View file @
3bee7401
...
...
@@ -2,6 +2,18 @@
<div
id=
"errorcontent"
class=
"container"
>
<div
class=
"alert <TMPL_VAR NAME="
ALERTE
"
>
alert">
<div
class=
"text-center"
><span
trspan=
"<TMPL_VAR NAME="
MSG
"
>
">
</span></div></div>
<TMPL_IF
NAME=
"HEADERS"
>
<div
class=
"row"
>
<div
class=
"card col border-secondary"
>
<div
class=
"text-center bg-light text-dark"
><b><span
trspan=
"headers"
>
HEADERS
</span></b></div>
<div
class=
"font-weight-bold"
>
<TMPL_LOOP
NAME=
"HEADERS"
>
<TMPL_VAR
NAME=
"key"
>
:
<TMPL_VAR
NAME=
"value"
><br/>
</TMPL_LOOP>
</div>
</div>
</div>
</TMPL_IF>
<form
id=
"checkDevOps"
action=
"/checkdevops"
method=
"post"
class=
"password"
role=
"form"
>
<pre><textarea
id=
"checkDevOpsFile"
name=
"checkDevOpsFile"
class=
"form-control rounded-1"
rows=
"6"
trplaceholder=
"Paste your file here..."
required
><TMPL_VAR
NAME=
"FILE"
></textarea></pre>
<TMPL_IF
NAME=
"TOKEN"
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment