Giter Site home page Giter Site logo

Comments (16)

FloatingGhost avatar FloatingGhost commented on June 17, 2024
sudo pip3 install "mysqlclient>=1.3.9"

try running that :)

from misp-taxii-server.

MrRedPushTRedButton avatar MrRedPushTRedButton commented on June 17, 2024

That helped, I was stumped on that one.
Thank you!

However, I seem to have run into another issue when running the script:

root@POM-MISP:/var/www/MISP/MISP-Taxii-Server/scripts# push_published_to_taxii.py
INFO:main:Subscribing to tcp://127.0.0.1:50000
Traceback (most recent call last):
File "/usr/local/bin/push_published_to_taxii.py", line 4, in
import('pkg_resources').run_script('misp-taxii-hooks==0.2', 'push_published_to_taxii.py')
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 719, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1511, in run_script
exec(script_code, namespace, namespace)
File "/usr/local/lib/python3.5/dist-packages/misp_taxii_hooks-0.2-py3.5.egg/EGG-INFO/scripts/push_published_to_taxii.py", line 42, in
KeyError: 'taxii'

I haven't edited the default script, so I am not sure why python would be throwing this key error.

from misp-taxii-server.

FloatingGhost avatar FloatingGhost commented on June 17, 2024

:P

this tells me that you didn't follow the install instructions and are running without the OPENTAXII_CONFIG env variable

please read README.md in regard to how to set it.

from misp-taxii-server.

MrRedPushTRedButton avatar MrRedPushTRedButton commented on June 17, 2024

Thanks for the reply.

I must have missed that in the setup.
I appreciate it.

from misp-taxii-server.

MrRedPushTRedButton avatar MrRedPushTRedButton commented on June 17, 2024

Okay,

So I looked into this further and due to the variable not being permanent, I figured it was set when I continued on last time. When the variable is not set, I run into the issue I received last time.

When the variable is set, the error I receive is below:

root@POM-MISP:/var/www/MISP/MISP-Taxii-Server/config# opentaxii-create-services -c services.yaml
Traceback (most recent call last):
File "/usr/local/bin/opentaxii-create-services", line 9, in
load_entry_point('opentaxii==0.1.9a1', 'console_scripts', 'opentaxii-create-services')()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2569, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2229, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2235, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/lib/python3.5/dist-packages/opentaxii-0.1.9a1-py3.5.egg/opentaxii/cli/init.py", line 7, in
config = ServerConfig()
File "/usr/local/lib/python3.5/dist-packages/opentaxii-0.1.9a1-py3.5.egg/opentaxii/config.py", line 38, in init
ignore_missing=False, ac_merge=anyconfig.MS_REPLACE)
File "/usr/local/lib/python3.5/dist-packages/anyconfig-0.5.0-py3.5.egg/anyconfig/api.py", line 298, in load
**options)
File "/usr/local/lib/python3.5/dist-packages/anyconfig-0.5.0-py3.5.egg/anyconfig/api.py", line 267, in multi_load
ac_template=ac_template, ac_context=cnf, **opts)
File "/usr/local/lib/python3.5/dist-packages/anyconfig-0.5.0-py3.5.egg/anyconfig/api.py", line 200, in single_load
cnf = psr.load(path_or_stream, **options)
File "/usr/local/lib/python3.5/dist-packages/anyconfig-0.5.0-py3.5.egg/anyconfig/backend/base.py", line 224, in load
cnf = self.load_from_path(path_or_stream, to_container, **options)
File "/usr/local/lib/python3.5/dist-packages/anyconfig-0.5.0-py3.5.egg/anyconfig/backend/base.py", line 363, in load_from_path
**kwargs)
File "/usr/local/lib/python3.5/dist-packages/anyconfig-0.5.0-py3.5.egg/anyconfig/backend/base.py", line 77, in wrapper
return func(*args[1:], **kwargs)
File "/usr/local/lib/python3.5/dist-packages/anyconfig-0.5.0-py3.5.egg/anyconfig/backend/yaml.py", line 54, in _yml_load
return to_container(_yml_fnc("load", stream, **kwargs))
File "/usr/local/lib/python3.5/dist-packages/anyconfig-0.5.0-py3.5.egg/anyconfig/backend/yaml.py", line 43, in _yml_fnc
return fnc(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/yaml/init.py", line 72, in load
return loader.get_single_data()
File "/usr/local/lib/python3.5/dist-packages/yaml/constructor.py", line 35, in get_single_data
node = self.get_single_node()
File "/usr/local/lib/python3.5/dist-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/usr/local/lib/python3.5/dist-packages/yaml/composer.py", line 55, in compose_document
node = self.compose_node(None, None)
File "/usr/local/lib/python3.5/dist-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/usr/local/lib/python3.5/dist-packages/yaml/composer.py", line 133, in compose_mapping_node
item_value = self.compose_node(node, item_key)
File "/usr/local/lib/python3.5/dist-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/usr/local/lib/python3.5/dist-packages/yaml/composer.py", line 127, in compose_mapping_node
while not self.check_event(MappingEndEvent):
File "/usr/local/lib/python3.5/dist-packages/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
File "/usr/local/lib/python3.5/dist-packages/yaml/parser.py", line 428, in parse_block_mapping_key
if self.check_token(KeyToken):
File "/usr/local/lib/python3.5/dist-packages/yaml/scanner.py", line 116, in check_token
self.fetch_more_tokens()
File "/usr/local/lib/python3.5/dist-packages/yaml/scanner.py", line 220, in fetch_more_tokens
return self.fetch_value()
File "/usr/local/lib/python3.5/dist-packages/yaml/scanner.py", line 576, in fetch_value
self.get_mark())
yaml.scanner.ScannerError: mapping values are not allowed here
in "/var/www/MISP/MISP-Taxii-Server/config/config.yaml", line 14, column 18

This points to a colon in the config.yaml and I don't believe that it has anything to do with the colon itself. I checked to be sure my databases were setup correctly and that I can access them from mysql user.

from misp-taxii-server.

FloatingGhost avatar FloatingGhost commented on June 17, 2024

mapping values are not allowed here

sounds like you have an invalid YAML!

Throw it through this http://www.yamllint.com/

from misp-taxii-server.

MrRedPushTRedButton avatar MrRedPushTRedButton commented on June 17, 2024

Thank you for that. It helped fix the yaml.scanner.ScannerError. I believe the issue was a spacing problem. The config file now looks like this:

domain: "localhost:9000"
support_basic_auth: yes

persistence_api:
class: opentaxii.persistence.sqldb.SQLDatabaseAPI
parameters:
db_connection: mysql://taxii:myownpassword@localhost/taxiipersist
create_tables: yes

auth_api:
class: opentaxii.auth.sqldb.SQLDatabaseAPI
parameters: secret
db_connection: mysql://taxii:myownpassword@localhost/taxiiauth
create_tables: yes
secret: secret

logging:
opentaxii: info
root: info

hooks: misp_taxii_hooks.hooks

Sample configuration for misp_taxii_server

zmq:
host: localhost
port: 50000

misp:
url: "http://localhost"
api: KEY

However, after the spacing issue, I am now receiving a different error:

root@POM-MISP:/var/www/MISP/MISP-Taxii-Server/config# opentaxii-create-services -c services.yaml
Traceback (most recent call last):
File "/usr/local/bin/opentaxii-create-services", line 9, in
load_entry_point('opentaxii==0.1.9a1', 'console_scripts', 'opentaxii-create-services')()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2569, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2229, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2235, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/lib/python3.5/dist-packages/opentaxii-0.1.9a1-py3.5.egg/opentaxii/cli/init.py", line 10, in
server = TAXIIServer(config)
File "/usr/local/lib/python3.5/dist-packages/opentaxii-0.1.9a1-py3.5.egg/opentaxii/server.py", line 38, in init
server=self, api=initialize_api(config['persistence_api']))
File "/usr/local/lib/python3.5/dist-packages/opentaxii-0.1.9a1-py3.5.egg/opentaxii/utils.py", line 38, in initialize_api
instance = cls()
TypeError: init() missing 1 required positional argument: 'db_connection'

from misp-taxii-server.

FloatingGhost avatar FloatingGhost commented on June 17, 2024

please wrap your Yaml dumps in backticks (```) to preserve spacing - spacing is very important in yaml
like
```
key: value
```

it'll become

key: value

which helps a lot.

I cannot replicate the error with the default configuration - can you post your services.yaml?

from misp-taxii-server.

MrRedPushTRedButton avatar MrRedPushTRedButton commented on June 17, 2024

Thanks.

Sure, I have not changed the file of services.yaml at all.


  • id: inbox
    type: inbox
    address: /services/inbox
    description: Inbox Service
    destination_collection_required: yes
    accept_all_content: no
    authentication_required: yes
    supported_content:

    • urn:stix.mitre.org:xml:1.1.1
    • urn:stix.mitre.org:xml:1.2
      protocol_bindings:
    • urn:taxii.mitre.org:protocol:http:1.0
    • urn:taxii.mitre.org:protocol:https:1.0
  • id: discovery
    type: discovery
    address: /services/discovery
    description: Discovery Service
    advertised_services:

    • inbox
    • discovery
    • collection_management
    • poll
      protocol_bindings:
    • urn:taxii.mitre.org:protocol:http:1.0
    • urn:taxii.mitre.org:protocol:https:1.0
  • id: collection_management
    type: collection_management
    address: /services/collection-management
    description: Collection Management Service
    protocol_bindings:

    • urn:taxii.mitre.org:protocol:http:1.0
    • urn:taxii.mitre.org:protocol:https:1.0
  • id: poll
    type: poll
    address: /services/poll
    description: Poll Service
    subscription_required: no
    max_result_count: 100
    max_result_size: 10
    authentication_required: yes
    protocol_bindings:

    • urn:taxii.mitre.org:protocol:http:1.0

from misp-taxii-server.

FloatingGhost avatar FloatingGhost commented on June 17, 2024

BACKTICKS

from misp-taxii-server.

MrRedPushTRedButton avatar MrRedPushTRedButton commented on June 17, 2024

Okay, I will be sure to use the BackTicks. Thank you.

from misp-taxii-server.

FloatingGhost avatar FloatingGhost commented on June 17, 2024

api=initialize_api(config['persistence_api']))

this implies that it can't find the persistence_api key in your config.

Which implies to me that you're running without OPENTAXII_CONFIG set again

from misp-taxii-server.

FloatingGhost avatar FloatingGhost commented on June 17, 2024

just for you I've forked OpenTAXII to shout if you haven't set the config

Run

git pull
git submodule update
cd OpenTAXII
sudo python3 setup.py install
cd ..

and have at it

from misp-taxii-server.

MrRedPushTRedButton avatar MrRedPushTRedButton commented on June 17, 2024

Thank you so much. For all your help. It is greatly appreciated.

from misp-taxii-server.

MrRedPushTRedButton avatar MrRedPushTRedButton commented on June 17, 2024

After working on this more, I have set the config file and now I seem to be running into the same issue again when it wasn't set.

my config is set to : OPENTAXII_CONFIG=/var/www/MISP/MISP-Taxii-Server/config/config.yaml

Everything seems to work fine, until I run the scripts/push _published_to_taxii.py

I get the error below:

root@ubuntu:/var/www/MISP/MISP-Taxii-Server/scripts# push_published_to_taxii.py
INFO:main:Subscribing to tcp://localhost:50000
Traceback (most recent call last):
File "/usr/local/bin/push_published_to_taxii.py", line 4, in
import('pkg_resources').run_script('misp-taxii-hooks==0.2', 'push_published_to_taxii.py')
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 719, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1511, in run_script
exec(script_code, namespace, namespace)
File "/usr/local/lib/python3.5/dist-packages/misp_taxii_hooks-0.2-py3.5.egg/EGG-INFO/scripts/push_published_to_taxii.py", line 42, in
KeyError: 'taxii'

from misp-taxii-server.

FloatingGhost avatar FloatingGhost commented on June 17, 2024

see: config.travis.yaml

copy config from there.

from misp-taxii-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.