diff options
| author | Thomas Hackl <hackl@data-quest.de> | 2022-11-24 13:25:18 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2022-11-24 13:25:18 +0000 |
| commit | 8a2b68530756d01c50441e1039f3f938cd85b419 (patch) | |
| tree | 1cb36df0ab53001fbb54b5dcc4bcb4fd75a51aa7 /db | |
| parent | 7dddea8ccca601bf2da28960f2e27a223fe60ea6 (diff) | |
Resolve "Virencheck beim Dateiupload"
Closes #1658
Merge request studip/studip!1083
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrations/5.3.10_viruscheck_for_uploads.php | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/db/migrations/5.3.10_viruscheck_for_uploads.php b/db/migrations/5.3.10_viruscheck_for_uploads.php new file mode 100644 index 0000000..8abc6bb --- /dev/null +++ b/db/migrations/5.3.10_viruscheck_for_uploads.php @@ -0,0 +1,73 @@ +<?php + +class ViruscheckForUploads extends Migration +{ + public function description() + { + return 'Provide config options for ClamAV usage on file uploads'; + } + + public function up() + { + $query = "INSERT IGNORE INTO `config` (`field`, `value`, `type`, `range`, `section`, `mkdate`, `chdate`, + `description`) + VALUES (:name, :value, :type, :range, :section, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)"; + + $statement = DBManager::get()->prepare($query); + $statement->execute([ + 'name' => 'VIRUSSCAN_ON_UPLOAD', + 'description' => 'Sollen Dateien beim Upload mit ClamAV auf Viren überprüft werden?', + 'type' => 'boolean', + 'range' => 'global', + 'section' => 'files', + 'value' => '0' + ]); + $statement->execute([ + 'name' => 'VIRUSSCAN_SOCKET', + 'description' => 'Pfad zum Unix Socket (wird statt TCP verwendet, falls etwas eingetragen ist)', + 'type' => 'string', + 'range' => 'global', + 'section' => 'files', + 'value' => '/var/run/clamav/clamd.ctl' + ]); + $statement->execute([ + 'name' => 'VIRUSSCAN_HOST', + 'description' => 'Host des Virenscanners (wird nur verwendet, falls kein Socket eingetragen ist)', + 'type' => 'string', + 'range' => 'global', + 'section' => 'files', + 'value' => '127.0.0.1' + ]); + $statement->execute([ + 'name' => 'VIRUSSCAN_PORT', + 'description' => 'Port des Virenscanners (wird nur verwendet, falls kein Socket eingetragen ist)', + 'type' => 'integer', + 'range' => 'global', + 'section' => 'files', + 'value' => 3310 + ]); + $statement->execute([ + 'name' => 'VIRUSSCAN_MAX_STREAMLENGTH', + 'description' => 'Maximale Streamlänge in Bytes, die beim Virenscanner erlaubt ist', + 'type' => 'integer', + 'range' => 'global', + 'section' => 'files', + 'value' => 26214400 + ]); + } + + public function down() + { + $query = "DELETE `config`, `config_values` + FROM `config` + LEFT JOIN `config_values` USING (`field`) + WHERE `field` IN ( + 'VIRUSSCAN_ON_UPLOAD', + 'VIRUSSCAN_SOCKET', + 'VIRUSSCAN_HOST', + 'VIRUSSCAN_PORT', + 'VIRUSSCAN_MAX_STREAMLENGTH' + )"; + DBManager::get()->exec($query); + } +} |
