Skip to content

Commit

Permalink
Merge pull request #1175 from it-novum/development
Browse files Browse the repository at this point in the history
openITCOCKPIT 4.2
  • Loading branch information
nook24 authored May 19, 2021
2 parents ecef7fc + 7c23b1f commit c00ffd4
Show file tree
Hide file tree
Showing 288 changed files with 70,703 additions and 20,778 deletions.
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/---bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: "\U0001F41B Bug report"
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem. You can upload screenshots via drag and drop

**Versions**
* openITCOKPIT Server Version: 4.x.x
* Operating system

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/---feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: "\U0001F680 Feature request"
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
blank_issues_enabled: true
contact_links:
- name: 🕵️‍♀️ openITCOCKPIT Monitoring Agent
url: https://github.com/it-novum/openitcockpit-agent-go/
about: Please post all issues related to the openITCOCKPIT Monitoring Agent into the corresponding repository.
- name: 💬 Discord
url: https://discord.gg/G8KhxKuQ9G
about: Join the openITCOCKPIT Community Discord
- name: Reddit
url: https://www.reddit.com/r/openitcockpit/
about: Join the openITCOCKPIT subreddit
- name: Report a security vulnerability
url: https://openitcockpit.io/security/
about: Please review our security policy for more details
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ config/openitcGrafanaTag.php
config/datasource.php
config/dbbackend.php
config/perfdatabackend.php
config/gearman.php
webroot/img/logo_custom.png
webroot/img/logo_small_custom.png
webroot/img/logos/logo_custom.png
Expand All @@ -88,6 +89,9 @@ plugins/MasterSelfMonitoringModule
plugins/MkModule
plugins/NWCModule
plugins/ImportModule
plugins/HANAModule
plugins/HelloworldModule
plugins/IntialavatarModule
plugins/CheckmkModule
plugins/OpenstreetmapModule
plugins/SAPModule
Expand Down
23 changes: 17 additions & 6 deletions UPDATE.sh
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@ mysql "--defaults-extra-file=$INIFILE" -e "UPDATE containers SET containertype_i
#Check and create missing cronjobs
#oitc api --model Cronjob --action create_missing_cronjobs --data ""

echo "Cleanup agentconnector table"
#https://github.com/it-novum/openITCOCKPIT/issues/1078
mysql "--defaults-extra-file=$INIFILE" -e "DELETE FROM agentconnector WHERE checksum IS NULL AND ca_checksum IS NULL AND generation_date IS NULL"
mysql "--defaults-extra-file=$INIFILE" -e "DELETE agenthostscache FROM agenthostscache LEFT JOIN hosts ON agenthostscache.hostuuid = hosts.uuid WHERE hosts.uuid IS NULL"

#Compress and minify javascript files
oitc compress

Expand All @@ -242,6 +237,13 @@ echo "Check for browser push notification commands"
#oitc docu_generator
#oitc systemsettings_import

#Migrate openITCOCKPIT Monitoring Agent 1.x database records for 3.x
echo "Migrate openITCOCKPIT Monitoring Agent configuration for Agent version 3.x. This will take a while..."
oitc agent --migrate

echo "Checking that a server certificate for the openITCOCKPIT Monitoring Agent exists"
oitc agent --generate-server-ca

NORESTART=false
NOSYSTEMFILES=false
for i in "$@"; do
Expand Down Expand Up @@ -291,7 +293,6 @@ if [[ "$NOSYSTEMFILES" == "false" ]]; then
echo "Copy required system files"
cp -r ${APPDIR}/system/etc/. /etc/
cp -r ${APPDIR}/system/lib/. /lib/
cp -r ${APPDIR}/system/fpm/. /etc/php/${PHPVersion}/fpm/
cp -r ${APPDIR}/system/usr/. /usr/
cp ${APPDIR}/system/nginx/ssl_options_$OSVERSION /etc/nginx/openitc/ssl_options.conf
# only ensure that the files exist
Expand Down Expand Up @@ -438,6 +439,16 @@ else
fi
fi

echo "Cleanup old Docker images"
if systemctl is-active --quiet docker.service; then
docker image prune --force
echo "Docker cleanup complete"
else
echo "Docker is NOT Running";
echo "Please start Docker and run the following command manually"
echo "docker image prune -a --force"
fi

for Module in "${LOADED_MODULE_SCRIPTS[@]}"; do
if [ "$Module" != "system" ]; then
if type "${Module}" &> /dev/null; then
Expand Down
33 changes: 33 additions & 0 deletions auth/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* and Nginx will block the access to Grafana.
*/

use App\Identifier\ApikeyIdentifier;
use Authentication\Identifier\IdentifierCollection;
use Authentication\Identifier\IdentifierInterface;
use Authentication\PasswordHasher\DefaultPasswordHasher;
Expand Down Expand Up @@ -68,6 +69,9 @@

fwrite($file, var_export('$_SESSION:' . PHP_EOL, true));
fwrite($file, var_export($_SESSION, true));

//fwrite($file, var_export('HTTP Headers:' . PHP_EOL, true));
//fwrite($file, var_export(getallheaders(), true));
}

try {
Expand Down Expand Up @@ -121,6 +125,35 @@

throw new UnauthorizedException();
}

if (isset($_COOKIE['Authorization'])) {
// This is used if openITCOCKPIT is embedded into an iframe via /iframe-oitc/
$apiKeyArray = explode('X-OITC-API ', $_COOKIE['Authorization']);

if (sizeof($apiKeyArray) === 2) {
$apikey = $apiKeyArray[1];
$IdentifierCollection = new IdentifierCollection([
'Authentication.Apikey' => [
'className' => ApikeyIdentifier::class
]
]);

$identity = $IdentifierCollection->identify(['apikey' => $apikey]);

if (!empty($identity)) {
//Login success
if ($debug) {
fwrite($file, 'Login Ok !!');
}
header("HTTP/1.0 200 Ok");
return;
}

throw new UnauthorizedException();
}


}
} catch (\Exception $e) {

}
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
"guzzlehttp/guzzle": "^6.5",
"jbbcode/jbbcode": "^1.4",
"jdorn/sql-formatter": "^1.2",
"lasserafn/php-initial-avatar-generator": "^4.2",
"league/oauth2-client": "^2.5",
"matthiasmullie/minify": "^1.3",
"mobiledetect/mobiledetectlib": "2.*",
"smottt/wideimage": "^1.1",
"spatie/emoji": "^2.1",
"symfony/filesystem": "^3.2",
"symfony/finder": "^3.2",
Expand Down Expand Up @@ -120,7 +120,6 @@
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-create-project-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump",
"check": [
"@test",
"@cs-check"
Expand Down
9 changes: 9 additions & 0 deletions config/Migrations/20200211151417_Agentconnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@

use Migrations\AbstractMigration;

/**
* Class Agentconnector
*
* Created:
* oitc migrations create Agentconnector
*
* Usage:
* openitcockpit-update
*/
class Agentconnector extends AbstractMigration {

public function up() {
Expand Down
9 changes: 9 additions & 0 deletions config/Migrations/20200515090906_UpdateAgentshostscache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@

use Migrations\AbstractMigration;

/**
* Class UpdateAgentshostscache
*
* Created:
* oitc migrations create UpdateAgentshostscache
*
* Usage:
* openitcockpit-update
*/
class UpdateAgentshostscache extends AbstractMigration {

public function up() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@

use Migrations\AbstractMigration;

/**
* Class AddModuleToConfigurationQueue
*
* Created:
* oitc migrations create AddModuleToConfigurationQueue
*
* Usage:
* openitcockpit-update
*/
class AddModuleToConfigurationQueue extends AbstractMigration {

public function up() {
Expand Down
94 changes: 94 additions & 0 deletions config/Migrations/20200908122726_MysqlWizardMigration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php
declare(strict_types=1);

use Migrations\AbstractMigration;

/**
* Class MysqlWizardMigration
*
* Created via:
* oitc migrations create MysqlWizardMigration
*
* Run migration:
* oitc migrations migrate
*
*/
class MysqlWizardMigration extends AbstractMigration {

/**
* Whether the tables created in this migration
* should auto-create an `id` field or not
*
* This option is global for all tables created in the migration file.
* If you set it to false, you have to manually add the primary keys for your
* tables using the Migrations\Table::addPrimaryKey() method
*
* @var bool
*/
public $autoId = false;

/**
* Change Method.
*
* More information on this method is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
* @return void
*/
public function change() {
$this->table('wizard_assignments')
->addColumn('id', 'integer', [
'autoIncrement' => true,
'default' => null,
'limit' => 11,
'null' => false,
])
->addPrimaryKey(['id'])
->addColumn('uuid', 'string', [
'default' => null,
'limit' => 37,
'null' => false,
])
->addColumn('type_id', 'string', [
'default' => null,
'limit' => 37,
'null' => false,
])
->addIndex(
[
'uuid',
],
['unique' => true]
)
->create();

$this->table('servicetemplates_to_wizard_assignments')
->addColumn('id', 'integer', [
'autoIncrement' => true,
'default' => null,
'limit' => 11,
'null' => false,
])
->addPrimaryKey(['id'])
->addColumn('servicetemplate_id', 'integer', [
'default' => null,
'limit' => 11,
'null' => false,
])
->addColumn('wizard_assignment_id', 'integer', [
'default' => null,
'limit' => 11,
'null' => false,
])
->addIndex(
[
'wizard_assignment_id',
]
)
->addIndex(
[
'servicetemplate_id',
]
)
->create();
}
}
Loading

0 comments on commit c00ffd4

Please sign in to comment.