Closed 0x7fff9 closed 7 years ago
I am spinning them up on Digital Ocean servers and I get the same error. No idea how to fix
weird. I had all working ok on UBUNTU 16 for tests and now new builds can't go.
I will try to change the mongo installation script as I believe the issue is with Mongo and will post back the results.
testing replace:
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
with
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
cheers.
It seems like the database init gets to about 7000 and then it fails on the same file every time. I will post the file that causes it to fail when I get back to my desk.
On Apr 1, 2017, at 9:47 AM, Guido Galego notifications@github.com wrote:
weird. I had all working ok on UBUNTU 16 for tests and now new builds can't go.
I will try to change the mongo installation script as I believe the issue is with Mongo and will post back the results.
testing replace: echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
with echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
cheers.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
it gets to here: 'url, blogs.forcepoint.com/security-labs/trojanized-adobe-installer-used-install-dragonok\xe2\x80\x99s-new-custom-backdoor' then fails with a unicode error. Commenting out init_database.py in the install_mhn_server.sh file is the only way to get the install to finish. After that everything seems to work fine except for the deployment of suricata and snort as when it goes to get check the prerendered list it 404s. Tried restarted all the mhn services, no luck
On Sat, Apr 1, 2017 at 9:58 AM, Trey Vickory tvickory@gmail.com wrote:
It seems like the database init gets to about 7000 and then it fails on the same file every time. I will post the file that causes it to fail when I get back to my desk.
On Apr 1, 2017, at 9:47 AM, Guido Galego notifications@github.com wrote:
weird. I had all working ok on UBUNTU 16 for tests and now new builds can't go.
I will try to change the mongo installation script as I believe the issue is with Mongo and will post back the results.
testing replace: echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
with echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/ mongodb-org-3.4.list
cheers.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/threatstream/mhn/issues/383#issuecomment-290921115, or mute the thread https://github.com/notifications/unsubscribe-auth/AIORHXnxbyjgARBtkCqsRj-hUevjjFh9ks5rrlVjgaJpZM4MwdB8 .
the real url for that is https://blogs.forcepoint.com/security-labs/trojanized-adobe-installer-used-install-dragonok%E2%80%99s-new-custom-backdoor
why is it looking for that, any idea?
thanks for the comment tip! indeed it passes for the rest of the install after the Imported 7500 rules so far...
Let's wait and see if there is a fix for this, a lot of users should be experiencing this on new deployments.
cheers.
Not sure. I think it is adding it as a rule to the database. When the install finishes are you able to see the prendered rules list on the web instance. Mine 404s
On Apr 1, 2017, at 11:19 AM, Guido Galego notifications@github.com wrote:
the real url for that is https://blogs.forcepoint.com/security-labs/trojanized-adobe-installer-used-install-dragonok%E2%80%99s-new-custom-backdoor why is it looking for that, any idea?
thanks for the comment tip! indeed it passes for the rest of the install after the Imported 7500 rules so far...
Let's wait and see if there is a fix for this, a lot of users should be experiencing this on new deployments.
cheers.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
yes but I think that's because once we comment out the init_database.py from the install script the rules are no longer downloaded. Also this must impact snort as these rules relate to it. it's a shame that can't make this work perfectly, the last build I had was OK, so I really believe there is a problem with the last commit where the mongo install was changed.
I'll try to use the 3.4 and tell you how it went.
just tested. Mongo version is not related.
I'm going through the inti_database.py file to see if I can't force cast everything to correct unicode format before it tries to insert into the database. I'll let you know if I come up with a work around.
On Sat, Apr 1, 2017 at 11:58 AM, Guido Galego notifications@github.com wrote:
just tested. Mongo version is not related.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/threatstream/mhn/issues/383#issuecomment-290929007, or mute the thread https://github.com/notifications/unsubscribe-auth/AIORHW0LdJXFi3mmSfl5u96t6vjXfLFxks5rrnQpgaJpZM4MwdB8 .
ok, that's a good idea. I have forced to unicode mode on the locale so that it isn't picking weird stuff like ascii, but yeah nothing. also just tried on centos 6.7, exactly the same error.
Also have this error appeared in my latest ansible role travis role for some unrelated change... https://travis-ci.org/juju4/ansible-mhn/builds/217658632
Not sure why have utf8 here but that can happen, so let's decode properly inside code. I managed to get it work by changing
ref.text = r
into
ref.text = r.decode('utf-8')
inside /var/_mhn/mhn/server/mhn/api/models.py (or whatever path you use) but instead got at the end of initdatabase
Imported 20500 rules so far...
Imported 21000 rules so far...
Finished Importing 21000 rules. Committing data
Traceback (most recent call last):
File "initdatabase.py", line 5, in <module>
create_clean_db()
File "/var/_mhn/mhn/server/mhn/__init__.py", line 177, in create_clean_db
fetch_sources()
File "/var/_mhn/mhn/env/local/lib/python2.7/site-packages/celery/local.py", line 167, in <lambda>
__call__ = lambda x, *a, **kw: x._get_current_object()(*a, **kw)
File "/var/_mhn/mhn/server/mhn/tasks/__init__.py", line 13, in __call__
return TaskBase.__call__(self, *args, **kwargs)
File "/var/_mhn/mhn/env/local/lib/python2.7/site-packages/celery/app/task.py", line 420, in __call__
return self.run(*args, **kwargs)
File "/var/_mhn/mhn/server/mhn/tasks/rules.py", line 78, in fetch_sources
render_rules()
File "/var/_mhn/mhn/env/local/lib/python2.7/site-packages/celery/local.py", line 167, in <lambda>
__call__ = lambda x, *a, **kw: x._get_current_object()(*a, **kw)
File "/var/_mhn/mhn/server/mhn/tasks/__init__.py", line 13, in __call__
return TaskBase.__call__(self, *args, **kwargs)
File "/var/_mhn/mhn/env/local/lib/python2.7/site-packages/celery/app/task.py", line 420, in __call__
return self.run(*args, **kwargs)
File "/var/_mhn/mhn/server/mhn/tasks/rules.py", line 21, in render_rules
sbuffer = Rule.renderall()
File "/var/_mhn/mhn/server/mhn/api/models.py", line 169, in renderall
return '\n\n'.join([ru.render() for ru in rules])
File "/var/_mhn/mhn/server/mhn/api/models.py", line 153, in render
reference += 'reference:{}; '.format(r.text)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 87: ordinal not in range(128)
Adding urllib.quote_plus()
Imported 7500 rules so far...
Traceback (most recent call last):
File "initdatabase.py", line 5, in <module>
create_clean_db()
File "/var/_mhn/mhn/server/mhn/__init__.py", line 177, in create_clean_db
fetch_sources()
File "/var/_mhn/mhn/env/local/lib/python2.7/site-packages/celery/local.py", line 167, in <lambda>
__call__ = lambda x, *a, **kw: x._get_current_object()(*a, **kw)
File "/var/_mhn/mhn/server/mhn/tasks/__init__.py", line 13, in __call__
return TaskBase.__call__(self, *args, **kwargs)
File "/var/_mhn/mhn/env/local/lib/python2.7/site-packages/celery/app/task.py", line 420, in __call__
return self.run(*args, **kwargs)
File "/var/_mhn/mhn/server/mhn/tasks/rules.py", line 77, in fetch_sources
Rule.bulk_import(rules)
File "/var/_mhn/mhn/server/mhn/api/models.py", line 187, in bulk_import
rule.insert_refs(ru['references'])
File "/var/_mhn/mhn/server/mhn/api/models.py", line 131, in insert_refs
ref.text = urllib.quote_plus(r.decode('utf-8'))
File "/usr/lib/python2.7/urllib.py", line 1295, in quote_plus
return quote(s, safe)
File "/usr/lib/python2.7/urllib.py", line 1288, in quote
return ''.join(map(quoter, s))
KeyError: u'\u2019'
what next?
Great FIND from you!! HATS OFF!!!
to complete add what you found ref.text = r.decode('utf-8')
and also on the script begin add:
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
result:
gg@dev-ubnt-14-04:/opt/mhn$ sudo supervisorctl status
geoloc RUNNING pid 31888, uptime 0:12:11
honeymap RUNNING pid 31889, uptime 0:12:11
hpfeeds-broker RUNNING pid 12441, uptime 0:13:35
mhn-celery-beat RUNNING pid 23035, uptime 0:02:21
mhn-celery-worker RUNNING pid 23115, uptime 0:02:05
mhn-collector RUNNING pid 23037, uptime 0:02:21
mhn-uwsgi RUNNING pid 23039, uptime 0:02:21
mnemosyne RUNNING pid 30788, uptime 0:12:31
gg@dev-ubnt-14-04:/opt/mhn$ ls server/mhn/static/
css dionaea.conf hpfeeds.py ihandlers.py img js mhn.rules registration.txt
Godd stuff. THANKS!!!
considering this is a fix... if you run ELK, you'll notice that:
{:timestamp=>"2017-04-03T02:34:40.644000+0200", :message=>"You are using a deprecated config setting \"index_type\" set in elasticsearch. Deprecated settings will continue to work, but are scheduled for removal from logstash in the future. Please use the 'document_type' setting instead. It has the same effect, but is more appropriately named. If you have any questions about this, please visit the #logstash channel on freenode irc.", :name=>"index_type", :plugin=><LogStash::Outputs::ElasticSearch host=>"127.0.0.1", port=>9200, protocol=>"http", index=>"mhn-%{+YYYYMMddHH00}", index_type=>"event", template_name=>"mhn_event", template=>"/opt/logstash/mhn-template.json", template_overwrite=>"true", manage_template=>"true">, :level=>:warn}
{:timestamp=>"2017-04-03T02:34:40.890000+0200", :message=>"No SINCEDB_DIR or HOME environment variable set, I don't know where to keep track of the files I'm watching. Either set HOME or SINCEDB_DIR in your environment, or set sincedb_path in in your Logstash config for the file input with path '[\"/var/log/mhn/mhn-json.log\"]'", :level=>:error}
The error reported is:
the deprecated error about index_type
is no problem.
just add sincedb_path => "/opt/logstash/sincedb"
on /opt/logstash/mhn.conf
to fix it.
EG. default:
input {
file {
path => "/var/log/mhn/mhn-json.log"
start_position => "end"
}
after fix:
input {
file {
path => "/var/log/mhn/mhn-json.log"
start_position => "end"
sincedb_path => "/opt/logstash/sincedb"
}
After editing the r.text entry in models.py as described above, I get through the rules import (20990 rules ), it moves into "rendering rules" but then fails, last line of traceback with error: UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 87: ordinal not in range(128)
to bypass u'\u2019' encoding issues you'd have to add
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
on models.py beginning.
Hello, sorry to open an issue.
When installing MHN on UBUNTU 14.4 or 16.4 I always end up with this stack trace:
I look at mongo and it seems fine
This is on 16.04 and happens right after
Imported 7500 rules so far...
anyone experiencing it?
thanks!
cheers, Guido.