Compare commits
8 Commits
WIP/cpp20
...
5570154113
Author | SHA1 | Date | |
---|---|---|---|
5570154113 | |||
4f6bcd27b4 | |||
bbe74a2c50 | |||
5db9305408 | |||
c90e26a374 | |||
b297498ca9 | |||
fdcef18861 | |||
75268e0073 |
2
cache/fscache.cpp
vendored
2
cache/fscache.cpp
vendored
@ -46,7 +46,7 @@ void FsCache::removePrefix(std::string_view prefix)
|
|||||||
// TODO: lock dir
|
// TODO: lock dir
|
||||||
for(auto &entry : std::filesystem::directory_iterator(std::filesystem::path{this->path}))
|
for(auto &entry : std::filesystem::directory_iterator(std::filesystem::path{this->path}))
|
||||||
{
|
{
|
||||||
if(std::string_view(entry.path().filename().c_str()).starts_with(prefix) == 0)
|
if(std::string_view(entry.path().filename().c_str()).starts_with(prefix))
|
||||||
{
|
{
|
||||||
std::filesystem::remove_all(entry);
|
std::filesystem::remove_all(entry);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,11 @@ Response HandlerSearch::handleRequest(const Request &r)
|
|||||||
std::string q = r.get("q");
|
std::string q = r.get("q");
|
||||||
if(q.empty())
|
if(q.empty())
|
||||||
{
|
{
|
||||||
return errorResponse("Missing search term", "No search term supplied");
|
TemplatePage searchForm = this->templ->getPage("searchform");
|
||||||
|
response.setBody(searchForm.render());
|
||||||
|
response.setStatus(200);
|
||||||
|
setGeneralVars(searchForm);
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pageDao = this->database->createPageDao();
|
auto pageDao = this->database->createPageDao();
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/capability.h>
|
#include <sys/capability.h>
|
||||||
|
#define HAVE_LANDLOCK 0
|
||||||
#include <qssb.h>
|
#include <qssb.h>
|
||||||
#include "../logger.h"
|
#include "../logger.h"
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
@ -59,18 +60,25 @@ bool SandboxLinux::enable(std::vector<std::string> fsPaths)
|
|||||||
policy->not_dumpable = 1;
|
policy->not_dumpable = 1;
|
||||||
policy->no_new_privs = 1;
|
policy->no_new_privs = 1;
|
||||||
policy->mount_path_policies_to_chroot = 1;
|
policy->mount_path_policies_to_chroot = 1;
|
||||||
/* TODO: as said, a whitelist approach is better. As such, this list is bound to be incomplete in the
|
|
||||||
* sense that more could be listed here and some critical ones are probably missing */
|
|
||||||
|
|
||||||
/* TODO: use qssb groups */
|
|
||||||
long blacklisted_syscalls[] = {QSSB_SYS(setuid), QSSB_SYS(connect), QSSB_SYS(chroot), QSSB_SYS(pivot_root),
|
|
||||||
QSSB_SYS(mount), QSSB_SYS(setns), QSSB_SYS(unshare), QSSB_SYS(ptrace),
|
|
||||||
QSSB_SYS(personality), QSSB_SYS(prctl), QSSB_SYS(execveat), QSSB_SYS(execve),
|
|
||||||
QSSB_SYS(fork)};
|
|
||||||
qssb_append_syscalls_policy(policy, QSSB_SYSCALL_DENY_KILL_PROCESS, blacklisted_syscalls,
|
|
||||||
sizeof(blacklisted_syscalls) / sizeof(blacklisted_syscalls[0]));
|
|
||||||
qssb_append_syscall_default_policy(policy, QSSB_SYSCALL_ALLOW);
|
|
||||||
|
|
||||||
|
if(qssb_append_group_syscall_policy(policy, QSSB_SYSCALL_ALLOW, QSSB_SYSCGROUP_DEFAULT_ALLOW) != 0)
|
||||||
|
{
|
||||||
|
Logger::error() << "Sandbox: Failed to add whitelist!";
|
||||||
|
qssb_free_policy(policy);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(qssb_append_group_syscall_policy(policy, QSSB_SYSCALL_ALLOW, QSSB_SYSCGROUP_SOCKET | QSSB_SYSCGROUP_FUTEX | QSSB_SYSCGROUP_PATH | QSSB_SYSCGROUP_SCHED) != 0)
|
||||||
|
{
|
||||||
|
Logger::error() << "Sandbox: Failed to add socket group!";
|
||||||
|
qssb_free_policy(policy);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(qssb_append_syscall_default_policy(policy, QSSB_SYSCALL_DENY_KILL_PROCESS) != 0)
|
||||||
|
{
|
||||||
|
Logger::error() << "Sandbox: Default policy";
|
||||||
|
qssb_free_policy(policy);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if(qssb_enable_policy(policy) != 0)
|
if(qssb_enable_policy(policy) != 0)
|
||||||
{
|
{
|
||||||
Logger::error() << "Sandbox: Activation of seccomp blacklist failed!";
|
Logger::error() << "Sandbox: Activation of seccomp blacklist failed!";
|
||||||
|
Submodule submodules/qssb.h updated: 0d7c5bd6d4...d847d0f996
@ -6,16 +6,15 @@
|
|||||||
<title>{qswiki:var:title}</title>
|
<title>{qswiki:var:title}</title>
|
||||||
<body>
|
<body>
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
|
||||||
<li><a href="{qswiki:config:linkindex}"><h2>{qswiki:config:wikiname}</h2></a></li>
|
|
||||||
</ul>
|
|
||||||
<ul id="nav">
|
<ul id="nav">
|
||||||
<li><a href="{qswiki:config:linkrecent}">Recent changes</a></li>
|
<li><a href="{qswiki:config:linkindex}"><h2>{qswiki:config:wikiname}</h2></a></li>
|
||||||
<li><a href="{qswiki:config:linkallpages}">All pages</a></li>
|
<li><a href="{qswiki:config:linkrecent}">Recent changes</a></li>
|
||||||
<li><a href="{qswiki:config:linkallcats}">All categories</a></li>
|
<li><a href="{qswiki:config:linkallpages}">All pages</a></li>
|
||||||
</ul>
|
<li><a href="{qswiki:config:linkallcats}">All categories</a></li>
|
||||||
|
<li id="searchlink"><a href="{qswiki:config:linksearch}">Search</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<ul id="right" class="search">
|
<ul id="right" class="search">
|
||||||
<li><div><form action="{qswiki:config:wikipath}" method="GET"><input type="hidden" name="action" value="search"/><input type="text" name="q" value="search here" onfocus="this.value=''"></form></div></li>
|
<li><div id="searchbar"><form action="{qswiki:config:wikipath}" method="GET"><input type="hidden" name="action" value="search"/><input type="text" name="q" value="search here" onfocus="this.value=''"></form></div></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -6,20 +6,15 @@
|
|||||||
<title>{qswiki:var:title}</title>
|
<title>{qswiki:var:title}</title>
|
||||||
<body>
|
<body>
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
|
||||||
<li><a href="{qswiki:config:linkindex}"><h2>{qswiki:config:wikiname}</h2></a></li>
|
|
||||||
</ul>
|
|
||||||
<ul id="nav">
|
<ul id="nav">
|
||||||
|
<li><a href="{qswiki:config:linkindex}"><h2>{qswiki:config:wikiname}</h2></a></li>
|
||||||
<li><a href="{qswiki:config:linkrecent}">Recent changes</a></li>
|
<li><a href="{qswiki:config:linkrecent}">Recent changes</a></li>
|
||||||
<li><a href="{qswiki:config:linkallpages}">All pages</a></li>
|
<li><a href="{qswiki:config:linkallpages}">All pages</a></li>
|
||||||
<li><a href="{qswiki:config:linkallcats}">All categories</a></li>
|
<li><a href="{qswiki:config:linkallcats}">All categories</a></li>
|
||||||
</ul>
|
<li id="searchlink"><a href="{qswiki:config:linksearch}">Search</a></li>
|
||||||
|
|
||||||
<ul>
|
|
||||||
{qswiki:var:headerlinks}
|
{qswiki:var:headerlinks}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul id="right" class="search">
|
<ul id="right" class="search">
|
||||||
<li><div><form action="{qswiki:config:wikipath}" method="GET"><input type="hidden" name="action" value="search"/><input type="text" value="search here" onfocus="this.value=''" name="q"/></form></div></li>
|
<li><div id="searchbar"><form action="{qswiki:config:wikipath}" method="GET"><input type="hidden" name="action" value="search"/><input type="text" value="search here" onfocus="this.value=''" name="q"/></form></div></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
7
template/quitesimple/searchform
Normal file
7
template/quitesimple/searchform
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{qswiki:include:general_header}
|
||||||
|
<main id="content">
|
||||||
|
<h2>Search</h2><br>
|
||||||
|
Search content of pages:
|
||||||
|
<form action="{qswiki:config:wikipath}" method="GET"><input type="hidden" name="action" value="search"/><input type="text" name="q" value="search here" onfocus="this.value=''"></form>
|
||||||
|
</main>
|
||||||
|
{qswiki:include:general_footer}
|
@ -23,7 +23,7 @@ h1, h2, h3
|
|||||||
{
|
{
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav
|
nav
|
||||||
@ -37,6 +37,7 @@ nav
|
|||||||
grid-area: nav;
|
grid-area: nav;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nav ul
|
nav ul
|
||||||
{
|
{
|
||||||
background-color: #062463;
|
background-color: #062463;
|
||||||
@ -47,16 +48,12 @@ nav ul
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nav li
|
nav li
|
||||||
{
|
{
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nav a, nav a:visited
|
nav a, nav a:visited
|
||||||
@ -68,7 +65,6 @@ nav a, nav a:visited
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 100%;
|
line-height: 100%;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nav a:hover, nav a:focus
|
nav a:hover, nav a:focus
|
||||||
@ -81,8 +77,6 @@ nav a:hover, nav a:focus
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
a, a:visited
|
a, a:visited
|
||||||
{
|
{
|
||||||
color: #062463;;
|
color: #062463;;
|
||||||
@ -92,40 +86,36 @@ a:hover
|
|||||||
{
|
{
|
||||||
background-color: #062463;
|
background-color: #062463;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#content
|
#content
|
||||||
{
|
{
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
font-size: 14pt;
|
font-size: 14pt;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
grid-area: main
|
grid-area: main
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar
|
#sidebar
|
||||||
{
|
{
|
||||||
grid-area: side;
|
grid-area: side;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar ul
|
#sidebar ul
|
||||||
{
|
{
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar a, a:visited
|
#sidebar a, a:visited
|
||||||
{
|
{
|
||||||
color: #062463;
|
color: #062463;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar a:hover
|
#sidebar a:hover
|
||||||
{
|
{
|
||||||
background-color: #062463;
|
background-color: #062463;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content a, a:visited
|
#content a, a:visited
|
||||||
@ -135,11 +125,10 @@ list-style-type: none;
|
|||||||
|
|
||||||
#content a:hover
|
#content a:hover
|
||||||
{
|
{
|
||||||
background-color: #062463;
|
background-color: #062463;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footer
|
footer
|
||||||
{
|
{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -160,6 +149,7 @@ footer ul
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer li
|
footer li
|
||||||
{
|
{
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -168,14 +158,12 @@ footer li
|
|||||||
line-height: 45px;
|
line-height: 45px;
|
||||||
color: white;
|
color: white;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
//flex: 1 1 0;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a, a:visited
|
footer a, a:visited
|
||||||
{
|
{
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|
||||||
color: white;
|
color: white;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
@ -190,7 +178,7 @@ footer a:hover, ul#nav a:focus
|
|||||||
|
|
||||||
#cats
|
#cats
|
||||||
{
|
{
|
||||||
background-color: #062463;
|
background-color: #062463;
|
||||||
}
|
}
|
||||||
|
|
||||||
.letter_search_result
|
.letter_search_result
|
||||||
@ -198,20 +186,27 @@ background-color: #062463;
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
ol
|
ol
|
||||||
{
|
{
|
||||||
counter-reset: item;
|
counter-reset: item;
|
||||||
}
|
}
|
||||||
|
|
||||||
.indexlink
|
.indexlink
|
||||||
{
|
{
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notexists
|
.notexists
|
||||||
{
|
{
|
||||||
color: red !important;
|
color: red !important;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#searchlink
|
||||||
|
{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (orientation: portrait)
|
@media screen and (orientation: portrait)
|
||||||
{
|
{
|
||||||
@ -219,13 +214,23 @@ display: block;
|
|||||||
{
|
{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#footer li:nth-child(-n+2)
|
#footer li:nth-child(-n+2)
|
||||||
{
|
{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#footer li:nth-of-type(3)
|
#footer li:nth-of-type(3)
|
||||||
{
|
{
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#searchlink {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#searchbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user