Security Settings:
xmlrpc deaktivieren Autorenscan deaktivieren Scripting in /wp-content/uploads/ deaktivieren Zugriff auf potenziell sensible Dateien blockieren Dateieditor im WP Dashboard deaktivieren Skriptverkettung deaktivieren Skriptausführung im Include-Verzeichnis deaktivieren Zugriff von ungewollten Bots verbieten Auflistung von Verzeichnissen deaktivieren Debug-Ausgaben deaktivieren Login-URL ändern
This commit is contained in:
parent
69322d64f3
commit
80fb6cd452
@ -21,6 +21,7 @@ body {
|
||||
color: #1d4899 !important;
|
||||
font-weight: bold !important;
|
||||
margin-left: 30px !important;
|
||||
border-color: #f0f0f0;
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +55,7 @@ body {
|
||||
|
||||
|
||||
#adminmenu div.wp-menu-image:before {
|
||||
color: #f1f3f3;
|
||||
color: rgba(29, 72, 153, 0.75);
|
||||
}
|
||||
|
||||
#adminmenu a:hover,
|
||||
@ -62,6 +63,8 @@ body {
|
||||
#adminmenu li.opensub > a.menu-top,
|
||||
#adminmenu li > a.menu-top:focus {
|
||||
color: #1d4899;
|
||||
border-color: #f0f0f0;
|
||||
|
||||
font-weight: bold;
|
||||
background: linear-gradient(to right, #efefef, rgba(255, 203, 4, 0.45));
|
||||
border-radius: 10px;
|
||||
@ -74,12 +77,16 @@ body {
|
||||
font-weight: bold;
|
||||
background: linear-gradient(to right, #efefef, rgba(255, 203, 4, 0.45));
|
||||
border-radius: 10px;
|
||||
border-width: 0;}
|
||||
border-width: 0;
|
||||
border-color: #f0f0f0;
|
||||
|
||||
}
|
||||
|
||||
/* Active tabs use a bottom border color that matches the page background color. */
|
||||
.about-wrap .nav-tab-active,
|
||||
.nav-tab-active,
|
||||
.nav-tab-active:hover {
|
||||
border-style: none;
|
||||
background-color: #fff;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
@ -135,6 +142,7 @@ body {
|
||||
#adminmenu .wp-has-current-submenu.opensub .wp-submenu li.current a:hover,
|
||||
#adminmenu .wp-has-current-submenu.opensub .wp-submenu li.current a:focus {
|
||||
color: #e0e0e0;
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
ul#adminmenu a.wp-has-current-submenu:after,
|
||||
@ -163,10 +171,19 @@ ul#adminmenu > li.current > a.current:after {
|
||||
color: #f2fcff;
|
||||
}
|
||||
|
||||
.wp-menu-open .wp-submenu {
|
||||
display: block;
|
||||
}
|
||||
.wp-menu-open .wp-submenu li {
|
||||
padding-left: 30px !important;
|
||||
color: #1d4899 !important;
|
||||
font-weight: bold;
|
||||
border-color: #f0f0f0;
|
||||
|
||||
}
|
||||
|
||||
.wp-submenu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Admin Menu: bubble */
|
||||
@ -180,8 +197,7 @@ ul#adminmenu > li.current > a.current:after {
|
||||
#adminmenu li a.wp-has-current-submenu .update-plugins,
|
||||
#adminmenu li:hover a .awaiting-mod,
|
||||
#adminmenu li.menu-top:hover > a .update-plugins {
|
||||
color: #f2fcff;
|
||||
background: #627c83;
|
||||
#color: #f2fcff;
|
||||
}
|
||||
|
||||
/* Admin Menu: collapse button */
|
||||
@ -191,6 +207,8 @@ ul#adminmenu > li.current > a.current:after {
|
||||
font-weight: bold;
|
||||
border-radius: 10px;
|
||||
border-width: 0;
|
||||
border-color: #f0f0f0;
|
||||
|
||||
}
|
||||
|
||||
#collapse-button:hover,
|
||||
@ -201,7 +219,7 @@ ul#adminmenu > li.current > a.current:after {
|
||||
/* Admin Bar */
|
||||
#wpadminbar {
|
||||
color: #f2fcff;
|
||||
background: #738e96;
|
||||
background: rgba(29, 72, 153, 0.7);
|
||||
}
|
||||
|
||||
#wpadminbar .ab-item,
|
||||
@ -223,14 +241,14 @@ ul#adminmenu > li.current > a.current:after {
|
||||
#wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus,
|
||||
#wpadminbar.nojs .ab-top-menu > li.menupop:hover > .ab-item,
|
||||
#wpadminbar .ab-top-menu > li.menupop.hover > .ab-item {
|
||||
color: #9ebaa0;
|
||||
background: #627c83;
|
||||
color: #f2fcff;
|
||||
background: rgba(29, 72, 153, 0.7);
|
||||
}
|
||||
|
||||
#wpadminbar:not(.mobile) > #wp-toolbar li:hover span.ab-label,
|
||||
#wpadminbar:not(.mobile) > #wp-toolbar li.hover span.ab-label,
|
||||
#wpadminbar:not(.mobile) > #wp-toolbar a:focus span.ab-label {
|
||||
color: #9ebaa0;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#wpadminbar:not(.mobile) li:hover .ab-icon:before,
|
||||
@ -242,7 +260,7 @@ ul#adminmenu > li.current > a.current:after {
|
||||
|
||||
/* Admin Bar: submenu */
|
||||
#wpadminbar .menupop .ab-sub-wrapper {
|
||||
background: #627c83;
|
||||
background: rgba(29, 72, 153, 0.78);
|
||||
}
|
||||
|
||||
#wpadminbar .quicklinks .menupop ul.ab-sub-secondary,
|
||||
@ -280,7 +298,7 @@ ul#adminmenu > li.current > a.current:after {
|
||||
#wpadminbar li.hover .ab-item:before,
|
||||
#wpadminbar li:hover #adminbarsearch:before,
|
||||
#wpadminbar li #adminbarsearch.adminbar-focused:before {
|
||||
color: #9ebaa0;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#wpadminbar .quicklinks li a:hover .blavatar,
|
||||
@ -289,7 +307,7 @@ ul#adminmenu > li.current > a.current:after {
|
||||
#wpadminbar .menupop .menupop > .ab-item:hover:before,
|
||||
#wpadminbar.mobile .quicklinks .ab-icon:before,
|
||||
#wpadminbar.mobile .quicklinks .ab-item:before {
|
||||
color: #9ebaa0;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#wpadminbar.mobile .quicklinks .hover .ab-icon:before,
|
||||
@ -302,156 +320,34 @@ ul#adminmenu > li.current > a.current:after {
|
||||
color: #f1f3f3;
|
||||
}
|
||||
|
||||
#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input:focus {
|
||||
color: #f2fcff;
|
||||
background: #879ea5;
|
||||
.button {
|
||||
background: rgba(29, 72, 153, 0.62) !important;
|
||||
color: #ffffff !important;
|
||||
border-color: #071e4d;
|
||||
box-shadow: 5px 5px 10px #d0d0d0;
|
||||
}
|
||||
|
||||
/* Admin Bar: recovery mode */
|
||||
#wpadminbar #wp-admin-bar-recovery-mode {
|
||||
color: #f2fcff;
|
||||
background-color: #aa9d88;
|
||||
|
||||
.bdp_setting_box {
|
||||
width: 100%;
|
||||
background-color: #ffffff;
|
||||
padding: 15px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-top-width: 0 !important;
|
||||
border-color: #1d94cf;
|
||||
}
|
||||
|
||||
#wpadminbar #wp-admin-bar-recovery-mode .ab-item,
|
||||
#wpadminbar #wp-admin-bar-recovery-mode a.ab-item {
|
||||
color: #f2fcff;
|
||||
.bdp_setting_box:first-of-type {
|
||||
border-top-width: 1px !important;
|
||||
}
|
||||
|
||||
#wpadminbar .ab-top-menu > #wp-admin-bar-recovery-mode.hover > .ab-item,
|
||||
#wpadminbar.nojq .quicklinks .ab-top-menu > #wp-admin-bar-recovery-mode > .ab-item:focus,
|
||||
#wpadminbar:not(.mobile) .ab-top-menu > #wp-admin-bar-recovery-mode:hover > .ab-item,
|
||||
#wpadminbar:not(.mobile) .ab-top-menu > #wp-admin-bar-recovery-mode > .ab-item:focus {
|
||||
color: #f2fcff;
|
||||
background-color: #998d7a;
|
||||
.bdp_setting_box label {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Admin Bar: my account */
|
||||
#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar > a img {
|
||||
border-color: #879ea5;
|
||||
background-color: #ff0000;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
#wpadminbar #wp-admin-bar-user-info .display-name {
|
||||
color: #f2fcff;
|
||||
}
|
||||
|
||||
#wpadminbar #wp-admin-bar-user-info a:hover .display-name {
|
||||
color: #9ebaa0;
|
||||
}
|
||||
|
||||
#wpadminbar #wp-admin-bar-user-info .username {
|
||||
color: #ccdbe0;
|
||||
}
|
||||
|
||||
/* Pointers */
|
||||
.wp-pointer .wp-pointer-content h3 {
|
||||
background-color: #9ebaa0;
|
||||
border-color: #8faf91;
|
||||
}
|
||||
|
||||
.wp-pointer .wp-pointer-content h3:before {
|
||||
color: #9ebaa0;
|
||||
}
|
||||
|
||||
.wp-pointer.wp-pointer-top .wp-pointer-arrow,
|
||||
.wp-pointer.wp-pointer-top .wp-pointer-arrow-inner,
|
||||
.wp-pointer.wp-pointer-undefined .wp-pointer-arrow,
|
||||
.wp-pointer.wp-pointer-undefined .wp-pointer-arrow-inner {
|
||||
border-bottom-color: #9ebaa0;
|
||||
}
|
||||
|
||||
/* Media */
|
||||
.media-item .bar,
|
||||
.media-progress-bar div {
|
||||
background-color: #9ebaa0;
|
||||
}
|
||||
|
||||
.details.attachment {
|
||||
box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 7px #9ebaa0;
|
||||
}
|
||||
|
||||
.attachment.details .check {
|
||||
background-color: #9ebaa0;
|
||||
box-shadow: 0 0 0 1px #fff, 0 0 0 2px #9ebaa0;
|
||||
}
|
||||
|
||||
.media-selection .attachment.selection.details .thumbnail {
|
||||
box-shadow: 0 0 0 1px #fff, 0 0 0 3px #9ebaa0;
|
||||
}
|
||||
|
||||
/* Themes */
|
||||
.theme-browser .theme.active .theme-name,
|
||||
.theme-browser .theme.add-new-theme a:hover:after,
|
||||
.theme-browser .theme.add-new-theme a:focus:after {
|
||||
background: #9ebaa0;
|
||||
}
|
||||
|
||||
.theme-browser .theme.add-new-theme a:hover span:after,
|
||||
.theme-browser .theme.add-new-theme a:focus span:after {
|
||||
color: #9ebaa0;
|
||||
}
|
||||
|
||||
.theme-section.current,
|
||||
.theme-filter.current {
|
||||
border-bottom-color: #738e96;
|
||||
}
|
||||
|
||||
body.more-filters-opened .more-filters {
|
||||
color: #f2fcff;
|
||||
background-color: #738e96;
|
||||
}
|
||||
|
||||
body.more-filters-opened .more-filters:before {
|
||||
color: #f2fcff;
|
||||
}
|
||||
|
||||
body.more-filters-opened .more-filters:hover,
|
||||
body.more-filters-opened .more-filters:focus {
|
||||
background-color: #9ebaa0;
|
||||
color: #f2fcff;
|
||||
}
|
||||
|
||||
body.more-filters-opened .more-filters:hover:before,
|
||||
body.more-filters-opened .more-filters:focus:before {
|
||||
color: #f2fcff;
|
||||
}
|
||||
|
||||
/* Widgets */
|
||||
.widgets-chooser li.widgets-chooser-selected {
|
||||
background-color: #9ebaa0;
|
||||
color: #f2fcff;
|
||||
}
|
||||
|
||||
.widgets-chooser li.widgets-chooser-selected:before,
|
||||
.widgets-chooser li.widgets-chooser-selected:focus:before {
|
||||
color: #f2fcff;
|
||||
}
|
||||
|
||||
/* Responsive Component */
|
||||
div#wp-responsive-toggle a:before {
|
||||
color: #f1f3f3;
|
||||
}
|
||||
|
||||
.wp-responsive-open div#wp-responsive-toggle a {
|
||||
border-color: transparent;
|
||||
background: #9ebaa0;
|
||||
}
|
||||
|
||||
.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle a {
|
||||
background: #627c83;
|
||||
}
|
||||
|
||||
.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before {
|
||||
color: #f1f3f3;
|
||||
}
|
||||
|
||||
/* TinyMCE */
|
||||
.mce-container.mce-menu .mce-menu-item:hover,
|
||||
.mce-container.mce-menu .mce-menu-item.mce-selected,
|
||||
.mce-container.mce-menu .mce-menu-item:focus,
|
||||
.mce-container.mce-menu .mce-menu-item-normal.mce-active,
|
||||
.mce-container.mce-menu .mce-menu-item-preview.mce-active {
|
||||
background: #9ebaa0;
|
||||
}
|
||||
.bdp_setting_box label span {
|
||||
cursor: pointer;
|
||||
width: 10pt;
|
||||
color: #a0a0a0;
|
||||
}
|
176
bdp-kompass.php
176
bdp-kompass.php
@ -8,22 +8,14 @@
|
||||
* Requires PHP: 8.2
|
||||
* Author: Thomas Günther
|
||||
* Author URI: https://www.sachsen.pfadfinden.de
|
||||
* Update URI: https://lv-sachsen-main.bdp.mein-verein.online/wordpress/
|
||||
* Update URI: http://lv-sachsen-main.bdp.mein-verein.online/wordpress/
|
||||
* Text Domain: bdp-kompass
|
||||
*/
|
||||
|
||||
use Bdp\Modules\Security\Security;
|
||||
use Bdp\Modules\Seo\Seo;
|
||||
|
||||
|
||||
define('BDP_LV_PLUGIN_DIR', ABSPATH . '/wp-content/plugins/bdp-kompass/');
|
||||
define('BDP_LV_PLUGIN_URL', plugin_dir_url(__FILE__));
|
||||
define('BDP_LV_PLUGIN_SLUG', 'bdp-kompass');
|
||||
|
||||
require_once BDP_LV_PLUGIN_DIR . 'core/fileloader.php';
|
||||
|
||||
|
||||
bdp_create_menu_structure();
|
||||
require_once dirname(__FILE__) . '/includes/setup.php';
|
||||
|
||||
function bdp_plugin_install() {
|
||||
Seo::setup();
|
||||
@ -32,18 +24,19 @@ function bdp_plugin_install() {
|
||||
update_option('kompass_installation', true);
|
||||
}
|
||||
|
||||
function bdp_plugin_init()
|
||||
{
|
||||
remove_menu_page('admin.php?page=limit-login-attempts&tab=dashboard');
|
||||
if (get_option('kompass_installation') == true) {
|
||||
delete_option('kompass_installation');
|
||||
wp_redirect('admin.php?page=bdp-kompass%2Fmodules%2Findex.php&loadmodule=firstusage');
|
||||
}
|
||||
|
||||
function bdp_plugin_init() {
|
||||
Security::ProhibitBots();
|
||||
Security::SetPageFilters();
|
||||
|
||||
remove_menu_page( 'admin.php?page=limit-login-attempts&tab=dashboard' );
|
||||
if ( get_option( 'kompass_installation' ) == true ) {
|
||||
delete_option( 'kompass_installation' );
|
||||
wp_redirect( 'site-health.php?tab=bdp_enhanced_security');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
register_activation_hook(__FILE__, 'bdp_plugin_install');
|
||||
add_action('init', 'bdp_plugin_init');
|
||||
|
||||
function register_custom_theme_directory() {
|
||||
$file = ABSPATH . '/wp-content/plugins/bdp-kompass/buena/' ;
|
||||
@ -55,148 +48,3 @@ function register_custom_theme_directory() {
|
||||
}
|
||||
|
||||
#add_action( 'after_setup_theme', 'register_custom_theme_directory' );
|
||||
|
||||
class BdpVersionChecker
|
||||
{
|
||||
public $plugin_slug;
|
||||
public $version;
|
||||
public $cache_key;
|
||||
public $cache_allowed;
|
||||
public $updateUrl;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$plugin_data = get_plugin_data(__FILE__);
|
||||
$this->plugin_slug = 'bdp-kompass';
|
||||
$this->updateUrl = $plugin_data['UpdateURI'] . '/info.json';
|
||||
$this->version = $plugin_data['Version'];
|
||||
$this->cache_key = 'bdp_kompass_upd';
|
||||
$this->cache_allowed = true;
|
||||
|
||||
add_filter('plugins_api', array($this, 'info'), 20, 3);
|
||||
add_filter('site_transient_update_plugins', array($this, 'update'));
|
||||
add_action('upgrader_process_complete', array($this, 'purge'), 10, 2);
|
||||
}
|
||||
|
||||
public function request()
|
||||
{
|
||||
$remote = get_transient($this->cache_key);
|
||||
|
||||
if (false === $remote || !$this->cache_allowed) {
|
||||
|
||||
$remote = wp_remote_get(
|
||||
$this->updateUrl
|
||||
,
|
||||
array(
|
||||
'timeout' => 10,
|
||||
'headers' => array(
|
||||
'Accept' => 'application/json'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (
|
||||
is_wp_error($remote)
|
||||
|| 200 !== wp_remote_retrieve_response_code($remote)
|
||||
|| empty(wp_remote_retrieve_body($remote))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
set_transient($this->cache_key, $remote, 3600);
|
||||
}
|
||||
|
||||
$remote = json_decode(wp_remote_retrieve_body($remote));
|
||||
return $remote;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function info($res = '', $action = '', $args = '')
|
||||
{
|
||||
if (!isset($args->slug) || $args->slug !== $this->plugin_slug) {
|
||||
return $res;
|
||||
}
|
||||
|
||||
// get updates
|
||||
$remote = $this->request();
|
||||
if (!$remote) {
|
||||
return $res;
|
||||
}
|
||||
|
||||
$res = new stdClass();
|
||||
|
||||
$res->name = $remote->name;
|
||||
$res->slug = $remote->slug;
|
||||
$res->version = $remote->version;
|
||||
$res->tested = $remote->tested;
|
||||
$res->requires = $remote->requires;
|
||||
$res->author = $remote->author;
|
||||
$res->author_profile = $remote->author_profile;
|
||||
$res->download_link = $remote->download_url;
|
||||
$res->trunk = $remote->download_url;
|
||||
$res->requires_php = $remote->requires_php;
|
||||
$res->last_updated = $remote->last_updated;
|
||||
|
||||
$res->sections = array(
|
||||
'description' => $remote->sections->description,
|
||||
'installation' => $remote->sections->installation,
|
||||
'changelog' => $remote->sections->changelog
|
||||
);
|
||||
|
||||
if (!empty($remote->banners)) {
|
||||
$res->banners = array(
|
||||
'low' => $remote->banners->low,
|
||||
'high' => $remote->banners->high
|
||||
);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function update($transient)
|
||||
{
|
||||
if (empty($transient->checked)) {
|
||||
return $transient;
|
||||
}
|
||||
|
||||
$remote = $this->request();
|
||||
if(
|
||||
$remote
|
||||
&& version_compare( $this->version, $remote->version, '<' )
|
||||
&& version_compare( $remote->requires, get_bloginfo( 'version' ), '<=' )
|
||||
&& version_compare( $remote->requires_php, PHP_VERSION, '<' )
|
||||
) {
|
||||
$res = new stdClass();
|
||||
$res->slug = $this->plugin_slug;
|
||||
$res->plugin = plugin_basename( __FILE__ );
|
||||
$res->new_version = $remote->version;
|
||||
$res->tested = $remote->tested;
|
||||
$res->package = $remote->download_url;
|
||||
|
||||
$transient->response[ $res->plugin ] = $res;
|
||||
|
||||
} else {
|
||||
$res = new stdClass();
|
||||
$res->slug = $this->plugin_slug;
|
||||
$res->plugin = plugin_basename( __FILE__ );
|
||||
$transient->no_update[ $res->plugin ] = $res;
|
||||
}
|
||||
|
||||
return $transient;
|
||||
}
|
||||
|
||||
public function purge($upgrader, $options)
|
||||
{
|
||||
if (
|
||||
$this->cache_allowed
|
||||
&& 'update' === $options['action']
|
||||
&& 'plugin' === $options['type']
|
||||
) {
|
||||
delete_transient($this->cache_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
$class = new BdpVersionChecker();
|
||||
|
||||
add_filter( 'plugins_api', array( $class, 'info' ), 20, 3 );
|
||||
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
require_once (ABSPATH . '/wp-admin/includes/plugin.php');
|
||||
require_once (ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php');
|
||||
require_once (ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/lib/ics-parser/Event.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/lib/ics-parser/ICal.php');
|
||||
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/modules/seo/seo.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/modules/calendar/calendar.php');
|
||||
require_once (ABSPATH . '/wp-includes/pluggable.php');
|
||||
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/core/frontend-functions.php');
|
||||
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/modules/security/security.php');
|
56
includes/FileAccess.class.php
Normal file
56
includes/FileAccess.class.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Bdp\Libs;
|
||||
|
||||
class FileAccess extends \WP_Filesystem_Direct
|
||||
{
|
||||
public const HTACCESS_MAIN = '/.htaccess';
|
||||
public const HTACCESS_UPLOADS = '/wp-content/uploads/.htaccess';
|
||||
|
||||
public function __construct( $arg = null )
|
||||
{
|
||||
if ( ! defined( 'FS_CHMOD_FILE' ) ) {
|
||||
define( 'FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static function htaccessContains(string $needle, $file = self::HTACCESS_MAIN) : bool
|
||||
{
|
||||
return str_contains(FileAccess::readHtaccess($file), $needle);
|
||||
}
|
||||
|
||||
public static function readHtaccess($file = self::HTACCESS_MAIN) : string
|
||||
{
|
||||
$wfs = new self();
|
||||
if (!$wfs->exists(ABSPATH . $file)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $wfs->get_contents(ABSPATH . $file);
|
||||
}
|
||||
|
||||
public static function writeHtaccess(string $value, $file = self::HTACCESS_MAIN) : bool
|
||||
{
|
||||
$wfs = new self();
|
||||
$wfs->put_contents(ABSPATH . $file, $value);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function insertInHtaccess(string $element, $file = self::HTACCESS_MAIN) : bool
|
||||
{
|
||||
if (FileAccess::htaccessContains($element, $file)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$htaccessFile = FileAccess::readHtaccess($file);
|
||||
$htaccessFile .= PHP_EOL . $element . PHP_EOL;
|
||||
FileAccess::writeHtaccess($htaccessFile, $file);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function deleteFromHtaccess(string $element, $file = self::HTACCESS_MAIN) : bool {
|
||||
$htaccessFile = str_replace($element . PHP_EOL, '', FileAccess::readHtaccess($file));
|
||||
return FileAccess::writeHtaccess($htaccessFile, $file);
|
||||
}
|
||||
}
|
82
includes/WpConfigEditor.class.php
Normal file
82
includes/WpConfigEditor.class.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Bdp\Libs;
|
||||
|
||||
class WpConfigEditor extends \WP_Filesystem_Direct
|
||||
{
|
||||
public const WP_CONFIG_FILE = '/wp-config.php';
|
||||
|
||||
public function __construct($arg = null)
|
||||
{
|
||||
if (!defined('FS_CHMOD_FILE')) {
|
||||
define('FS_CHMOD_FILE', (fileperms(ABSPATH . 'index.php') & 0777 | 0644));
|
||||
}
|
||||
}
|
||||
|
||||
public function readConfig(): string
|
||||
{
|
||||
if (!$this->exists(ABSPATH . self::WP_CONFIG_FILE)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->get_contents(ABSPATH . self::WP_CONFIG_FILE);
|
||||
}
|
||||
|
||||
public function writeConfig($value): bool
|
||||
{
|
||||
$this->put_contents(ABSPATH . self::WP_CONFIG_FILE, $value);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function updateConfig($key, $value): bool
|
||||
{
|
||||
$wfs = new self();
|
||||
$configContent = $wfs->readConfig();
|
||||
|
||||
if (null === self::getConfigValue($key)) {
|
||||
$configContent .= "define( '$key', $value );";
|
||||
}
|
||||
|
||||
preg_match("/define\([ ]?'($key)'\,[ ]?(.*)[ ]?\);/",$configContent, $matches);
|
||||
$configContent = str_replace($matches[0], "define( '$key', $value );", $configContent);
|
||||
return $wfs->writeConfig($configContent);
|
||||
}
|
||||
|
||||
public static function getConfigValue($key): ?string
|
||||
{
|
||||
$wfs = new self();
|
||||
$configContent = $wfs->readConfig();
|
||||
|
||||
preg_match("/define\([ ]?'($key)'\,[ ]?(.*)[ ]?\);/",$configContent, $matches);
|
||||
if (count($matches) == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return trim($matches[2]);
|
||||
}
|
||||
|
||||
public static function updateSiteKeys(string $newKeySet)
|
||||
{
|
||||
foreach (explode(PHP_EOL, trim($newKeySet)) as $currentKeyLine) {
|
||||
preg_match("/define\([ ]?'(.*)'\,[ ]?(.*)[ ]?\);/", $currentKeyLine, $matches);
|
||||
self::updateConfig($matches[1], trim($matches[2]));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function deleteConfigKey($key): bool
|
||||
{
|
||||
if (null === self::getConfigValue($key)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$wfs = new self();
|
||||
$configContent = $wfs->readConfig();
|
||||
|
||||
preg_match("/define\([ ]?'($key)'\,[ ]?(.*)[ ]?\);/",$configContent, $matches);
|
||||
$configContent = str_replace($matches[0], '', $configContent);
|
||||
return $wfs->writeConfig($configContent);
|
||||
}
|
||||
}
|
7
includes/environment.php
Normal file
7
includes/environment.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
define('BDP_LV_PLUGIN_SLUG', 'bdp-kompass');
|
||||
define('BDP_LV_STARTUP_FILE', WP_PLUGIN_DIR . '/' . BDP_LV_PLUGIN_SLUG . '/' . BDP_LV_PLUGIN_SLUG . '.php');
|
||||
|
||||
define('BDP_LV_PLUGIN_DIR', plugin_dir_path(BDP_LV_STARTUP_FILE));
|
||||
define('BDP_LV_PLUGIN_URL', plugin_dir_url(BDP_LV_STARTUP_FILE));
|
45
includes/filters.php
Normal file
45
includes/filters.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
add_action( 'plugins_loaded', 'bdp_kompass_load_plugin_textdomain' );
|
||||
|
||||
register_activation_hook(__FILE__, 'bdp_plugin_install');
|
||||
add_action('init', 'bdp_plugin_init');
|
||||
|
||||
|
||||
|
||||
function _protect_wp_disablexmlrpc_string() {
|
||||
return "<FilesMatch \"xmlrpc.php\">
|
||||
Require all denied
|
||||
</FilesMatch>";
|
||||
}
|
||||
|
||||
function _protect_wp_disable_script_execution_string() {
|
||||
return '<FilesMatch "\.(php|phtml|php3|php4|php5|pl|py|jsp|asp|html|htm|shtml|sh|cgi|suspected)$">' . "
|
||||
deny from all
|
||||
</FilesMatch>";
|
||||
}
|
||||
|
||||
function _protect_wp_disable_special_files_string() {
|
||||
return '<FilesMatch "^.*(README|error_log|wp-config\.php|user.ini|log|php.ini|\.[hH][tT][aApP].*)$">' . "
|
||||
deny from all
|
||||
</FilesMatch>";
|
||||
}
|
||||
|
||||
function _protect_wp_disable_directory_listing_string() {
|
||||
return 'Options -Indexes';
|
||||
}
|
||||
|
||||
function _protect_wp_secure_include_dir_string() {
|
||||
return "RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteRule ^wp-admin/includes/ - [F,L]
|
||||
RewriteRule !^wp-includes/ - [S=3]
|
||||
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
|
||||
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
|
||||
RewriteRule ^wp-includes/theme-compat/ - [F,L]";
|
||||
}
|
||||
|
||||
function _protect_wp_initial_bot_list_array()
|
||||
{
|
||||
return explode(';', 'SemrushBot;AhrefsBot;DotBot;WhatCMS;Rogerbot;trendictionbot;BLEXBot;linkfluence;magpie-crawler;MJ12bot;Mediatoolkitbot;AspiegelBot;DomainStatsBot;Cincraw;Nimbostratus;HTTrack;serpstatbot;omgili;GrapeshotCrawler;MegaIndex;PetalBot;Semanticbot;Cocolyzebot;DomCopBot;Traackr;BomboraBot;Linguee;webtechbot;DomainStatsBot;Clickagy;sqlmap;Internet-structure-research-project-bot;Seekport;AwarioSmartBot;OnalyticaBot;Buck;Riddler;SBL-BOT;DF Bot 1.0;PubMatic Crawler Bot;BVBot;Sogou;Barkrowler;Yandex');
|
||||
}
|
@ -20,21 +20,13 @@ function bdp_add_menu_security() {
|
||||
|
||||
add_menu_page(
|
||||
'Sicherheit',
|
||||
'Erweiterte<br />Sicherheit',
|
||||
'Webseiten-Sicherheit',
|
||||
'manage_options',
|
||||
'site-health.php',
|
||||
'',
|
||||
'dashicons-admin-network',
|
||||
5
|
||||
);
|
||||
|
||||
https://wordpress.local.development.contelli.de/wp-admin/admin.php?page=limit-login-attempts
|
||||
add_submenu_page('site-health.php',
|
||||
'Login-Kontrolle',
|
||||
'Login-Kontrolle',
|
||||
'manage_options',
|
||||
get_admin_url() . 'admin.php?page=limit-login-attempts'
|
||||
);
|
||||
}
|
||||
|
||||
function bdp_add_menu_contents() {
|
5
includes/pre_requires.php
Normal file
5
includes/pre_requires.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
require_once (ABSPATH . '/wp-admin/includes/plugin.php');
|
||||
require_once (ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php');
|
||||
require_once (ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php');
|
||||
require_once (ABSPATH . '/wp-includes/pluggable.php');
|
36
includes/setup.php
Normal file
36
includes/setup.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
if ( ! defined( 'WP_PLUGIN_DIR' ) ) { // Abspath to wp-content/plugins
|
||||
define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // Full path, no trailing slash.
|
||||
}
|
||||
|
||||
require_once dirname(__FILE__) . '/pre_requires.php';
|
||||
require_once dirname(__FILE__) . '/environment.php';
|
||||
|
||||
require_once dirname(__FILE__) . '/update.class.php';
|
||||
|
||||
require_once BDP_LV_PLUGIN_DIR . 'includes/FileAccess.class.php';
|
||||
require_once BDP_LV_PLUGIN_DIR . 'includes/WpConfigEditor.class.php';
|
||||
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/includes/filters.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/lib/ics-parser/Event.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/lib/ics-parser/ICal.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/modules/seo/seo.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/modules/calendar/calendar.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/includes/frontend-functions.php');
|
||||
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/modules/security/security.php');
|
||||
|
||||
|
||||
bdp_create_menu_structure();
|
||||
|
||||
|
||||
function bdp_kompass_load_plugin_textdomain() {
|
||||
load_textdomain( BDP_LV_PLUGIN_SLUG, BDP_LV_PLUGIN_DIR . '/lang/' . BDP_LV_PLUGIN_SLUG . '_' . get_locale() . '.mo' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#$class =
|
||||
new BdpVersionChecker();
|
||||
#add_filter( 'plugins_api', array( $class, 'info' ), 20, 3 );
|
152
includes/update.class.php
Normal file
152
includes/update.class.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
class BdpVersionChecker
|
||||
{
|
||||
public $plugin_slug;
|
||||
public $version;
|
||||
public $cache_key;
|
||||
public $cache_allowed;
|
||||
public $updateUrl;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$plugin_data = get_plugin_data( BDP_LV_STARTUP_FILE );
|
||||
$this->plugin_slug = BDP_LV_PLUGIN_SLUG;
|
||||
$this->updateUrl = $plugin_data['UpdateURI'] . '/info_development.json';
|
||||
$this->version = $plugin_data['Version'];
|
||||
$this->cache_key = 'bdp-kompass-upd';
|
||||
$this->cache_allowed = false;
|
||||
|
||||
add_filter( 'plugins_api', array( $this, 'info' ), 20, 3 );
|
||||
add_filter( 'site_transient_update_plugins', array( $this, 'update' ) );
|
||||
add_action( 'upgrader_process_complete', array( $this, 'purge' ), 10, 2 );
|
||||
}
|
||||
|
||||
public function request(){
|
||||
|
||||
$remote = get_transient( $this->cache_key );
|
||||
|
||||
if( false === $remote || ! $this->cache_allowed ) {
|
||||
|
||||
$remote = wp_remote_get(
|
||||
$this->updateUrl
|
||||
,
|
||||
array(
|
||||
'timeout' => 10,
|
||||
'headers' => array(
|
||||
'Accept' => 'application/json'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if(
|
||||
is_wp_error( $remote )
|
||||
|| 200 !== wp_remote_retrieve_response_code( $remote )
|
||||
|| empty( wp_remote_retrieve_body( $remote ) )
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
set_transient( $this->cache_key, $remote, 3600 );
|
||||
|
||||
}
|
||||
|
||||
$remote = json_decode( wp_remote_retrieve_body( $remote ) );
|
||||
|
||||
return $remote;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function info( $res = '', $action = '', $args = '' )
|
||||
{
|
||||
if (!isset($args->slug) || $args->slug !== $this->plugin_slug) {
|
||||
return $res;
|
||||
}
|
||||
|
||||
// get updates
|
||||
$remote = $this->request();
|
||||
|
||||
if( ! $remote ) {
|
||||
return $res;
|
||||
}
|
||||
|
||||
$newVersion = $remote->version;
|
||||
$res = new stdClass();
|
||||
|
||||
$res->name = $remote->name;
|
||||
$res->slug = $remote->slug;
|
||||
$res->version = $newVersion;
|
||||
$res->tested = $remote->tested;
|
||||
$res->requires = $remote->requires;
|
||||
$res->author = $remote->author;
|
||||
$res->author_profile = $remote->author_profile;
|
||||
$res->download_link = $remote->download_url;
|
||||
$res->trunk = $remote->download_url;
|
||||
$res->requires_php = $remote->requires_php;
|
||||
$res->last_updated = $remote->last_updated;
|
||||
|
||||
$res->sections = array(
|
||||
'description' => $remote->sections->description,
|
||||
'installation' => $remote->sections->installation,
|
||||
'changelog' => $remote->sections->changelog
|
||||
);
|
||||
|
||||
if( ! empty( $remote->banners ) ) {
|
||||
$res->banners = array(
|
||||
'low' => $remote->banners->low,
|
||||
'high' => $remote->banners->high
|
||||
);
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
public function update( $transient ) {
|
||||
if ( empty($transient->checked ) ) {
|
||||
return $transient;
|
||||
}
|
||||
|
||||
$remote = $this->request();
|
||||
if(
|
||||
$remote
|
||||
&& version_compare( $this->version, $remote->version, '<' )
|
||||
&& version_compare( $remote->requires, get_bloginfo( 'version' ), '<=' )
|
||||
&& version_compare( $remote->requires_php, PHP_VERSION, '<' )
|
||||
) {
|
||||
|
||||
$newVersion = $remote->version;
|
||||
|
||||
$res = new stdClass();
|
||||
$res->slug = $this->plugin_slug;
|
||||
$res->plugin = plugin_basename( BDP_LV_STARTUP_FILE );
|
||||
$res->new_version = $newVersion;
|
||||
$res->tested = $remote->tested;
|
||||
$res->package = $remote->download_url;
|
||||
|
||||
$transient->response[ $res->plugin ] = $res;
|
||||
|
||||
} else {
|
||||
$res = new stdClass();
|
||||
$res->slug = $this->plugin_slug;
|
||||
$res->plugin = plugin_basename( BDP_LV_STARTUP_FILE );
|
||||
$transient->no_update[ $res->plugin ] = $res;
|
||||
}
|
||||
|
||||
return $transient;
|
||||
|
||||
}
|
||||
|
||||
public function purge( $upgrader, $options ){
|
||||
|
||||
if (
|
||||
$this->cache_allowed
|
||||
&& 'update' === $options['action']
|
||||
&& 'plugin' === $options[ 'type' ]
|
||||
) {
|
||||
// just clean the cache when new plugin version is installed
|
||||
delete_transient( $this->cache_key );
|
||||
}
|
||||
}
|
||||
}
|
BIN
lang/bdp-kompass_de_DE.mo
Normal file
BIN
lang/bdp-kompass_de_DE.mo
Normal file
Binary file not shown.
111
lang/bdp-kompass_de_DE.po
Normal file
111
lang/bdp-kompass_de_DE.po
Normal file
@ -0,0 +1,111 @@
|
||||
msgid "Extended Security"
|
||||
msgstr "Erweiterte Sicherheit"
|
||||
|
||||
msgid "Save changes"
|
||||
msgstr "Änderungen speichern"
|
||||
|
||||
msgid "All settings are saved."
|
||||
msgstr "Die Einstellungen wurden gespeichert."
|
||||
|
||||
msgid "Disable xmlrpc"
|
||||
msgstr "xmlrpc deaktivieren"
|
||||
|
||||
msgid "By introducing the REST API in WordPress, xmlrpc. However, php is no longer needed to communicate outside of WordPress, which is why there is no longer any reason to leave it active or use it. Therefore, for the security of your site, it is better to deactivate or delete it."
|
||||
msgstr "Durch die Einführung der REST API in WordPress wird xmlrpc. php jedoch nicht mehr benötigt, um außerhalb von WordPress zu kommunizieren, weshalb es hier keinen Grund mehr gibt, diese aktiv zu lassen oder zu nutzen. Deshalb ist es für die Sicherheit deiner Seite besser, diese zu deaktivieren oder zu löschen."
|
||||
|
||||
msgid "Disable Authorscan"
|
||||
msgstr "Autorenscan deaktivieren"
|
||||
|
||||
|
||||
msgid "The author page in WordPress typically displays a list of all posts by a specific author on your website. Unfortunately, Google also records the page and to prevent this, we can deactivate the author page. When a visitor clicks on an name of an author, they are redirected to the author page. This page contains a list of posts written by this author, as well as possibly a brief description of the author and a photo. It is also possible to record which user names have been created."
|
||||
msgstr "Die Autorenseite in WordPress zeigt normalerweise eine Liste aller Beiträge eines bestimmten Autors auf deiner Website an. Google erfasst die Seite auch leider und um das zu verhindern, können wir die Autorenseite deaktivieren. Wenn ein Besucher auf den Namen eines Autors klickt, wird er auf die Autorenseite weitergeleitet. Diese Seite enthält eine Liste der Beiträge, die von diesem Autor verfasst wurden, sowie möglicherweise eine kurze Beschreibung des Autors und ein Foto. Auch ist es darüber möglich zu erfassen, welche Nutzernamen angelegt sind."
|
||||
|
||||
msgid "Disable scripting in /wp-content/uploads/"
|
||||
msgstr "Scripting in /wp-content/uploads/ deaktivieren"
|
||||
|
||||
msgid "Disabling scripting in /wp-content/uploads/ can be a security measure to protect your WordPress website from potential threats. The /wp-content/uploads folder is usually the default folder where WordPress stores uploaded files, such as images, videos, and other media files."
|
||||
msgstr "Das Deaktivieren von Scripting in /wp-content/uploads/ kann eine Sicherheitsmaßnahme sein, um dein WordPress-Website vor potenziellen Bedrohungen zu schützen. Der Ordner /wp-content/uploads ist normalerweise der Standardordner, in dem WordPress hochgeladene Dateien, wie Bilder, Videos und andere Mediendateien, speichert."
|
||||
|
||||
msgid "Block access to potentially sensitive files"
|
||||
msgstr "Zugriff auf potenziell sensible Dateien blockieren"
|
||||
|
||||
msgid "This setting prohibits access to configuration files and log files"
|
||||
msgstr "Diese Einstellung verbietet den Zugriff auf Konfigurationsdateien sowie Log-Dateien"
|
||||
|
||||
msgid "Disable file editor in WP Dashboard"
|
||||
msgstr "Dateieditor im WP Dashboard deaktivieren"
|
||||
|
||||
msgid "This is a security feature that allows you to prevent users from editing theme and plugin files directly from the WordPress dashboard. This can be useful for a variety of reasons, including preventing accidental code changes and protecting your website from malicious attacks."
|
||||
msgstr "Hierbei handelt es sich um eine Sicherheitsfunktion, mit der Sie verhindern können, dass Benutzer Theme- und Plugin-Dateien direkt über das WordPress-Dashboard bearbeiten können. Dies kann aus verschiedenen Gründen nützlich sein, unter anderem um versehentliche Änderungen am Code zu verhindern und Ihre Website vor böswilligen Angriffen zu schützen."
|
||||
|
||||
msgid "Disable script concatenation"
|
||||
msgstr "Skriptverkettung deaktivieren"
|
||||
|
||||
msgid "Disabling script concatenation in the WordPress admin panel is a simple and effective way to enhance performance. However, it is crucial to carefully consider the impact of this change, as it may increase the number of HTTP requests, potentially affecting loading times"
|
||||
msgstr "Das Deaktivieren der Skriptverkettung im WordPress-Admin-Panel ist eine einfache und effektive Möglichkeit, die Leistung zu verbessern. Es ist jedoch wichtig, die Auswirkungen dieser Änderung sorgfältig abzuwägen, da sie die Anzahl der HTTP-Anfragen erhöhen und sich möglicherweise auf die Ladezeiten auswirken kann."
|
||||
|
||||
msgid "Disable script execution in include dir"
|
||||
msgstr "Skriptausführung im Include-Verzeichnis deaktivieren"
|
||||
|
||||
msgid "Limiting script execution in specific directories can improve security by preventing potentially malicious scripts from running in critical parts of the WordPress system. This is particularly important to prevent attacks such as Cross-Site Scripting (XSS), which inject malicious code into website content."
|
||||
msgstr "Das Begrenzen der Skriptausführung in bestimmten Verzeichnissen kann die Sicherheit verbessern, indem potenziell schädliche Skripte daran gehindert werden, in kritischen Teilen des WordPress-Systems ausgeführt zu werden. Dies ist besonders wichtig, um Angriffe wie Cross-Site Scripting (XSS) zu verhindern, bei denen schädlicher Code in Webseiteninhalte eingeschleust wird."
|
||||
|
||||
msgid "Change site keys"
|
||||
msgstr "Seitenschlüssel erneuern"
|
||||
|
||||
msgid "An error occured connecting api.wordpress.org"
|
||||
msgstr "Beim Kontaktieren von api.wordpress.org trat ein Fehler auf"
|
||||
|
||||
msgid "The site keys were updated successfully."
|
||||
msgstr "Die Seitenschlüssel wurden erneuert."
|
||||
|
||||
msgid "Protect WP detected missing security settings"
|
||||
msgstr "Protect WP hat fehlende Sicherheitseinstellungen festgestellt"
|
||||
|
||||
msgid "Protect WP has detected that advanced security settings are missing.<br />You can update the settings directly in the dashboard."
|
||||
msgstr "Protect WP hat festgestellt, dass erweiterte Sicherheitseinstellungen fehlen.<br />Du kannst die Einstellungen direkt im Dashboard aktualisieren."
|
||||
|
||||
msgid "Protect WP - security settings"
|
||||
msgstr "Protect WP - Sicherheitseinstellungen"
|
||||
|
||||
msgid "Prohibit access from unwanted bots"
|
||||
msgstr "Zugriff von ungewollten Bots verbieten"
|
||||
|
||||
msgid "Excluding specific bots from a WordPress website provides improved security by reducing potentially malicious activity and security risks, optimizes resource consumption and site performance, protects against content theft and duplicate content, enables more precise control of traffic, and promotes more effective SEO -Optimization by reducing irrelevant bots, ultimately leading to a safer, more efficient and better performing website."
|
||||
msgstr "Das Ausschließen bestimmter Bots von einer WordPress-Website bietet eine verbesserte Sicherheit, indem potenziell bösartige Aktivitäten und Sicherheitsrisiken reduziert werden, optimiert den Ressourcenverbrauch und die Website-Performance, schützt vor Inhaltsdiebstahl und Duplicate Content, ermöglicht eine genauere Kontrolle des Datenverkehrs und fördert eine effektivere SEO-Optimierung durch die Reduzierung nicht relevanter Bots, was letztendlich zu einer sichereren, effizienteren und besser performenden Website führt."
|
||||
|
||||
msgid "Bot Detection Database"
|
||||
msgstr "Datenbank zur Bot-Erkennung"
|
||||
|
||||
msgid "Registered bots"
|
||||
msgstr "Vorhandene Bots"
|
||||
|
||||
msgid "Add more bots"
|
||||
msgstr "Weitere Bots hinzufügen"
|
||||
|
||||
msgid "Leave blank in order to delete"
|
||||
msgstr "Zum Löschen leer lassen"
|
||||
|
||||
msgid "Please use line breaks to enter multiple bots"
|
||||
msgstr "Bitte Zeilenumbruch verwenden, um mehrere Bots einzutragen"#
|
||||
|
||||
msgid "Bot Detection Database updated successfully."
|
||||
msgstr "Die Datenbank zur Bot-Erkennung wurde erfolgreich aktualisiert."
|
||||
|
||||
msgid "Disable directory listing"
|
||||
msgstr "Auflistung von Verzeichnissen deaktivieren"
|
||||
|
||||
msgid "Directory listing should be disabled to ensure the security and privacy of a website. When Directory Listing is enabled, this allows users to directly access the contents of directories on a web server without having to specify a specific file. This can expose sensitive information such as directory structures, internal files and scripts, posing a potential security risk. Disabling Directory Listing prevents users from accessing this sensitive information, thereby providing an additional layer of security for the website."
|
||||
msgstr "Das Auflisten von Verzeichnissen sollte deaktiviert werden, um die Sicherheit und Privatsphäre einer Website zu gewährleisten. Wenn Directory Listing aktiviert ist, ermöglicht dies Benutzern den direkten Zugriff auf die Inhalte von Verzeichnissen auf einem Webserver, ohne dass eine spezifische Datei angegeben werden muss. Dies kann sensible Informationen wie Verzeichnisstrukturen, interne Dateien und Skripte offenlegen, was ein potenzielles Sicherheitsrisiko darstellt. Durch das Deaktivieren von Directory Listing wird verhindert, dass Benutzer auf diese sensiblen Informationen zugreifen können, und bietet somit eine zusätzliche Sicherheitsschicht für die Website."
|
||||
|
||||
msgid "Disable debug output"
|
||||
msgstr "Debug-Ausgaben deaktivieren"
|
||||
|
||||
msgid "Debugging should be disabled to protect sensitive information about the internal structure and potential security vulnerabilities of a a WordPress website from potential attackers. When debugging is enabled, error messages and warnings are displayed directly on the website, which can provide attackers with valuable information about the configuration of the website and possible vulnerabilities."
|
||||
msgstr "Debugging sollte deaktiviert werden, um sensible Informationen über die interne Struktur und mögliche Sicherheitslücken einer WordPress-Website vor potenziellen Angreifern zu schützen. Wenn Debuggin aktiviert ist, werden Fehlermeldungen und Warnungen direkt auf der Webseite angezeigt, was Angreifern wertvolle Informationen über die Konfiguration und mögliche Schwachstellen der Website geben kann. "
|
||||
|
||||
msgid "Change Login URL"
|
||||
msgstr "Login-URL ändern"
|
||||
|
||||
msgid "Changing the default login URL of WordPress is advisable to enhance the security of your website. By default, WordPress login URLs is /wp-admin or /wp-login.php, which are easily guessed by hackers and facilitate attacks such as brute-force attacks. Changing the login URL to something unique and difficult to guess increases security since potential attackers will struggle to find the correct URL. This can help protect your website from unauthorized access and other malicious activities."
|
||||
msgstr "Es ist ratsam, die Standard-Login-URL von WordPress zu ändern, um die Sicherheit deiner Website zu erhöhen. Standardmäßig lautet die Login-URL von WordPress /wp-admin oder /wp-login.php, was für Hacker leicht zu erraten ist und Angriffe wie Brute-Force-Attacken erleichtern kann. Durch Ändern der Login-URL auf etwas Einzigartiges und schwer zu erraten, erhöhst du die Sicherheit, da potenzielle Angreifer Schwierigkeiten haben werden, die richtige URL zu finden. Dies kann helfen, deine Website vor unautorisiertem Zugriff und anderen böswilligen Aktivitäten zu schützen."
|
@ -4,18 +4,15 @@ namespace Bdp\Modules\Security;
|
||||
|
||||
use ZipArchive;
|
||||
|
||||
|
||||
|
||||
class Security
|
||||
{
|
||||
public const required_security_plugins = [
|
||||
'wps_hide_login' => ['downloadUrl' => 'https://downloads.wordpress.org/plugin/wps-hide-login.1.9.10.zip'],
|
||||
'limit-login-attempts-reloaded' => ['downloadUrl' => 'https://downloads.wordpress.org/plugin/limit-login-attempts-reloaded.2.25.27.zip']];
|
||||
|
||||
public const required_security_plugins = [];
|
||||
|
||||
public const delete_plugins = [
|
||||
'akismet/akismet.php',
|
||||
'hello.php'
|
||||
'hello.php',
|
||||
'wps_hide_login',
|
||||
'limit-login-attempts-reloaded'
|
||||
];
|
||||
|
||||
public static function setup()
|
||||
@ -27,9 +24,17 @@ class Security
|
||||
}
|
||||
}
|
||||
|
||||
$loginUrl = get_option('whl_page', 'bdp_login');
|
||||
update_option('whl_page', $loginUrl);
|
||||
|
||||
$loginUrl = get_option('whl_page', null) ?? 'bdp-login';
|
||||
enable_option_rewrite_url($loginUrl);
|
||||
enable_option_disable_xmlrpc();
|
||||
enable_option_block_authorscan();
|
||||
enable_option_block_execution_in_uploads();
|
||||
enable_option_prohibit_special_files();
|
||||
enable_option_file_editor();
|
||||
enable_option_disable_conatenation();
|
||||
enable_option_secure_include_dir();
|
||||
enable_option_prohibit_bot_access();
|
||||
enable_option_block_directory_listing();
|
||||
}
|
||||
|
||||
public static function deletePlugins() {
|
||||
@ -37,6 +42,67 @@ class Security
|
||||
delete_plugins(self::delete_plugins);
|
||||
}
|
||||
|
||||
public static function ProhibitBots() {
|
||||
$botList = get_prohibitedbot_list();
|
||||
|
||||
if (!is_bot_access_prohibited() || count($botList) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($botList as $botListEntry) {
|
||||
if (stripos($_SERVER['HTTP_USER_AGENT'], $botListEntry) !== false) {
|
||||
status_header(403);
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function protectAuthorScan()
|
||||
{
|
||||
global $wp;
|
||||
|
||||
if (str_starts_with($wp->request, 'author/') && is_authorscan_blocked()) {
|
||||
status_header(403);
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
public static function SetPageFilters() {
|
||||
global $wp;
|
||||
|
||||
if (str_contains($_SERVER['REQUEST_URI'], 'wp-login.php?action=logout')) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action('template_redirect', [Security::class, 'protectAuthorScan']);
|
||||
Security::protectLoginSecurity();
|
||||
}
|
||||
|
||||
public static function protectLoginSecurity() {
|
||||
$hideLogin = is_login_rewritten();
|
||||
|
||||
if (null === $hideLogin) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( str_contains( $_SERVER['REQUEST_URI'], 'wp-login.php' ) && ! isset( $_POST['redirect_to'] ) && $_POST['redirect_to'] !== 'interner-bereich' ) {
|
||||
wp_redirect( home_url() );
|
||||
die();
|
||||
}
|
||||
|
||||
if ( str_contains( $_SERVER['REQUEST_URI'], $hideLogin ) !== false ) {
|
||||
$user_login = '';
|
||||
$_REQUEST['redirect_to'] = 'interner-bereich';
|
||||
require_once 'wp-login.php';
|
||||
die();
|
||||
}
|
||||
|
||||
if ( str_contains( $_SERVER['REQUEST_URI'], 'interner-bereich' ) !== false ) {
|
||||
wp_redirect( '/wp-admin' );
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
public static function installSecurityPlugin(string $pluginSlug, string $downloadUrl) : bool
|
||||
{
|
||||
|
79
modules/security/includes/settings_reader.php
Normal file
79
modules/security/includes/settings_reader.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
use Bdp\Libs\FileAccess as FileAccess;
|
||||
use Bdp\Libs\WpConfigEditor as WpConfigEditor;
|
||||
|
||||
function is_xmlrpc_disabled() : bool {
|
||||
return FileAccess::htaccessContains(_protect_wp_disablexmlrpc_string());
|
||||
}
|
||||
|
||||
function is_authorscan_blocked() : bool {
|
||||
return get_option('protect_wp_hide_authors', false);
|
||||
}
|
||||
|
||||
function is_execution_in_uploads_blocked() : bool {
|
||||
return FileAccess::htaccessContains(_protect_wp_disable_script_execution_string(), FileAccess::HTACCESS_UPLOADS);
|
||||
}
|
||||
|
||||
function is_access_for_special_files_prohibited() : bool {
|
||||
return FileAccess::htaccessContains(_protect_wp_disable_special_files_string());
|
||||
}
|
||||
|
||||
function is_file_editor_diabled() : bool {
|
||||
$isDisabled = WpConfigEditor::getConfigValue('DISALLOW_FILE_EDIT');
|
||||
if (null == $isDisabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ('false' == $isDisabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function is_conatenation_disabled() : bool {
|
||||
$isDisabled = WpConfigEditor::getConfigValue('CONCATENATE_SCRIPTS');
|
||||
if (null == $isDisabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ('false' == $isDisabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function is_includedir_protected() : bool {
|
||||
return FileAccess::htaccessContains(_protect_wp_secure_include_dir_string());
|
||||
}
|
||||
|
||||
function is_directory_listing_disabled() : bool {
|
||||
return FileAccess::htaccessContains(_protect_wp_disable_directory_listing_string());
|
||||
}
|
||||
|
||||
|
||||
function is_bot_access_prohibited() : bool {
|
||||
return get_option('protect_wp_prohibit_bot_access', false);
|
||||
}
|
||||
|
||||
function get_prohibitedbot_list() {
|
||||
$returnValue = [];
|
||||
|
||||
$botList = get_option('protect_wp_prohibit_bot_list', null);
|
||||
if ($botList !== null) {
|
||||
$returnValue = unserialize(trim($botList));
|
||||
}
|
||||
return $returnValue;
|
||||
}
|
||||
|
||||
function is_wp_debug_diabled() : bool
|
||||
{
|
||||
$wpDebugValue = WpConfigEditor::getConfigValue('WP_DEBUG');
|
||||
return ('false' == $wpDebugValue || null == $wpDebugValue);
|
||||
}
|
||||
|
||||
function is_login_rewritten() : ?string
|
||||
{
|
||||
return get_option('kompass_sec_rewrite_login', null);
|
||||
}
|
160
modules/security/includes/settings_writer.php
Normal file
160
modules/security/includes/settings_writer.php
Normal file
@ -0,0 +1,160 @@
|
||||
<?php
|
||||
use Bdp\Libs\FileAccess as FileAccess;
|
||||
use Bdp\Libs\WpConfigEditor as WpConfigEditor;
|
||||
|
||||
function disable_option_disable_xmlrpc() {
|
||||
return FileAccess::deleteFromHtaccess(_protect_wp_disablexmlrpc_string());
|
||||
}
|
||||
|
||||
function enable_option_disable_xmlrpc() : bool {
|
||||
return FileAccess::insertInHtaccess(_protect_wp_disablexmlrpc_string());
|
||||
}
|
||||
|
||||
function enable_option_block_authorscan() {
|
||||
update_option('protect_wp_hide_authors', true);
|
||||
}
|
||||
|
||||
function disable_option_block_authorscan() {
|
||||
update_option('protect_wp_hide_authors', false);
|
||||
}
|
||||
|
||||
function disable_option_block_execution_in_uploads() {
|
||||
return FileAccess::deleteFromHtaccess(_protect_wp_disable_script_execution_string(), FileAccess::HTACCESS_UPLOADS);
|
||||
}
|
||||
|
||||
function enable_option_block_execution_in_uploads() {
|
||||
return FileAccess::insertInHtaccess(_protect_wp_disable_script_execution_string(), FileAccess::HTACCESS_UPLOADS);
|
||||
}
|
||||
|
||||
function disable_option_prohibit_special_files() {
|
||||
return FileAccess::deleteFromHtaccess(_protect_wp_disable_special_files_string());
|
||||
}
|
||||
|
||||
function enable_option_prohibit_special_files() {
|
||||
return FileAccess::insertInHtaccess(_protect_wp_disable_special_files_string());
|
||||
}
|
||||
function disable_option_file_editor() {
|
||||
return WpConfigEditor::updateConfig('DISALLOW_FILE_EDIT', 'false');
|
||||
|
||||
}
|
||||
function enable_option_file_editor() {
|
||||
return WpConfigEditor::updateConfig('DISALLOW_FILE_EDIT', 'true');
|
||||
}
|
||||
function enable_option_disable_conatenation() {
|
||||
return WpConfigEditor::updateConfig('CONCATENATE_SCRIPTS', 'true');
|
||||
}
|
||||
function disable_option_disable_conatenation() {
|
||||
return WpConfigEditor::updateConfig('CONCATENATE_SCRIPTS', 'false');
|
||||
}
|
||||
|
||||
function disable_option_secure_include_dir() {
|
||||
return FileAccess::deleteFromHtaccess(_protect_wp_secure_include_dir_string());
|
||||
}
|
||||
|
||||
function enable_option_secure_include_dir() : bool {
|
||||
return FileAccess::insertInHtaccess(_protect_wp_secure_include_dir_string());
|
||||
}
|
||||
|
||||
function enable_option_prohibit_bot_access() {
|
||||
update_option('protect_wp_prohibit_bot_access', true);
|
||||
}
|
||||
|
||||
function disable_option_prohibit_bot_access() {
|
||||
update_option('protect_wp_prohibit_bot_access', false);
|
||||
if (count(get_prohibitedbot_list()) == 0) {
|
||||
set_prohibitedbot_list(_protect_wp_initial_bot_list_array());
|
||||
}
|
||||
}
|
||||
|
||||
function set_prohibitedbot_list($botList) {
|
||||
update_option('protect_wp_prohibit_bot_list', serialize($botList));
|
||||
}
|
||||
|
||||
function enable_option_block_directory_listing() : bool {
|
||||
return FileAccess::insertInHtaccess(_protect_wp_disable_directory_listing_string());
|
||||
}
|
||||
|
||||
function disable_option_block_directory_listing() : bool {
|
||||
return FileAccess::deleteFromHtaccess(_protect_wp_disable_directory_listing_string());
|
||||
}
|
||||
|
||||
function enable_option_disable_wp_debug() {
|
||||
WpConfigEditor::updateConfig('WP_DEBUG', 'false');
|
||||
}
|
||||
|
||||
function disable_option_disable_wp_debug() {
|
||||
WpConfigEditor::updateConfig('WP_DEBUG', 'true');
|
||||
}
|
||||
|
||||
function enable_option_rewrite_url(?string $url = null) {
|
||||
global $_POST;
|
||||
$saveUrl = $url ?? $_POST['rewrite_login'];
|
||||
update_option('kompass_sec_rewrite_login', $saveUrl);
|
||||
}
|
||||
|
||||
function disable_option_rewrite_url() {
|
||||
update_option('kompass_sec_rewrite_login', null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function kompass_sec_save_settings($settings) {
|
||||
$allPossibleSettings = [
|
||||
'option_disable_xmlrpc',
|
||||
'option_block_authorscan',
|
||||
'option_block_execution_in_uploads',
|
||||
'option_prohibit_special_files',
|
||||
'option_file_editor',
|
||||
'option_disable_conatenation',
|
||||
'option_secure_include_dir',
|
||||
'option_prohibit_bot_access',
|
||||
'option_block_directory_listing',
|
||||
'option_disable_wp_debug',
|
||||
'option_rewrite_url',
|
||||
];
|
||||
|
||||
$enableSettings = array_intersect($allPossibleSettings, $settings);
|
||||
$disableSettings = array_diff($allPossibleSettings, $settings);
|
||||
|
||||
foreach ($disableSettings as $curSetting) {
|
||||
$function = 'disable_' . $curSetting;
|
||||
$function();
|
||||
}
|
||||
|
||||
foreach ($enableSettings as $curSetting) {
|
||||
$function = 'enable_' . $curSetting;
|
||||
$function();
|
||||
}
|
||||
?>
|
||||
<div class="notice notice-success">
|
||||
<p>
|
||||
<?= __('All settings are saved.', BDP_LV_PLUGIN_SLUG); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function kompass_sec_site_keys() {
|
||||
$content = wp_remote_get('https://api.wordpress.org/secret-key/1.1/salt/');
|
||||
if (!is_array($content) || !isset($content['body'])) {
|
||||
?>
|
||||
<div class="notice notice-error">
|
||||
<p>
|
||||
<?= __('An error occured connecting api.wordpress.org', BDP_LV_PLUGIN_SLUG); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
|
||||
WpConfigEditor::updateSiteKeys($content['body']);
|
||||
?>
|
||||
<div class="notice notice-success">
|
||||
<p>
|
||||
<?= __('The site keys were updated successfully.', BDP_LV_PLUGIN_SLUG); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
22
modules/security/internal/botlist-tab.php
Normal file
22
modules/security/internal/botlist-tab.php
Normal file
@ -0,0 +1,22 @@
|
||||
<h2><?= __('Bot Detection Database', BDP_LV_PLUGIN_SLUG); ?></h2>
|
||||
<div class="pwp_setting_box">
|
||||
<h3><?= __('Registered bots', BDP_LV_PLUGIN_SLUG); ?></h3>
|
||||
<?php
|
||||
foreach (get_prohibitedbot_list() as $currenBot) {
|
||||
?>
|
||||
<p style=" margin: 10px auto; width: 80%;">
|
||||
<input type="text" name="existing_bots[]" value="<?= $currenBot ?>" style="width: 100%;" /><br />
|
||||
<label style="cursor: default; color: #a0a0a0; fot-size: 9pt; font-style: italic"><?= __('Leave blank in order to delete', BDP_LV_PLUGIN_SLUG); ?></label>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="pwp_setting_box">
|
||||
<h3><?= __('Add more bots', BDP_LV_PLUGIN_SLUG); ?></h3>
|
||||
<p style=" margin: 10px auto; width: 80%;">
|
||||
<textarea placeholder="<?= __('Please use line breaks to enter multiple bots', BDP_LV_PLUGIN_SLUG); ?>" name="new_bots[]" style="width: 100%;" rows="10"></textarea>
|
||||
</p>
|
||||
</div>
|
||||
<br /><br />
|
||||
<input type="submit" class="button" value="<?= __('Save changes', BDP_LV_PLUGIN_SLUG); ?>" />
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
echo '<div class="health-check-body health-check-debug-tab hide-if-no-js">';
|
||||
echo '<h1>Erweiterte Sicherheitseinstellungen</h1>';
|
||||
echo '<h2>Erweiterte Sicherheitseinstellungen</h2>';
|
||||
if (isset($_POST['submit'])) {
|
||||
echo '<div id="bdp_success">Die Einstellungen wurden gespeichert.</div>';
|
||||
update_option('whl_page', $_POST['login_url']);
|
||||
@ -9,13 +9,12 @@ if (isset($_POST['submit'])) {
|
||||
|
||||
<form method="post" action="admin.php?page=bdp-kompass%2Fmodules%2Findex.php&loadmodule=security">
|
||||
<div class="bdp_security_outer">
|
||||
<fieldset class="bdp_security_inner">
|
||||
<legend>Wordpress-Login</legend>
|
||||
|
||||
<table>
|
||||
<table>
|
||||
<tr style="vertical-align: top;">
|
||||
<td>Login-URL:</td>
|
||||
<td> <label><?php echo get_site_url(); ?>/</label><input style="width: 100px;" class="long_text" type="text" name="login_url" id="login_url" required
|
||||
<td style="font-weight: bold; padding-right: 10px;"><br />Login-URL:</td>
|
||||
<td style="vertical-align: top;">
|
||||
<label>
|
||||
<?php echo get_site_url(); ?>/</label><input style="width: 100px;" class="long_text" type="text" name="login_url" id="login_url" required
|
||||
value = "<?php echo get_option('whl_page', 'bdp_login'); ?>"
|
||||
>/<br />
|
||||
<label style="font-weight: normal; color: #a0a0a0; font-style: italic">
|
||||
@ -23,9 +22,9 @@ if (isset($_POST['submit'])) {
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<input class="bdp_submit" type="submit" name="submit" value="Einstellungen speichern">
|
||||
</table><br /><br />
|
||||
|
||||
<input class="button" type="submit" name="submit" value="Einstellungen speichern">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
118
modules/security/internal/site-health-tab.php
Normal file
118
modules/security/internal/site-health-tab.php
Normal file
@ -0,0 +1,118 @@
|
||||
<h2><?= __('Extended Security', BDP_LV_PLUGIN_SLUG); ?></h2>
|
||||
|
||||
<div class="bdp_setting_box">
|
||||
<input <?php if (is_xmlrpc_disabled()) {echo ' checked';} ?> type="checkbox" id="sec_mod_1" name="security_settings[]" value="option_disable_xmlrpc" />
|
||||
<label for="sec_mod_1">
|
||||
<?= __('Disable xmlrpc', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<span>
|
||||
<?= __('By introducing the REST API in WordPress, xmlrpc. However, php is no longer needed to communicate outside of WordPress, which is why there is no longer any reason to leave it active or use it. Therefore, for the security of your site, it is better to deactivate or delete it.', BDP_LV_PLUGIN_SLUG); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="bdp_setting_box">
|
||||
<input <?php if (is_authorscan_blocked()) {echo ' checked';} ?> type="checkbox" id="sec_mod_2" name="security_settings[]" value="option_block_authorscan" />
|
||||
<label for="sec_mod_2">
|
||||
<?= __('Disable Authorscan', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<span>
|
||||
<?= __('The author page in WordPress typically displays a list of all posts by a specific author on your website. Unfortunately, Google also records the page and to prevent this, we can deactivate the author page. When a visitor clicks on an name of an author, they are redirected to the author page. This page contains a list of posts written by this author, as well as possibly a brief description of the author and a photo. It is also possible to record which user names have been created.', BDP_LV_PLUGIN_SLUG); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="bdp_setting_box">
|
||||
<input <?php if (is_execution_in_uploads_blocked()) {echo ' checked';} ?> type="checkbox" id="sec_mod_3" name="security_settings[]" value="option_block_execution_in_uploads" />
|
||||
<label for="sec_mod_3">
|
||||
<?= __('Disable scripting in /wp-content/uploads/', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<span>
|
||||
<?= __('Disabling scripting in /wp-content/uploads/ can be a security measure to protect your WordPress website from potential threats. The /wp-content/uploads folder is usually the default folder where WordPress stores uploaded files, such as images, videos, and other media files.', BDP_LV_PLUGIN_SLUG); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="bdp_setting_box">
|
||||
<input <?php if (is_access_for_special_files_prohibited()) {echo ' checked';} ?> type="checkbox" id="sec_mod_4" name="security_settings[]" value="option_prohibit_special_files" />
|
||||
<label for="sec_mod_4">
|
||||
<?= __('Block access to potentially sensitive files', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<span>
|
||||
<?= __('This setting prohibits access to configuration files and log files', BDP_LV_PLUGIN_SLUG); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="bdp_setting_box">
|
||||
<input <?php if (true === is_file_editor_diabled()) {echo ' checked';} ?> type="checkbox" id="sec_mod_5" name="security_settings[]" value="option_file_editor" />
|
||||
<label for="sec_mod_5">
|
||||
<?= __('Disable file editor in WP Dashboard', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<span>
|
||||
<?= __('This is a security feature that allows you to prevent users from editing theme and plugin files directly from the WordPress dashboard. This can be useful for a variety of reasons, including preventing accidental code changes and protecting your website from malicious attacks.', BDP_LV_PLUGIN_SLUG); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="bdp_setting_box">
|
||||
<input <?php if (true === is_conatenation_disabled()) {echo ' checked';} ?> type="checkbox" id="sec_mod_6" name="security_settings[]" value="option_disable_conatenation" />
|
||||
<label for="sec_mod_6">
|
||||
<?= __('Disable script concatenation', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<span>
|
||||
<?= __('Disabling script concatenation in the WordPress admin panel is a simple and effective way to enhance performance. However, it is crucial to carefully consider the impact of this change, as it may increase the number of HTTP requests, potentially affecting loading times', BDP_LV_PLUGIN_SLUG); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="bdp_setting_box">
|
||||
<input <?php if (true === is_includedir_protected()) {echo ' checked';} ?> type="checkbox" id="sec_mod_7" name="security_settings[]" value="option_secure_include_dir" />
|
||||
<label for="sec_mod_7">
|
||||
<?= __('Disable script execution in include dir', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<span>
|
||||
<?= __('Limiting script execution in specific directories can improve security by preventing potentially malicious scripts from running in critical parts of the WordPress system. This is particularly important to prevent attacks such as Cross-Site Scripting (XSS), which inject malicious code into website content.', BDP_LV_PLUGIN_SLUG); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="bdp_setting_box">
|
||||
<input <?php if (true === is_bot_access_prohibited()) {echo ' checked';} ?> type="checkbox" id="sec_mod_8" name="security_settings[]" value="option_prohibit_bot_access" />
|
||||
<label for="sec_mod_8">
|
||||
<?= __('Prohibit access from unwanted bots', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<span>
|
||||
<?= __('Excluding specific bots from a WordPress website provides improved security by reducing potentially malicious activity and security risks, optimizes resource consumption and site performance, protects against content theft and duplicate content, enables more precise control of traffic, and promotes more effective SEO -Optimization by reducing irrelevant bots, ultimately leading to a safer, more efficient and better performing website.', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<a href="site-health.php?tab=bdp_enhanced_security&subpage=botlist"><?= __('Bot Detection Database', BDP_LV_PLUGIN_SLUG); ?></a>
|
||||
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="bdp_setting_box">
|
||||
<input <?php if (true === is_directory_listing_disabled()) {echo ' checked';} ?> type="checkbox" id="sec_mod_9" name="security_settings[]" value="option_block_directory_listing" />
|
||||
<label for="sec_mod_9">
|
||||
<?= __('Disable directory listing', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<span>
|
||||
<?= __('Directory listing should be disabled to ensure the security and privacy of a website. When Directory Listing is enabled, this allows users to directly access the contents of directories on a web server without having to specify a specific file. This can expose sensitive information such as directory structures, internal files and scripts, posing a potential security risk. Disabling Directory Listing prevents users from accessing this sensitive information, thereby providing an additional layer of security for the website.', BDP_LV_PLUGIN_SLUG); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="bdp_setting_box">
|
||||
<input <?php if (true === is_wp_debug_diabled()) {echo ' checked';} ?> type="checkbox" id="sec_mod_10" name="security_settings[]" value="option_disable_wp_debug" />
|
||||
<label for="sec_mod_10">
|
||||
<?= __('Disable debug output', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<span>
|
||||
<?= __('Debugging should be disabled to protect sensitive information about the internal structure and potential security vulnerabilities of a a WordPress website from potential attackers. When debugging is enabled, error messages and warnings are displayed directly on the website, which can provide attackers with valuable information about the configuration of the website and possible vulnerabilities.', BDP_LV_PLUGIN_SLUG); ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="bdp_setting_box">
|
||||
<input <?php if (null !== is_login_rewritten()) {echo ' checked';} ?> type="checkbox" id="sec_mod_11" name="security_settings[]" value="option_rewrite_url" />
|
||||
<label for="sec_mod_11">
|
||||
<?= __('Change Login URL', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<span>
|
||||
<?= __('Changing the default login URL of WordPress is advisable to enhance the security of your website. By default, WordPress login URLs is /wp-admin or /wp-login.php, which are easily guessed by hackers and facilitate attacks such as brute-force attacks. Changing the login URL to something unique and difficult to guess increases security since potential attackers will struggle to find the correct URL. This can help protect your website from unauthorized access and other malicious activities.', BDP_LV_PLUGIN_SLUG); ?><br />
|
||||
<label style="font-weight: bold;">
|
||||
<?= __('Login-URL', BDP_LV_PLUGIN_SLUG) ?>: <?= get_site_url(); ?>/<input style="width: 100px;" class="long_text" type="text" name="rewrite_login" id="rewrite_login" value="<?= is_login_rewritten(); ?>">
|
||||
</label>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<br /><br />
|
||||
<input type="submit" class="button" value="<?= __('Save changes', BDP_LV_PLUGIN_SLUG); ?>" />
|
||||
<a class="button" href="site-health.php?tab=bdp_enhanced_security&action=updatesitekeys"><?= __('Change site keys', BDP_LV_PLUGIN_SLUG); ?></a>
|
@ -1,21 +1,53 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__FILE__) . '/includes/settings_reader.php';
|
||||
require_once dirname(__FILE__) . '/includes/settings_writer.php';
|
||||
|
||||
function wp_example_site_health_navigation_tabs( $tabs ) {
|
||||
// translators: Tab heading for Site Health navigation.
|
||||
$tabs['loginurl'] = esc_html_x( 'Login-URL', 'Site Health', 'text-domain' );
|
||||
$tabs['bdp_enhanced_security'] = esc_html_x('Erweiterte Sicherheit', 'Site Health', 'text-domain');
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
add_filter( 'site_health_navigation_tabs', 'wp_example_site_health_navigation_tabs' );
|
||||
|
||||
|
||||
function wp_example_site_health_tab_content($tab)
|
||||
{
|
||||
// Do nothing if this is not our tab.
|
||||
if ('loginurl' === $tab) {
|
||||
require_once dirname(__FILE__) . '/internal/index.php';
|
||||
return;
|
||||
}
|
||||
if ('bdp_enhanced_security' === $tab) {
|
||||
if (isset($_GET['subpage']) && $_GET['subpage'] == 'botlist') {
|
||||
if (isset($_POST['save_settings']) && isset($_POST['existing_bots']) && isset($_POST['new_bots'])) {
|
||||
protect_wp_save_bots($_POST['existing_bots'], $_POST['new_bots']);
|
||||
}
|
||||
|
||||
echo '<div class="health-check-body health-check-status-tab hide-if-no-js">';
|
||||
echo '<form method="post" action="site-health.php?tab=' . BDP_LV_PLUGIN_SLUG . '&subpage=botlist">';
|
||||
echo '<input type="hidden" name="save_settings" value="true" />';
|
||||
require BDP_LV_PLUGIN_DIR . 'modules/security/internal/botlist-tab.php';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
update_option('protect_wp_needs_attention', false);
|
||||
if (isset($_POST['save_settings'])) {
|
||||
$securitySettings = [];
|
||||
if (isset($_POST['security_settings'])) {
|
||||
$securitySettings = $_POST['security_settings'];
|
||||
}
|
||||
kompass_sec_save_settings($securitySettings);
|
||||
}
|
||||
if (isset($_GET['action']) && $_GET['action'] == 'updatesitekeys') {
|
||||
kompass_sec_site_keys();
|
||||
}
|
||||
|
||||
echo '<div class="health-check-body health-check-status-tab hide-if-no-js">';
|
||||
echo '<form method="post" action="site-health.php?tab=bdp_enhanced_security">';
|
||||
echo '<input type="hidden" name="save_settings" value="true" />';
|
||||
require BDP_LV_PLUGIN_DIR . 'modules/security/internal/site-health-tab.php';
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
add_action('site_health_tab_content', 'wp_example_site_health_tab_content');
|
||||
|
Loading…
Reference in New Issue
Block a user