Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r298b5600c99cf71c588d5ae57c48a1c66500e3b5 -r781bea2da1fdfb017f99d0a389de8a4d83704cf3 --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 298b5600c99cf71c588d5ae57c48a1c66500e3b5) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 781bea2da1fdfb017f99d0a389de8a4d83704cf3) @@ -231,6 +231,7 @@ config.header.features =Features config.header.look.feel =Look and feel config.header.versions =Versions +congfig.header.antivirus =Antivirus config.server.url =Server URL config.server.url.context.path =Server URL context path config.version =Version @@ -633,6 +634,8 @@ outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none sysadmin.maintain.session.name =Name +config.av.enable =Enable antivirus scanning on file upload +config.av.host =ClamAV server host +config.av.port =ClamAV server port - #======= End labels: Exported 627 labels for en AU ===== Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20190119.sql =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20190119.sql (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20190119.sql (revision 781bea2da1fdfb017f99d0a389de8a4d83704cf3) @@ -0,0 +1,17 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +----------------------Put all sql statements below here------------------------- + +-- LDEV-4755 Add configuratio settings for ClamAV antivirus +INSERT INTO lams_configuration VALUES +('AntivirusEnable', 'false', 'config.av.enable', 'congfig.header.antivirus', 'BOOLEAN', 1), +('AntivirusHost', 'localhost', 'config.av.host', 'congfig.header.antivirus', 'STRING', 0), +('AntivirusPort', '3310', 'config.av.port', 'congfig.header.antivirus', 'LONG', 0); + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java =================================================================== diff -u -r139e91caa1fc95af99802e31cb3a4b57ef7ebc5e -r781bea2da1fdfb017f99d0a389de8a4d83704cf3 --- lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java (.../ConfigurationKeys.java) (revision 139e91caa1fc95af99802e31cb3a4b57ef7ebc5e) +++ lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java (.../ConfigurationKeys.java) (revision 781bea2da1fdfb017f99d0a389de8a4d83704cf3) @@ -285,5 +285,11 @@ // LDEV-4594 / LDEV-4583 Allow/Block access to index.do for integration learners. Default to false - do not allow direct access. public static String ALLOW_DIRECT_ACCESS_FOR_INTEGRATION_LEARNERS = "AllowDirectAccessIntgrtnLrnr"; + + // LDEV-4755 Antivirus + public static String ANTIVIRUS_ENABLE = "AntivirusEnable"; + public static String ANTIVIRUS_HOST = "AntivirusHost"; + public static String ANTIVIRUS_PORT = "AntivirusPort"; + } Index: lams_common/src/java/org/lamsfoundation/lams/util/FileUtil.java =================================================================== diff -u -r783f965b1bb2251474d01f32a53e4ccb28d5473b -r781bea2da1fdfb017f99d0a389de8a4d83704cf3 --- lams_common/src/java/org/lamsfoundation/lams/util/FileUtil.java (.../FileUtil.java) (revision 783f965b1bb2251474d01f32a53e4ccb28d5473b) +++ lams_common/src/java/org/lamsfoundation/lams/util/FileUtil.java (.../FileUtil.java) (revision 781bea2da1fdfb017f99d0a389de8a4d83704cf3) @@ -859,9 +859,14 @@ * Checks the given input stream for viruses. Uses ClamAV client. */ public static boolean isVirusFree(InputStream inputStream) throws IOException { + boolean scanEnabled = Configuration.getAsBoolean(ConfigurationKeys.ANTIVIRUS_ENABLE); + if (!scanEnabled) { + return true; + } + // get URL when ClamAV server listens - String host = "localhost"; - int port = 3310; + String host = Configuration.get(ConfigurationKeys.ANTIVIRUS_HOST); + int port = Configuration.getAsInt(ConfigurationKeys.ANTIVIRUS_PORT); try { // set up th client ClamavClient client = new ClamavClient(host, port);