summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-clamav/htdocs/luci-static/resources/view
diff options
context:
space:
mode:
authorPaul Donald <newtwen+github@gmail.com>2024-10-08 18:48:49 +0200
committerPaul Donald <newtwen+github@gmail.com>2024-10-09 00:40:21 +0200
commit780a84e8bead3cbbdda09c479ab793081ecf9903 (patch)
tree113630761cb74c4f3b9cb3172293273bb774ce1d /applications/luci-app-clamav/htdocs/luci-static/resources/view
parentd35b658d8a7d7a8f0872e46c5182b05de4500495 (diff)
luci-app-clamav: Convert to JS
Added functionality for clamav-milter and freshclam which are also in the package. Assumptions: clamd.log will always be in /tmp, so read permissions are granted for /tmp/*, in case the log file gets moved or renamed. Don't expose the LogFile* parameters to avoid logfile related location problems. Added entries to use syslogging for each component, and added a Log tab. Tested on 23.05.5 Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Diffstat (limited to 'applications/luci-app-clamav/htdocs/luci-static/resources/view')
-rw-r--r--applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/clamav-log.js4
-rw-r--r--applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/clamav-milter.js215
-rw-r--r--applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/clamav.js338
-rw-r--r--applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/freshclam.js199
4 files changed, 756 insertions, 0 deletions
diff --git a/applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/clamav-log.js b/applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/clamav-log.js
new file mode 100644
index 0000000000..409a8de36f
--- /dev/null
+++ b/applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/clamav-log.js
@@ -0,0 +1,4 @@
+'use strict';
+'require tools.views as views';
+
+return views.LogreadBox("clamav", "clamav");
diff --git a/applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/clamav-milter.js b/applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/clamav-milter.js
new file mode 100644
index 0000000000..cb38588b16
--- /dev/null
+++ b/applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/clamav-milter.js
@@ -0,0 +1,215 @@
+'use strict';
+'require form';
+'require fs';
+'require uci';
+'require view';
+
+return view.extend({
+ load: function() {
+
+ },
+
+ render: function() {
+ var m, s, o;
+
+ m = new form.Map('clamav-milter', _('ClamAV Milter'), _('Configuration'));
+
+ // Section
+ s = m.section(form.TypedSection, 'clamav-milter', _('Settings'));
+ s.anonymous = true;
+ s.addremove = false;
+
+ // Advanced Tab
+ s.tab('tab_advanced', _('Settings'));
+
+ // clamav_milter_config_file
+ o = s.taboption('tab_advanced', form.Value, 'clamav_milter_config_file', _('clamav-milter config file'));
+ o.datatype = 'string';
+ o.value('/etc/clamav/clamav-milter.conf');
+ o.placeholder = '/etc/clamav/clamav-milter.conf';
+
+ // Foreground
+ o = s.taboption('tab_advanced', form.ListValue, 'Foreground', _('Run in foreground'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+ o.placeholder = 'false';
+
+ // PidFile
+ o = s.taboption('tab_advanced', form.Value, 'PidFile', _('PID file'));
+ o.datatype = 'string';
+ o.value('/var/run/clamav/clamav-milter.pid');
+ o.placeholder = '/var/run/clamav/clamav-milter.pid';
+
+ // User
+ o = s.taboption('tab_advanced', form.Value, 'User', _('User'));
+ o.datatype = 'string';
+ o.value('nobody');
+ o.placeholder = 'nobody';
+
+ // MilterSocketGroup
+ o = s.taboption('tab_advanced', form.Value, 'MilterSocketGroup', _('Milter socket group'));
+ o.datatype = 'string';
+ o.value('nogroup');
+ o.placeholder = 'nogroup';
+
+ // ReadTimeout
+ o = s.taboption('tab_advanced', form.Value, 'ReadTimeout', _('Read timeout'));
+ o.value('120');
+
+ // OnClean
+ o = s.taboption('tab_advanced', form.ListValue, 'OnClean', _('On-clean action'));
+ o.value('Accept', _('Accept'));
+ o.value('Reject', _('Reject'));
+ o.value('Defer', _('Defer'));
+ o.value('Blackhole', _('Blackhole'));
+ o.value('Quarantine', _('Quarantine'));
+
+ // OnInfected
+ o = s.taboption('tab_advanced', form.ListValue, 'OnInfected', _('On-infected action'));
+ o.value('Accept', _('Accept'));
+ o.value('Reject', _('Reject'));
+ o.value('Defer', _('Defer'));
+ o.value('Blackhole', _('Blackhole'));
+ o.value('Quarantine', _('Quarantine'));
+
+ // OnFail
+ o = s.taboption('tab_advanced', form.ListValue, 'OnFail', _('On-fail action'));
+ o.value('Accept', _('Accept'));
+ o.value('Reject', _('Reject'));
+ o.value('Defer', _('Defer'));
+
+ // AddHeader
+ o = s.taboption('tab_advanced', form.ListValue, 'AddHeader', _('Add header'));
+ o.value('Replace', _('Replace'));
+ o.value('Yes', _('Yes'));
+
+ /*
+ // LogFile
+ o = s.taboption('tab_advanced', form.Value, 'LogFile', _('Logfile'));
+ o.value('/tmp/clamav-milter.log');
+ o.placeholder = '/tmp/clamav-milter.log';
+
+ // LogFileUnlock
+ o = s.taboption('tab_advanced', form.ListValue, 'LogFileUnlock', _('Unlock logfile'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+
+ // LogFileMaxSize
+ o = s.taboption('tab_advanced', form.Value, 'LogFileMaxSize', _('Max size of log file'));
+ o.value('512K', _('512K'));
+ o.value('1M', _('1M'));
+ o.value('2M', _('2M'));
+ */
+
+ // LogTime
+ o = s.taboption('tab_advanced', form.ListValue, 'LogTime', _('Log time with each message'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+
+ // LogVerbose
+ o = s.taboption('tab_advanced', form.ListValue, 'LogVerbose', _('Enable verbose logging'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+
+ // Debug
+ o = s.taboption('tab_advanced', form.ListValue, 'Debug', _('Debug logging'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+ o.placeholder = 'true';
+
+ // LogSyslog
+ o = s.taboption('tab_advanced', form.ListValue, 'LogSyslog', _('Log to syslog'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+ o.placeholder = 'true';
+
+ // LogFacility
+ o = s.taboption('tab_advanced', form.ListValue, 'LogFacility', _('Syslog facility'));
+ o.value('LOG_KERN');
+ o.value('LOG_USER');
+ o.value('LOG_MAIL');
+ o.value('LOG_DAEMON');
+ o.value('LOG_AUTH');
+ o.value('LOG_LPR');
+ o.value('LOG_NEWS');
+ o.value('LOG_UUCP');
+ o.value('LOG_CRON');
+ o.value('LOG_LOCAL0');
+ o.value('LOG_LOCAL1');
+ o.value('LOG_LOCAL2');
+ o.value('LOG_LOCAL3');
+ o.value('LOG_LOCAL4');
+ o.value('LOG_LOCAL5');
+ o.value('LOG_LOCAL6');
+ o.value('LOG_LOCAL7');
+ // cannot do o.depends - it removes the option if dep condition is not met, thereby causing a startup error
+ // o.depends('LogSyslog', 'true');
+
+ // LogInfected
+ o = s.taboption('tab_advanced', form.ListValue, 'LogInfected', _('Log infections'));
+ o.value('Off', _('Off'));
+ o.value('Basic', _('Basic'));
+ o.value('Full', _('Full'));
+
+ // LogClean
+ o = s.taboption('tab_advanced', form.ListValue, 'LogClean', _('Log clean'));
+ o.value('Off', _('Off'));
+ o.value('Basic', _('Basic'));
+ o.value('Full', _('Full'));
+
+ // MaxFileSize
+ o = s.taboption('tab_advanced', form.Value, 'MaxFileSize', _('Max size of scanned file'));
+ o.datatype = 'string';
+ o.value('512K', _('512K'));
+ o.value('1M', _('1M'));
+ o.value('2M', _('2M'));
+ o.value('25M', _('25M'));
+ o.value('50M', _('50M'));
+ o.placeholder = '25M';
+
+ // SupportMultipleRecipients
+ o = s.taboption('tab_advanced', form.ListValue, 'SupportMultipleRecipients', _('Support multiple recipients'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+
+ // RejectMsg
+ o = s.taboption('tab_advanced', form.TextValue, 'RejectMsg', _('Rejection log message'));
+ o.wrap = 'off';
+ o.rows = 3;
+ o.monospace = true;
+ o.editable = true;
+ o.placeholder = _('Rejecting Harmful Email: %v found.')
+
+ // TemporaryDirectory
+ o = s.taboption('tab_advanced', form.Value, 'TemporaryDirectory', _('Temporary directory'));
+ o.datatype = 'string';
+ o.value('/tmp');
+ o.placeholder = '/tmp';
+
+ // MilterSocket
+ o = s.taboption('tab_advanced', form.Value, 'MilterSocket', _('Local socket'));
+ o.datatype = 'string';
+ o.value('unix:/var/run/clamav/clamav-milter.sock');
+ o.placeholder = 'unix:/var/run/clamav/clamav-milter.sock';
+
+ // MilterSocketMode
+ o = s.taboption('tab_advanced', form.Value, 'MilterSocketMode', _('Local socket'));
+ o.datatype = 'string';
+ o.value('666');
+ o.placeholder = '666';
+
+ // ClamdSocket
+ o = s.taboption('tab_advanced', form.Value, 'ClamdSocket', _('clamd socket'));
+ o.datatype = 'string';
+ o.value('tcp:127.0.0.1:3310');
+ o.placeholder = 'tcp:127.0.0.1:3310';
+
+ // FixStaleSocket
+ o = s.taboption('tab_advanced', form.ListValue, 'FixStaleSocket', _('Fix stale socket'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+
+ return m.render();
+ },
+
+});
diff --git a/applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/clamav.js b/applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/clamav.js
new file mode 100644
index 0000000000..c51cbf4a2f
--- /dev/null
+++ b/applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/clamav.js
@@ -0,0 +1,338 @@
+'use strict';
+'require form';
+'require fs';
+// 'require rpc';
+'require uci';
+'require view';
+
+return view.extend({
+ load: function() {
+
+ },
+
+ render: function() {
+ var m, s, o;
+
+ m = new form.Map('clamav', _('ClamAV'), _('Configuration'));
+
+ // Section
+ s = m.section(form.TypedSection, 'clamav', _('Settings'));
+ s.anonymous = true;
+ s.addremove = false;
+
+ // Advanced Tab
+ s.tab('tab_advanced', _('Settings'));
+ // s.tab('tab_logs', _('Log'));
+
+ // clamd_config_file
+ o = s.taboption('tab_advanced', form.Value, 'clamd_config_file', _('clamd config file'));
+ o.datatype = 'string';
+ o.value('/etc/clamav/clamd.conf');
+ o.placeholder = '/etc/clamav/clamd.conf';
+
+ /*
+ // LogFile
+ o = s.taboption('tab_advanced', form.Value, 'LogFile', _('Logfile'));
+ o.value('/tmp/clamav.log');
+ o.placeholder = '/tmp/clamav.log';
+
+ // LogFileMaxSize
+ o = s.taboption('tab_advanced', form.Value, 'LogFileMaxSize', _('Max size of log file'));
+ o.value('512K', _('512K'));
+ o.value('1M', _('1M'));
+ o.value('2M', _('2M'));
+ o.placeholder = '1M';
+
+ // LogRotate
+ o = s.taboption('tab_advanced', form.ListValue, 'LogRotate', _('Add header'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+ */
+
+ // LogTime
+ o = s.taboption('tab_advanced', form.ListValue, 'LogTime', _('Log time with each message'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'no';
+
+ // LogVerbose
+ o = s.taboption('tab_advanced', form.ListValue, 'LogVerbose', _('Enable verbose logging'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'no';
+
+ // Debug
+ o = s.taboption('tab_advanced', form.ListValue, 'Debug', _('Debug logging'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+ o.placeholder = 'true';
+
+ // LogSyslog
+ o = s.taboption('tab_advanced', form.ListValue, 'LogSyslog', _('Log to syslog'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+ o.placeholder = 'true';
+
+ // LogFacility
+ o = s.taboption('tab_advanced', form.ListValue, 'LogFacility', _('Syslog facility'));
+ o.value('LOG_KERN');
+ o.value('LOG_USER');
+ o.value('LOG_MAIL');
+ o.value('LOG_DAEMON');
+ o.value('LOG_AUTH');
+ o.value('LOG_LPR');
+ o.value('LOG_NEWS');
+ o.value('LOG_UUCP');
+ o.value('LOG_CRON');
+ o.value('LOG_LOCAL0');
+ o.value('LOG_LOCAL1');
+ o.value('LOG_LOCAL2');
+ o.value('LOG_LOCAL3');
+ o.value('LOG_LOCAL4');
+ o.value('LOG_LOCAL5');
+ o.value('LOG_LOCAL6');
+ o.value('LOG_LOCAL7');
+ // cannot do o.depends - it removes the option if dep condition is not met, thereby causing a startup error
+ // o.depends('LogSyslog', 'true');
+
+ // ExtendedDetectionInfo
+ o = s.taboption('tab_advanced', form.ListValue, 'ExtendedDetectionInfo', _('Log additional infection info'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'no';
+
+ // OfficialDatabaseOnly
+ o = s.taboption('tab_advanced', form.ListValue, 'OfficialDatabaseOnly', _('Use official database only'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'no';
+
+ // MaxDirectoryRecursion
+ o = s.taboption('tab_advanced', form.Value, 'MaxDirectoryRecursion', _('Max directory scan depth'));
+ o.value('15');
+ o.value('20');
+ o.placeholder = '15';
+
+ // FollowDirectorySymlinks
+ o = s.taboption('tab_advanced', form.ListValue, 'FollowDirectorySymlinks', _('Follow directory symlinks'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'no';
+
+ // FollowFileSymlinks
+ o = s.taboption('tab_advanced', form.ListValue, 'FollowFileSymlinks', _('Follow file symlinks'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'no';
+
+ // DetectPUA
+ o = s.taboption('tab_advanced', form.ListValue, 'DetectPUA', _('Detect possibly unwanted apps'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'no';
+
+ // ScanPE
+ o = s.taboption('tab_advanced', form.ListValue, 'ScanPE', _('Scan portable executables'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'yes';
+
+ // ScanELF
+ o = s.taboption('tab_advanced', form.ListValue, 'ScanELF', _('Scan ELF files'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'yes';
+
+ // DetectBrokenExecutables
+ o = s.taboption('tab_advanced', form.ListValue, 'DetectBrokenExecutables', _('Detect broken executables'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'no';
+
+ // AlertBrokenExecutables
+ o = s.taboption('tab_advanced', form.ListValue, 'AlertBrokenExecutables', _('Alert on broken executables'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'no';
+
+ // ScanOLE2
+ o = s.taboption('tab_advanced', form.ListValue, 'ScanOLE2', _('Scan MS Office and .msi files'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'yes';
+
+ // ScanPDF
+ o = s.taboption('tab_advanced', form.ListValue, 'ScanPDF', _('Scan pdf files'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'yes';
+
+ // ScanSWF
+ o = s.taboption('tab_advanced', form.ListValue, 'ScanSWF', _('Scan swf files'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'yes';
+
+ // ScanMail
+ o = s.taboption('tab_advanced', form.ListValue, 'ScanMail', _('Scan emails'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'yes';
+
+ // ScanPartialMessages
+ o = s.taboption('tab_advanced', form.ListValue, 'ScanPartialMessages', _('Scan RFC1341 messages split over many emails'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'no';
+
+ // ScanArchive
+ o = s.taboption('tab_advanced', form.ListValue, 'ScanArchive', _('Scan archives'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'yes';
+
+ // ArchiveBlockEncrypted
+ o = s.taboption('tab_advanced', form.ListValue, 'ArchiveBlockEncrypted', _('Block encrypted archives'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'no';
+
+ // AlertEncrypted
+ o = s.taboption('tab_advanced', form.ListValue, 'AlertEncrypted', _('Alert on encrypted archives'));
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'yes';
+
+ // StreamMinPort
+ o = s.taboption('tab_advanced', form.Value, 'StreamMinPort', _('Port range, lowest port'));
+ o.datatype = 'portrange';
+ o.value('1024');
+ o.placeholder = '1024';
+
+ // StreamMaxPort
+ o = s.taboption('tab_advanced', form.Value, 'StreamMaxPort', _('Port range, highest port'));
+ o.datatype = 'portrange';
+ o.value('2048');
+ o.placeholder = '2048';
+
+ // ReadTimeout
+ o = s.taboption('tab_advanced', form.ListValue, 'ReadTimeout', _('Read timeout'));
+ o.value('30');
+ o.placeholder = '30';
+
+ // CommandReadTimeout
+ o = s.taboption('tab_advanced', form.ListValue, 'CommandReadTimeout', _('Command read timeout'));
+ o.value('5');
+ o.placeholder = '5';
+
+ // MaxThreads
+ o = s.taboption('tab_advanced', form.Value, 'MaxThreads', _('Max number of threads'));
+ o.datatype = 'and(uinteger,min(1))';
+ o.value('10');
+ o.value('20');
+ o.placeholder = '10';
+
+ // SelfCheck
+ o = s.taboption('tab_advanced', form.Value, 'SelfCheck', _('Database check every N sec'));
+ o.datatype = 'and(uinteger,min(1))';
+ o.value('600');
+ o.placeholder = '600';
+
+ // MaxFileSize
+ o = s.taboption('tab_advanced', form.Value, 'MaxFileSize', _('Max size of scanned file'));
+ o.datatype = 'string';
+ o.value('512K', _('512K'));
+ o.value('1M', _('1M'));
+ o.value('2M', _('2M'));
+ o.value('50M', _('50M'));
+ o.value('150M', _('150M'));
+ o.placeholder = '150M';
+
+ // TCPAddr
+ o = s.taboption('tab_advanced', form.Value, 'TCPAddr', _('TCP listen address'));
+ o.datatype = 'string';
+ o.value('localhost');
+ o.value('127.0.0.1');
+ o.placeholder = '127.0.0.1';
+
+ // TCPSocket
+ o = s.taboption('tab_advanced', form.Value, 'TCPSocket', _('TCP listen port'));
+ o.datatype = 'string';
+ o.value('3310');
+ o.placeholder = '3310';
+
+ // User
+ o = s.taboption('tab_advanced', form.Value, 'User', _('User'));
+ o.datatype = 'string';
+ o.value('nobody');
+ o.placeholder = 'nobody';
+
+ // ExitOnOOM
+ o = s.taboption('tab_advanced', form.ListValue, 'ExitOnOOM', _('Exit when Out Of Memory'));
+ o.datatype = 'string';
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'yes';
+
+ // DisableCertCheck
+ o = s.taboption('tab_advanced', form.ListValue, 'DisableCertCheck', _('Disable certificate checks'));
+ o.datatype = 'string';
+ o.value('no', _('No'));
+ o.value('yes', _('Yes'));
+ o.placeholder = 'no';
+
+ // DatabaseDirectory
+ o = s.taboption('tab_advanced', form.Value, 'DatabaseDirectory', _('Database directory'));
+ o.datatype = 'string';
+ o.value('/usr/share/clamav');
+ o.placeholder = '/usr/share/clamav';
+
+ // TemporaryDirectory
+ o = s.taboption('tab_advanced', form.Value, 'TemporaryDirectory', _('Temporary directory'));
+ o.datatype = 'string';
+ o.value('/tmp');
+ o.placeholder = '/tmp';
+
+ // LocalSocket
+ o = s.taboption('tab_advanced', form.Value, 'LocalSocket', _('Local socket'));
+ o.datatype = 'string';
+ o.value('/var/run/clamav/clamd.sock');
+ o.placeholder = '/var/run/clamav/clamd.sock';
+
+ /*
+ // Logs Tab
+ var logfile = s.taboption('tab_logs', form.TextValue, 'clamav_logfile', '');
+ logfile.wrap = 'off';
+ logfile.rows = 50;
+ logfile.monospace = true;
+ logfile.editable = false;
+
+
+ logfile.cfgvalue = function() {
+ const logfilename = uci.get('clamav', 'clamav', 'LogFile')
+ return fs.read(logfilename)
+ .then(function(data) {
+ return data || '';
+ });
+ };
+
+ logfile.write = function() {
+ };
+ */
+
+ return m.render();
+ },
+
+ // handleSaveApply: function(ev) {
+ // this.super('handleSaveApply', [ev]);
+ // return Promise.all([
+ // rpc.declare({
+ // object: 'luci',
+ // method: 'setInitAction',
+ // params: [ 'name', 'action' ],
+ // expect: { result: false }
+ // })('clamav', 'reload'),
+ // ]);
+ // }
+
+});
diff --git a/applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/freshclam.js b/applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/freshclam.js
new file mode 100644
index 0000000000..583b9ccf82
--- /dev/null
+++ b/applications/luci-app-clamav/htdocs/luci-static/resources/view/clamav/freshclam.js
@@ -0,0 +1,199 @@
+'use strict';
+'require form';
+'require fs';
+'require uci';
+'require view';
+
+return view.extend({
+ load: function() {
+
+ },
+
+ render: function() {
+ var m, s, o;
+
+ m = new form.Map('freshclam', _('Freshclam'), _('Configuration'));
+
+ // Section
+ s = m.section(form.TypedSection, 'freshclam', _('Settings'));
+ s.anonymous = true;
+ s.addremove = false;
+
+ // Advanced Tab
+ s.tab('tab_advanced', _('Settings'));
+
+ // freshclam_config_file
+ o = s.taboption('tab_advanced', form.Value, 'freshclam_config_file', _('clamd config file'));
+ o.datatype = 'string';
+ o.value('/etc/clamav/freshclam.conf');
+ o.placeholder = '/etc/clamav/freshclam.conf';
+
+ /*
+ // UpdateLogFile
+ o = s.taboption('tab_advanced', form.Value, 'UpdateLogFile', _('Logfile'));
+ o.value('/tmp/clamav-milter.log');
+ o.placeholder = '/tmp/clamav-milter.log';
+
+ // LogFileMaxSize
+ o = s.taboption('tab_advanced', form.Value, 'LogFileMaxSize', _('Max size of log file'));
+ o.value('512K', _('512K'));
+ o.value('1M', _('1M'));
+ o.value('2M', _('2M'));
+
+ // LogRotate
+ o = s.taboption('tab_advanced', form.ListValue, 'LogRotate', _('Add header'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+ */
+
+ // LogTime
+ o = s.taboption('tab_advanced', form.ListValue, 'LogTime', _('Log time with each message'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+
+ // LogVerbose
+ o = s.taboption('tab_advanced', form.ListValue, 'LogVerbose', _('Enable verbose logging'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+
+ // Debug
+ o = s.taboption('tab_advanced', form.ListValue, 'Debug', _('Debug logging'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+ o.placeholder = 'true';
+
+ // LogSyslog
+ o = s.taboption('tab_advanced', form.ListValue, 'LogSyslog', _('Log to syslog'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+ o.placeholder = 'true';
+
+ // LogFacility
+ o = s.taboption('tab_advanced', form.ListValue, 'LogFacility', _('Syslog facility'));
+ o.value('LOG_KERN');
+ o.value('LOG_USER');
+ o.value('LOG_MAIL');
+ o.value('LOG_DAEMON');
+ o.value('LOG_AUTH');
+ o.value('LOG_LPR');
+ o.value('LOG_NEWS');
+ o.value('LOG_UUCP');
+ o.value('LOG_CRON');
+ o.value('LOG_LOCAL0');
+ o.value('LOG_LOCAL1');
+ o.value('LOG_LOCAL2');
+ o.value('LOG_LOCAL3');
+ o.value('LOG_LOCAL4');
+ o.value('LOG_LOCAL5');
+ o.value('LOG_LOCAL6');
+ o.value('LOG_LOCAL7');
+ // cannot do o.depends - it removes the option if dep condition is not met, thereby causing a startup error
+ // o.depends('LogSyslog', 'true');
+
+ // Foreground
+ o = s.taboption('tab_advanced', form.ListValue, 'Foreground', _('Run in foreground'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+ o.placeholder = 'false';
+
+ // PidFile
+ o = s.taboption('tab_advanced', form.Value, 'PidFile', _('PID file'));
+ o.datatype = 'string';
+ o.value('/var/run/clamav/freshclam.pid');
+ o.placeholder = '/var/run/clamav/freshclam.pid';
+
+ // NotifyClamd
+ o = s.taboption('tab_advanced', form.Value, 'NotifyClamd', _('Notify clamd'));
+ o.datatype = 'string';
+ o.value('/etc/clamav/clamd.conf');
+ o.placeholder = '/etc/clamav/clamd.conf';
+
+ // DatabaseOwner
+ o = s.taboption('tab_advanced', form.Value, 'DatabaseOwner', _('Database owner'));
+ o.datatype = 'string';
+ o.value('clamav');
+ o.value('root');
+ o.placeholder = 'root';
+
+ // DatabaseDirectory
+ o = s.taboption('tab_advanced', form.Value, 'DatabaseDirectory', _('Database directory'));
+ o.datatype = 'string';
+ o.value('/usr/share/clamav');
+ o.placeholder = '/usr/share/clamav';
+
+ // DNSDatabaseInfo
+ o = s.taboption('tab_advanced', form.Value, 'DNSDatabaseInfo', _('DNS database info'));
+ o.datatype = 'string';
+ o.value('current.cvd.clamav.net');
+ o.placeholder = 'current.cvd.clamav.net';
+
+ // DatabaseMirror
+ o = s.taboption('tab_advanced', form.Value, 'DatabaseMirror', _('Database mirror'));
+ o.datatype = 'string';
+ o.value('database.clamav.net');
+ o.placeholder = 'database.clamav.net';
+
+ // DatabaseCustomURL
+ o = s.taboption('tab_advanced', form.Value, 'DatabaseCustomURL', _('Custom database URL'));
+ o.value('http://myserver.example.com/mysigs.ndb');
+ o.value('https://myserver.example.com:4567/allow_list.wdb');
+ o.value('ftp://myserver.example.com/example.ldb');
+ o.value('file:///mnt/nfs/local.hdb');
+ o.value('file:///mnt/nfs/local.hdb');
+
+ // PrivateMirror
+ o = s.taboption('tab_advanced', form.Value, 'PrivateMirror', _('Private mirror URL'));
+ o.value('mirror1.example.com');
+ o.value('mirror2.example.com');
+
+ // ScriptedUpdates
+ o = s.taboption('tab_advanced', form.ListValue, 'ScriptedUpdates', _('Scripted updates'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+
+ // CompressLocalDatabase
+ o = s.taboption('tab_advanced', form.ListValue, 'CompressLocalDatabase', _('Compress local database'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+
+ // ConnectTimeout
+ o = s.taboption('tab_advanced', form.Value, 'ConnectTimeout', _('Connect timeout'));
+ o.value('30');
+ o.value('60');
+ o.placeholder = '60';
+
+ // ReceiveTimeout
+ o = s.taboption('tab_advanced', form.Value, 'ReceiveTimeout', _('Receive timeout'));
+ o.value('60');
+ o.value('300');
+ o.placeholder = '60';
+
+ // Checks
+ o = s.taboption('tab_advanced', form.Value, 'Checks', _('Database checks per day'));
+ o.value('12');
+ o.value('24');
+
+ // TestDatabases
+ o = s.taboption('tab_advanced', form.ListValue, 'TestDatabases', _('Test databases'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+
+ // Bytecode
+ o = s.taboption('tab_advanced', form.MultiValue, 'Bytecode', _('Download bytecode.cvd'));
+ o.value('false', _('No'));
+ o.value('true', _('Yes'));
+
+ // ExtraDatabase
+ o = s.taboption('tab_advanced', form.Value, 'ExtraDatabase', _('Extra databases'));
+ o.datatype = 'string';
+ o.placeholder = 'dbname1';
+
+ // ExcludeDatabase
+ o = s.taboption('tab_advanced', form.Value, 'ExcludeDatabase', _('Exclude databases'));
+ o.datatype = 'string';
+ o.placeholder = 'dbname1';
+
+ return m.render();
+ },
+
+});