]> git.ipfire.org Git - thirdparty/suricata-update.git/log
thirdparty/suricata-update.git
6 years agoCheck data directory's permission while updating sources 217/head
Shivani Bhardwaj [Mon, 7 Oct 2019 10:38:18 +0000 (16:08 +0530)] 
Check data directory's permission while updating sources

Closes redmine ticket #3219.

6 years agoDocs: Setup directories with correct permissions
Vagisha Gupta [Wed, 12 Jun 2019 08:21:24 +0000 (13:51 +0530)] 
Docs: Setup directories with correct permissions

Documentation updated with the steps to setup the directories with
the correct permissions.

6 years agoSeparate out matchers
Vagisha Gupta [Thu, 17 Oct 2019 06:46:50 +0000 (12:16 +0530)] 
Separate out matchers

Currently, all the code for matchers happens to be in main.py
which makes it quite cluttered. A separate `matchers.py` module
is created which contains all the code for matching rules and
integrated with main.py. Also the modules `test_main.py` and
`test_matchers.py` are modified accordingly.

Redmine issue:
    https://redmine.openinfosecfoundation.org/issues/2873

6 years agoSeparate out parsers
Vagisha Gupta [Fri, 18 Oct 2019 09:22:51 +0000 (14:52 +0530)] 
Separate out parsers

Parsers are separated out of the `main.py` module to a new `parsers.py`
module to make code cleaner and compact.

This patch is heavily based on Vidushi's work.
Thanks to Vidushi Agrawal <vidushi229@gmail.com>

Redmine issue:
    https://redmine.openinfosecfoundation.org/issues/2874

6 years agodoc: Add missing docs for commands
Shivani Bhardwaj [Fri, 18 Oct 2019 10:50:12 +0000 (16:20 +0530)] 
doc: Add missing docs for commands

Add docs for `list-sources`, `list-enabled-sources` and `check-versions`
commands.
Closes redmine ticket #3228.

6 years agoupdate-sources: python 3 fixup 216/head
Jason Ish [Wed, 11 Dec 2019 21:26:58 +0000 (15:26 -0600)] 
update-sources: python 3 fixup

Open index in binary mode to fix encoding issue on Python 3.6
on CentOS 7.

6 years agogithub: add some github ci actions
Jason Ish [Wed, 11 Dec 2019 16:15:36 +0000 (10:15 -0600)] 
github: add some github ci actions

6 years agointegration-test: use python executable thats starts test
Jason Ish [Wed, 11 Dec 2019 16:29:28 +0000 (10:29 -0600)] 
integration-test: use python executable thats starts test

Use the Python binary that was used to start the integration
test to run suricata-update.

6 years agochangelog: update
Jason Ish [Wed, 11 Dec 2019 18:53:07 +0000 (12:53 -0600)] 
changelog: update

6 years agoDisable SMB rules if not supported by Suricata
Jason Ish [Wed, 13 Nov 2019 16:16:59 +0000 (10:16 -0600)] 
Disable SMB rules if not supported by Suricata

If Suricata is less than 5, and Rust is not enabled, disable
smb rules as they require Rust.

Ticket 3280:
https://redmine.openinfosecfoundation.org/issues/3280

6 years agoCleanup scattered main imports
Vagisha Gupta [Fri, 13 Sep 2019 05:48:13 +0000 (11:18 +0530)] 
Cleanup scattered main imports

Currently, lot of names of a module are imported from a package by
writing multiple import statements in main.py. Instead, Python's
standard grouping mechanism (parentheses) is used to write the import
statement to make them compact.

Redmine issue:
    https://redmine.openinfosecfoundation.org/issues/2872

6 years agoCleanup unused import and use isinstance() instead of type()
Vagisha Gupta [Fri, 15 Mar 2019 12:57:46 +0000 (18:27 +0530)] 
Cleanup unused import and use isinstance() instead of type()

Optimization Cleanup main imports

`import types` is an unused import in main.py, therefore, removed.
Also, using `isinstance()` is the preferred way to access the type.
The isinstance() function checks if the object (first argument)
is an instance or subclass of classinfo class (second argument).
Here object is the 'url' to be checked and classinfo is a string
type.

6 years agoFix failure in case of missing index.yaml, cleanup
Shivani Bhardwaj [Mon, 25 Feb 2019 10:29:54 +0000 (15:59 +0530)] 
Fix failure in case of missing index.yaml, cleanup

If the index.yaml was not present in data directory, update-sources
command would fail with an IOError. Fix this by handling this case. Now,
if sources are updated on a new data directory, there is an info message
"Adding all sources in the log".

Modularize the current structure to make it more readable and perform
one thing per function. Sort the imports and clean them.

6 years agoAdd summary for updated sources
Shivani Bhardwaj [Mon, 5 Nov 2018 16:06:37 +0000 (21:36 +0530)] 
Add summary for updated sources

`suricata-update` when used with its option `update-sources` did not
give any information about what changed and in which source. Add the
logs for any change in the sources, namely, addition, removal or change
in the content.
The log output now looks like:
```
$ ./bin/suricata-update update-sources
31/10/2018 -- 00:03:52 - <Info> -- Loading /etc/suricata/update.yaml
31/10/2018 -- 00:03:52 - <Info> -- Using data-directory /var/lib/suricata.
31/10/2018 -- 00:03:52 - <Info> -- Using Suricata configuration /etc/suricata/suricata.yaml
31/10/2018 -- 00:03:52 - <Info> -- Using /etc/suricata/rules for Suricata provided rules.
31/10/2018 -- 00:03:52 - <Info> -- Found Suricata version 4.1.0-dev at /usr/sbin/suricata.
31/10/2018 -- 00:03:52 - <Info> -- Downloading https://www.openinfosecfoundation.org/rules/index.yaml
31/10/2018 -- 00:03:53 - <Info> -- Source et/open was added
31/10/2018 -- 00:03:53 - <Info> -- Source empty/something was removed
31/10/2018 -- 00:03:53 - <Info> -- Source et/pro was changed
31/10/2018 -- 00:03:53 - <Info> -- Saved /var/lib/suricata/update/cache/index.yaml
```

Closes redmine ticket #2472.

6 years agopr template: Remove unnecessary newlines
Shivani Bhardwaj [Thu, 8 Nov 2018 16:25:36 +0000 (21:55 +0530)] 
pr template: Remove unnecessary newlines

6 years agoversion: 1.2.0dev0
Jason Ish [Thu, 17 Oct 2019 22:51:45 +0000 (16:51 -0600)] 
version: 1.2.0dev0

6 years ago1.1.0: update version and changelog 202/head 203/head 1.1.0
Jason Ish [Fri, 11 Oct 2019 16:01:45 +0000 (10:01 -0600)] 
1.1.0: update version and changelog

6 years agoCopy environment before modify when running Suricata.
Jason Ish [Fri, 11 Oct 2019 16:52:27 +0000 (10:52 -0600)] 
Copy environment before modify when running Suricata.

Related issue:
https://redmine.openinfosecfoundation.org/issues/2669

LD_LIBRARY_PATH wasn't being passed through to the environment
used to run Suricata. Fix this by copying the parent
environment than adding the vars that we need instead of
using a clean environment.

6 years agoindex: update embedded index 201/head
Jason Ish [Fri, 11 Oct 2019 14:58:02 +0000 (08:58 -0600)] 
index: update embedded index

6 years agoindex: remove version info from bundled index
Jason Ish [Fri, 11 Oct 2019 15:24:35 +0000 (09:24 -0600)] 
index: remove version info from bundled index

This prevents the issue of including outdated version info
when a new release of Suricata is made with a bundled
suricata-update.

The user will be asked to update their sources to check
their version info.

6 years agoversion check: small fix - missing import and wording
Jason Ish [Fri, 11 Oct 2019 14:49:34 +0000 (08:49 -0600)] 
version check: small fix - missing import and wording

- import sys was missing cause sys.exit to throw an
  exception

- if the index does not contain a version, suggest the
  user run update-sources.

6 years agoFix check-versions command
Shivani Bhardwaj [Wed, 9 Oct 2019 18:26:30 +0000 (23:56 +0530)] 
Fix check-versions command

This patch addresses the following issues:
1. Checks wherever code could fail
2. Proper handling of dev and stable versions
3. Small optimizations

6 years agoAdd "check-versions" subcommand
Vagisha Gupta [Fri, 12 Jul 2019 07:13:09 +0000 (12:43 +0530)] 
Add "check-versions" subcommand

Add a `suricata-update check-versions` subcommand that checks
the version of suricata and logs if the versions are up to
date, outdated or EOL.

Redmine issue:
    https://redmine.openinfosecfoundation.org/issues/2341

6 years agoconfig: use datarootdir from build info for dist rules
Jason Ish [Wed, 2 Oct 2019 20:53:15 +0000 (14:53 -0600)] 
config: use datarootdir from build info for dist rules

When looking for Suricata provided rules, put the highest
priority on the datarootdir from the build info.

6 years agoDisable ja3_hash rules if Suricata not configured for ja3.
Jason Ish [Wed, 2 Oct 2019 20:43:12 +0000 (14:43 -0600)] 
Disable ja3_hash rules if Suricata not configured for ja3.

Disable rules using ja3 keywords if Suricata is not configure
for ja3, or does not support ja3.

Rules using ja3 keywords with fail to load if Suricata is not
built with NSS, or ja3 fingerprints are disabled.

Take into account the Suricata version as well, as not defining
the ja3_fingerprint configuration field in 5.0+ will leave it
enabled, but in older versions, it will remain disabled if
not defined.

6 years agoengine/config: include info info in config object
Jason Ish [Wed, 2 Oct 2019 20:41:18 +0000 (14:41 -0600)] 
engine/config: include info info in config object

6 years agoengine/build-info: include parsed version info
Jason Ish [Wed, 2 Oct 2019 20:39:26 +0000 (14:39 -0600)] 
engine/build-info: include parsed version info

6 years agoengine: extract features from --build-info
Jason Ish [Wed, 2 Oct 2019 19:22:49 +0000 (13:22 -0600)] 
engine: extract features from --build-info

6 years ago1.1.0rc1 1.1.0rc1
Jason Ish [Mon, 9 Sep 2019 21:37:59 +0000 (15:37 -0600)] 
1.1.0rc1

6 years agochangelog: add ticket 3100: optional checksum url
Jason Ish [Mon, 9 Sep 2019 21:17:02 +0000 (15:17 -0600)] 
changelog: add ticket 3100: optional checksum url

6 years agoAdd no-checksum option 194/head
Vagisha Gupta [Mon, 2 Sep 2019 07:54:12 +0000 (13:24 +0530)] 
Add no-checksum option

Added a `--no-checksum` option to the add-source command and an optional
"checksum" in SourceConfiguration class for add-sources and
enabled-sources.
Also, a check is added to skip downloading the checksum URL if the
source is configured  with checksum false.

Redmine issue:
    https://redmine.openinfosecfoundation.org/issues/3100

6 years agoRedo variable and function names reserved for Python
Vagisha Gupta [Mon, 10 Jun 2019 19:33:09 +0000 (01:03 +0530)] 
Redo variable and function names reserved for Python

Changed the conflicting variable name `filter` and function name
`filter()` accordingly which suricata-update uses as it is reserved
for use in Python standard modules.

6 years agoLog a warning if index is old
Vagisha Gupta [Wed, 10 Jul 2019 05:31:01 +0000 (11:01 +0530)] 
Log a warning if index is old

If the index is older than 2 weeks, logged a warning that the
index is old and user needs to update it by running
`suricata-update update-sources`.

6 years agochangelog: add missing tickets
Jason Ish [Wed, 28 Aug 2019 22:18:18 +0000 (16:18 -0600)] 
changelog: add missing tickets

6 years agoAdd a check to apply colour if output stream on tty
Vagisha Gupta [Mon, 5 Aug 2019 09:10:51 +0000 (14:40 +0530)] 
Add a check to apply colour if output stream on tty

6 years agoSeparate log messages to stderr and stdout
Vagisha Gupta [Mon, 5 Aug 2019 09:05:55 +0000 (14:35 +0530)] 
Separate log messages to stderr and stdout

Currently, all the messages in suricata-update are logged to stderr.
Changes are made to split between log messages where regular
output (INFO, DEBUG) goes to stdout whereas ERRORS, WARNINGS and
CRITICAL messages goes to stderr.

6 years agochangelog: fix for issue 2875
Jason Ish [Wed, 28 Aug 2019 21:59:38 +0000 (15:59 -0600)] 
changelog: fix for issue 2875

6 years agoImprove permission warning
Vagisha Gupta [Tue, 28 May 2019 07:20:29 +0000 (12:50 +0530)] 
Improve permission warning

Improve permission warning when Suricata-update runs with the wrong user

When suricata-update runs with a non-root user, it gives an ugly traceback.
To avoid those ugly tracebacks, try except block is put around the operation
that are being performed on the file i.e. shutil.copyfile(src, dest) and
exit cleanly with an error in the log.
Also, to avoid ugly tracebacks for permission of suricata.yaml, try-except
is put around where it is accessed and exit cleanly.

6 years agochangelog: fix for issue 2867
Jason Ish [Wed, 28 Aug 2019 21:42:32 +0000 (15:42 -0600)] 
changelog: fix for issue 2867

6 years agoFix TypeError : Failure with missing rule params
Vrinda Narayan [Thu, 28 Mar 2019 12:02:48 +0000 (17:32 +0530)] 
Fix TypeError : Failure with missing rule params

Bug #2867 : Failure with missing rule params
If sometimes a rule is not parsed correctly and sid or gid are of
NoneType the program shows a TypeError. While parsing the rule, the sid
can be checked to make sure that sid is not of type None, and if it is,
raise a BadSidError and log it, the rule is not added to the list of
final rules.

6 years agochangelog: pull in changelog for 1.0.4 and 1.0.5
Jason Ish [Wed, 28 Aug 2019 21:35:30 +0000 (15:35 -0600)] 
changelog: pull in changelog for 1.0.4 and 1.0.5

6 years agoCatch Keyboard Interrupt and exit cleanly.
Vrinda Narayan [Wed, 13 Mar 2019 09:53:43 +0000 (15:23 +0530)] 
Catch Keyboard Interrupt and exit cleanly.

Optimization #2878 https://redmine.openinfosecfoundation.org/issues/2878
Can be done by importing python library signal, and defining a function
signal_handler which will print a message if keyboard interrupt is
detected and exit the program.

6 years agoAdd "offline" command
Vagisha Gupta [Thu, 20 Jun 2019 18:09:06 +0000 (23:39 +0530)] 
Add "offline" command

Add a command line option `--offline` that uses locally cached
latest version of rules without trying to download rules from
sources.

6 years agoLog a warning on duplicate SID
Vagisha Gupta [Mon, 3 Jun 2019 08:53:24 +0000 (14:23 +0530)] 
Log a warning on duplicate SID

Currently when suricata-update encounters a rule with duplicate SIDs,
it silently uses the one with the higher revision without logging the
warnings.
On duplicate SID, warnings are logged for equal as well as different
revisions.

6 years agoParse rule files alphabetically
Vidushi Agrawal [Sun, 5 May 2019 18:33:34 +0000 (00:03 +0530)] 
Parse rule files alphabetically

Sort the file names before parsing them.
Example:
Currently,
```
suricata-update -v
```
generates
```
24/3/2019 -- 10:38:16 - <Debug> -- Parsing rules/emerging-chat.rules.
24/3/2019 -- 10:38:16 - <Debug> -- Parsing sslblacklist.rules.
24/3/2019 -- 10:38:16 - <Debug> -- Parsing rules/emerging-web_client.rules.
24/3/2019 -- 10:38:16 - <Debug> -- Parsing rules/botcc.portgrouped.rules.
24/3/2019 -- 10:38:16 - <Debug> -- Parsing rules/emerging-smtp.rules.
```
i.e., the rule files are not parsed in alphabetical order.

Thus, changing the parser to load these files in alphabetical order by sorting the filenames before starting to work on them fixes the issue. Now the output generated on running
```
suricata-update -v
```
is
```
24/3/2019 -- 10:34:24 - <Debug> -- Parsing rules/botcc.rules.
24/3/2019 -- 10:34:24 - <Debug> -- Parsing rules/ciarmy.rules.
24/3/2019 -- 10:34:24 - <Debug> -- Parsing rules/compromised.rules.
24/3/2019 -- 10:34:24 - <Debug> -- Parsing rules/drop.rules.
24/3/2019 -- 10:34:24 - <Debug> -- Parsing rules/dshield.rules.
24/3/2019 -- 10:34:24 - <Debug> -- Parsing rules/emerging-activex.rules.
```
Rules files are now parsed in sorted order.

Closes Redmine ticket #2892

6 years agoadd test cases for flowbit dependencies and noalert option 149/head
Konstantin Klinger [Fri, 10 May 2019 04:39:16 +0000 (06:39 +0200)] 
add test cases for flowbit dependencies and noalert option

6 years agorule: recognise more noalert cases
Konstantin Klinger [Fri, 10 May 2019 04:22:26 +0000 (06:22 +0200)] 
rule: recognise more noalert cases

This commit ensures that rules only tagged with "noalert;" option
and not only with "flowbits:noalert;" will get the rule.noalert
value set to true.

6 years agomake sure that noalert is set in newly enabled rules
Konstantin Klinger [Fri, 10 May 2019 04:20:39 +0000 (06:20 +0200)] 
make sure that noalert is set in newly enabled rules

This commit adds functionality that ensures that previously
disabled rules enabled by flowbit dependencies will receive
the noalert option.

6 years agotests: update test index to latest index 145/head
Jason Ish [Fri, 26 Apr 2019 21:10:46 +0000 (15:10 -0600)] 
tests: update test index to latest index

6 years agodoc: update default index url
Jason Ish [Wed, 24 Apr 2019 05:04:53 +0000 (23:04 -0600)] 
doc: update default index url

From jasonish repo to
  https://www.openinfosecfoundation.org/rules/index.yaml

6 years agoindex: update embedded intel index
Jason Ish [Wed, 24 Apr 2019 05:03:28 +0000 (23:03 -0600)] 
index: update embedded intel index

6 years agoindex update: use oisf index, not jasonish
Jason Ish [Wed, 24 Apr 2019 05:03:07 +0000 (23:03 -0600)] 
index update: use oisf index, not jasonish

6 years agoaddress code comments
Sascha Steinbiss [Sat, 19 Jan 2019 23:10:19 +0000 (00:10 +0100)] 
address code comments

6 years agoadd documentation paragraph about updating
Sascha Steinbiss [Sat, 22 Dec 2018 16:44:16 +0000 (17:44 +0100)] 
add documentation paragraph about updating

6 years agoprint info log message on changed source parameter
Sascha Steinbiss [Sat, 22 Dec 2018 16:06:33 +0000 (17:06 +0100)] 
print info log message on changed source parameter

6 years agodo not fail on repeated enabling/disabling of sources
Sascha Steinbiss [Wed, 5 Dec 2018 13:01:04 +0000 (14:01 +0100)] 
do not fail on repeated enabling/disabling of sources

6 years agoFix default for the --ignore flag 132/head
Vidushi Agrawal [Fri, 15 Mar 2019 21:56:04 +0000 (03:26 +0530)] 
Fix default for the --ignore flag

suricata-update doesn't properly load some sections in update.yaml file.
Example:
Even after setting the following in update.yaml
```
ignore:
  - "*deleted.rules"
  - "*pop3.rules"
```

```
$ ./bin/suricata-update -v
```
generates
```
16/3/2019 -- 03:14:59 - <Debug> -- Parsing rules/emerging-pop3.rules.
16/3/2019 -- 03:15:01 - <Debug> -- Parsing rules/emerging-deleted.rules.
```
which means the files do not get ignored. It seems that the code loading command line parameters override previous settings even when no parameters are given.
Thus changing the default for the --ignore flag from "[]" to "None", fixes the issue.

Closes Redmine ticket #2851.

6 years agoFix Failure with --no-merge
Vagisha Gupta [Wed, 13 Mar 2019 14:57:20 +0000 (20:27 +0530)] 
Fix Failure with --no-merge

UnboundLocalError: local variable 'rule' referenced before assignment

'suricata-update --no-merge' runs into an error.
'rule.id' is changed to 'key' variable to fix this issue because 'rule' is
not used in the loop. Appended 'key' to the added list i.e. List of rule IDs
that have been added.

6 years agoAdd timeout of 30 sec for all GET requests
Shivani Bhardwaj [Tue, 22 Jan 2019 15:49:37 +0000 (21:19 +0530)] 
Add timeout of 30 sec for all GET requests

suricata-update has been reported to get hung in case the download fails
for a particular source. Add a timeout parameter to urllib to avoid that
and continue further processing after a timeout of 30 seconds.

Closes redmine ticket #2703.

6 years agoFix null pointer dereference issue detected by coverity
Shivani Bhardwaj [Fri, 22 Feb 2019 12:50:15 +0000 (18:20 +0530)] 
Fix null pointer dereference issue detected by coverity

Coverity scan of the current code raised the following issue:
```
>>>     CID 327298:  Null pointer dereferences  (FORWARD_NULL)
>>>     Accessing a property of null-like value "val".
271                 if val.find("noalert") > -1:
```

Fix this by adding a null check on val.

Closes redmine ticket #2834.

6 years agoAdd dhcp-events.rules as a known engine provided rule.
Jason Ish [Wed, 6 Mar 2019 15:23:54 +0000 (09:23 -0600)] 
Add dhcp-events.rules as a known engine provided rule.

7 years agotests: test rule without rev gets rev 0
Jason Ish [Mon, 11 Feb 2019 19:53:48 +0000 (13:53 -0600)] 
tests: test rule without rev gets rev 0

7 years agorules: default rev to 0 for rules without a rev
Jason Ish [Mon, 11 Feb 2019 17:19:53 +0000 (11:19 -0600)] 
rules: default rev to 0 for rules without a rev

Comparisons between none types in Python 2 were allowed, Python 3
throws an exception here causing rules without a rev to break
suricata-update.

7 years agoFree some collection types before testing Suricata
Jason Ish [Mon, 11 Feb 2019 15:36:42 +0000 (09:36 -0600)] 
Free some collection types before testing Suricata

Forces Python to free up some memory before starting Suricata
which may use a lot of memory itself.

Fixup for low memory devices.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2791

7 years agoOptimize report generation memory usage
Jason Ish [Fri, 1 Feb 2019 18:15:06 +0000 (12:15 -0600)] 
Optimize report generation memory usage

Avoid the need to keep the complete parsed old ruleset in memory
while building the report by generating the report as the old
ruleset is parsed.

In my tests has a good amount of memory saving.

Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2791

7 years agorules: don't store a tokenized list of options
Jason Ish [Thu, 31 Jan 2019 04:43:02 +0000 (22:43 -0600)] 
rules: don't store a tokenized list of options

Its not required by suricata-update, and contributes to
excessive memory usage.

In support of issue:
https://redmine.openinfosecfoundation.org/issues/2791

7 years agorule: set noalert field to True of noalert flowbit set
Jason Ish [Thu, 31 Jan 2019 04:32:55 +0000 (22:32 -0600)] 
rule: set noalert field to True of noalert flowbit set

This is done to check if a rule is noalert instead of iterating
through the options as the options list is being removed.

7 years agoAvoid failure in case of obsoletion of attribute
Shivani Bhardwaj [Mon, 14 Jan 2019 17:22:49 +0000 (22:52 +0530)] 
Avoid failure in case of obsoletion of attribute

`platform` is currently (Py3.7) shipped with `linux_distribution`
attribute but it has been Deprecated since Py3.5. In future when it
becomes obsolete, suricata-update will break while creating User-Agent
header. In order to avoid this, check for the attribute before adding it
to User-Agent.

This renders redmine issue #2645 invalid.

7 years agointegration test: log python version info 84/head
Jason Ish [Fri, 21 Dec 2018 14:44:22 +0000 (08:44 -0600)] 
integration test: log python version info

7 years agotravis: call integration test
Jason Ish [Fri, 21 Dec 2018 14:39:22 +0000 (08:39 -0600)] 
travis: call integration test

7 years agochangelog: update for 1.0.3
Jason Ish [Fri, 21 Dec 2018 14:30:54 +0000 (08:30 -0600)] 
changelog: update for 1.0.3

7 years agoMake header an optional argument
Shivani Bhardwaj [Fri, 21 Dec 2018 09:14:53 +0000 (14:44 +0530)] 
Make header an optional argument

header was being used as a required argument in SourceConfiguration
class. Since SourceConfiguration class has been used multiple times
across commands, not all the commands require header argument and thus
it breaks. Fix it by making header an optional argument.

Closes redmine ticket #2753

7 years agochangelog: update for 1.0.2
Jason Ish [Tue, 18 Dec 2018 13:44:36 +0000 (07:44 -0600)] 
changelog: update for 1.0.2

7 years agosetup.py: check for Python 2.7 or newer.
Jason Ish [Tue, 18 Dec 2018 15:21:00 +0000 (09:21 -0600)] 
setup.py: check for Python 2.7 or newer.

Display message and exit if Python is less than 2.7.

7 years agoFix the broken sys import of distutils
Shivani Bhardwaj [Tue, 18 Dec 2018 10:31:40 +0000 (16:01 +0530)] 
Fix the broken sys import of distutils

Newer distutils versions allow to list and work with `sys` as it is
imported in the `__init__.py` however, the older versions of disutils
does not contain anything other than the version and revision strings.
The current installation procedure relied on the former method which is
only adapted in the new versions so make it compatible to the older
versions by importing `sys` from `distutils.core`.

Closes redmine ticket #2747

7 years agochangelog: update for 1.0.1 release
Jason Ish [Mon, 17 Dec 2018 02:37:23 +0000 (20:37 -0600)] 
changelog: update for 1.0.1 release

7 years agochangelog: fix typos
Jason Ish [Fri, 14 Dec 2018 18:08:58 +0000 (12:08 -0600)] 
changelog: fix typos

7 years agochangelog: update 77/head
Jason Ish [Fri, 14 Dec 2018 17:35:14 +0000 (11:35 -0600)] 
changelog: update

7 years agodoc: document add-source --http-header
Jason Ish [Fri, 14 Dec 2018 17:55:32 +0000 (11:55 -0600)] 
doc: document add-source --http-header

7 years agoUse header in the request for sources
Shivani Bhardwaj [Wed, 5 Dec 2018 19:04:26 +0000 (00:34 +0530)] 
Use header in the request for sources

Allows the use of header while requesting for a source.

Alongwith 75f6c327, closes redmine ticket #2577

7 years agoAdd header option to add source command
Shivani Bhardwaj [Wed, 5 Dec 2018 17:37:22 +0000 (23:07 +0530)] 
Add header option to add source command

Facilitates addition of a header per source while adding the source.
Usage:
```
$ ./bin/suricata-update add-source --header "Auth: Basic"
```

7 years agoSupress progress meter when not on a tty.
Jason Ish [Fri, 14 Dec 2018 15:33:04 +0000 (09:33 -0600)] 
Supress progress meter when not on a tty.

Fixes Redmine issue:
https://redmine.openinfosecfoundation.org/issues/2743

7 years agoUpdate list of engine rules to include.
Jason Ish [Thu, 13 Dec 2018 16:36:03 +0000 (10:36 -0600)] 
Update list of engine rules to include.

7 years agoversion: hide git revision if unknown 74/head
Jason Ish [Thu, 13 Dec 2018 14:45:14 +0000 (08:45 -0600)] 
version: hide git revision if unknown

This happens when suricata-update is installed bundled with
Suricata.  This is more a relic from the earlier days
of Suricata-Update when more users were likely to install
it directly from git anyways.

7 years agochangelog: issue 2676 fixed
Jason Ish [Tue, 4 Dec 2018 20:17:05 +0000 (14:17 -0600)] 
changelog: issue 2676 fixed

7 years agoFix missing null check
Shivani Bhardwaj [Wed, 28 Nov 2018 15:07:25 +0000 (20:37 +0530)] 
Fix missing null check

Coverity discovered a missing null check for the variable `val`. Fix
 that by adding the appropriate checks for it.

Closes redmine ticket #2676

7 years agochangelog: update with recent fixes
Jason Ish [Tue, 4 Dec 2018 20:06:32 +0000 (14:06 -0600)] 
changelog: update with recent fixes

7 years agoInstall requirements if using pip 66/head
Shivani Bhardwaj [Fri, 23 Nov 2018 14:55:29 +0000 (20:25 +0530)] 
Install requirements if using pip

Current setup was using distutils which does not allow to define the
requirements of a package. Check if the installation of
`suricata-update` is being done with `pip` and if it is, install the
requirements while installing the package.
This way distutils will not throw a warning of the `install_requires`
option being unrecognized, however, it would still not install the
requirements.
Now, with the installation of `suricata-update` package, all the
requirements are installed as well if it is installed with `pip`.

Closes redmine ticket #2667

7 years agoAdd the required data for sample confs to setup 63/head
Shivani Bhardwaj [Thu, 22 Nov 2018 16:12:40 +0000 (21:42 +0530)] 
Add the required data for sample confs to setup

setup.py missed the required configuration files for running the
`dump-sample-configs` option. Add all the files under
suricata/update/configs.

Closes redmine ticket #2683

7 years agoversion: 1.1.0dev0
Jason Ish [Tue, 20 Nov 2018 16:19:57 +0000 (10:19 -0600)] 
version: 1.1.0dev0

7 years agochangelog: issue 2665
Jason Ish [Tue, 20 Nov 2018 16:18:11 +0000 (10:18 -0600)] 
changelog: issue 2665

7 years agochangelog: issue 2641 addressed
Jason Ish [Tue, 20 Nov 2018 16:02:15 +0000 (10:02 -0600)] 
changelog: issue 2641 addressed

7 years agoAdd --free argument to list-sources command
Shivani Bhardwaj [Wed, 31 Oct 2018 15:38:02 +0000 (21:08 +0530)] 
Add --free argument to list-sources command

Add the functionality of being able to list only the free sources with
the `list-sources` command. This patch differentiates a free source from
a non-free source based on the availability of "subscription-url" for a
particular source.

This argument is also available in the help section of `list-sources`
command.

```
$./suricata-update list-sources -h
usage: suricata-update list-sources [-h] [-v] [-q] [-D <directory>]
                                    [-c <filename>]
                                    [--suricata-conf <filename>]
                                    [--suricata <path>]
                                    [--suricata-version <version>]
                                    [--user-agent <user-agent>]
                                    [--no-check-certificate] [-V] [--free]

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Be more verbose
  -q, --quiet           Be quiet, warning and error messages only
  -D <directory>, --data-dir <directory>
                        Data directory (default: /var/lib/suricata)
  -c <filename>, --config <filename>
                        configuration file (default:
                        /etc/suricata/update.yaml)
  --suricata-conf <filename>
                        configuration file (default:
                        /etc/suricata/suricata.yaml)
  --suricata <path>     Path to Suricata program
  --suricata-version <version>
                        Override Suricata version
  --user-agent <user-agent>
                        Set custom user-agent string
  --no-check-certificate
                        Disable server SSL/TLS certificate verification
  -V, --version         Display version
  --free                List all freely available sources
```

Closes Redmine ticket #2641.

7 years agoclassification.conf: update test to match new strings
Jason Ish [Tue, 23 Oct 2018 20:13:28 +0000 (14:13 -0600)] 
classification.conf: update test to match new strings

7 years agoclassification.conf: Changed to Suricata 4.1 style
Travis Green [Tue, 23 Oct 2018 19:31:17 +0000 (13:31 -0600)] 
classification.conf: Changed to Suricata 4.1 style

should remain backwards compatible

7 years agoRemove User-Agent header if set to empty 59/head
Shivani Bhardwaj [Tue, 6 Nov 2018 16:06:24 +0000 (21:36 +0530)] 
Remove User-Agent header if set to empty

`suricata-update` sends a User Agent as a part of the request header to
get some basic information about the user system like the suricata-update
version, python version, etc. However, some users do not like this
behavior and are facililated with a `--user-agent` option whereby they
can modify the `User-Agent` header to a custom string. Although, in some
cases, it has been observed that the `User-Agent` header can be set to
nothing. In some other cases, users wish to set it to an empty string.

Example:

```
$ ./bin/suricata-update update-sources --user-agent "  "
```

generates request headers like,

```
Accept-Encoding: identity
Host: XXX
User-Agent:
Connection: close
```

which makes `User-Agent` header quite redundant.

Remove the header if it is set to a string that evaluates to nothing.

Closes Redmine ticket #2665.

7 years agoCheck default conf before command line options
Shivani Bhardwaj [Tue, 6 Nov 2018 15:59:10 +0000 (21:29 +0530)] 
Check default conf before command line options

The default configuration file must be checked for the availability of
`user-agent` option even if it is None.

This behavior has been implemented by Jason Ish.

7 years agoquickstart: update for 1.0
Jason Ish [Tue, 6 Nov 2018 15:36:25 +0000 (09:36 -0600)] 
quickstart: update for 1.0

Also add note that if using Suricata 4.1 the command may already
be installed.

7 years agoreadme: update for 1.0.0 1.0.0
Jason Ish [Mon, 5 Nov 2018 15:38:06 +0000 (09:38 -0600)] 
readme: update for 1.0.0

7 years ago1.0.0 - update changelog, set version
Jason Ish [Mon, 5 Nov 2018 15:10:53 +0000 (09:10 -0600)] 
1.0.0 - update changelog, set version