From ecbc73867d3f25799319e2aa8be3718aad76a5a2 Mon Sep 17 00:00:00 2001 From: Weii Wang Date: Thu, 19 Dec 2024 20:24:13 +0800 Subject: [PATCH] Fix rockcraft.yaml --- connector-template/rock/rockcraft.yaml.j2 | 1 + connectors/abuseipdb_ipblacklist/rock/rockcraft.yaml | 1 + connectors/alienvault/rock/rockcraft.yaml | 1 + connectors/crowdstrike/rock/rockcraft.yaml | 1 + connectors/export_file_csv/rock/rockcraft.yaml | 1 + connectors/export_file_stix/rock/rockcraft.yaml | 1 + connectors/export_file_txt/rock/rockcraft.yaml | 1 + connectors/import_document/rock/rockcraft.yaml | 1 + connectors/import_file_stix/rock/rockcraft.yaml | 1 + connectors/misp_feed/rock/rockcraft.yaml | 1 + connectors/mitre/rock/rockcraft.yaml | 1 + connectors/sekoia/rock/rockcraft.yaml | 1 + connectors/urlscan/rock/rockcraft.yaml | 1 + connectors/urlscan_enrichment/rock/rockcraft.yaml | 1 + connectors/vxvault/rock/rockcraft.yaml | 1 + scripts/gen_connector_charm.py | 3 +++ 16 files changed, 18 insertions(+) diff --git a/connector-template/rock/rockcraft.yaml.j2 b/connector-template/rock/rockcraft.yaml.j2 index fc0c918..1239971 100644 --- a/connector-template/rock/rockcraft.yaml.j2 +++ b/connector-template/rock/rockcraft.yaml.j2 @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd {{ constant_to_kebab(connector_type) }}/{{ connector_name }} cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-{{ connector_name }} + {{ generate_entrypoint }} cat entrypoint.sh | grep opencti-connector-{{ connector_name }} mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/abuseipdb_ipblacklist/rock/rockcraft.yaml b/connectors/abuseipdb_ipblacklist/rock/rockcraft.yaml index 9beaf64..3ec91de 100644 --- a/connectors/abuseipdb_ipblacklist/rock/rockcraft.yaml +++ b/connectors/abuseipdb_ipblacklist/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd external-import/abuseipdb-ipblacklist cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-abuseipdb-ipblacklist + cat entrypoint.sh | grep opencti-connector-abuseipdb-ipblacklist mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/alienvault/rock/rockcraft.yaml b/connectors/alienvault/rock/rockcraft.yaml index e734787..69612d6 100644 --- a/connectors/alienvault/rock/rockcraft.yaml +++ b/connectors/alienvault/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd external-import/alienvault cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-alienvault + cat entrypoint.sh | grep opencti-connector-alienvault mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/crowdstrike/rock/rockcraft.yaml b/connectors/crowdstrike/rock/rockcraft.yaml index c210a4b..6a62a3c 100644 --- a/connectors/crowdstrike/rock/rockcraft.yaml +++ b/connectors/crowdstrike/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd external-import/crowdstrike cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-crowdstrike + cat entrypoint.sh | grep opencti-connector-crowdstrike mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/export_file_csv/rock/rockcraft.yaml b/connectors/export_file_csv/rock/rockcraft.yaml index 6626830..e5e39c8 100644 --- a/connectors/export_file_csv/rock/rockcraft.yaml +++ b/connectors/export_file_csv/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd internal-export-file/export-file-csv cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-export-file-csv + cat entrypoint.sh | grep opencti-connector-export-file-csv mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/export_file_stix/rock/rockcraft.yaml b/connectors/export_file_stix/rock/rockcraft.yaml index 942ce2c..706135e 100644 --- a/connectors/export_file_stix/rock/rockcraft.yaml +++ b/connectors/export_file_stix/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd internal-export-file/export-file-stix cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-export-file-stix + cat entrypoint.sh | grep opencti-connector-export-file-stix mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/export_file_txt/rock/rockcraft.yaml b/connectors/export_file_txt/rock/rockcraft.yaml index 0050553..14b4935 100644 --- a/connectors/export_file_txt/rock/rockcraft.yaml +++ b/connectors/export_file_txt/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd internal-export-file/export-file-txt cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-export-file-txt + cat entrypoint.sh | grep opencti-connector-export-file-txt mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/import_document/rock/rockcraft.yaml b/connectors/import_document/rock/rockcraft.yaml index 58d8147..00df015 100644 --- a/connectors/import_document/rock/rockcraft.yaml +++ b/connectors/import_document/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd internal-import-file/import-document cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-import-document + cat entrypoint.sh | grep opencti-connector-import-document mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/import_file_stix/rock/rockcraft.yaml b/connectors/import_file_stix/rock/rockcraft.yaml index 5af976b..4bbddaa 100644 --- a/connectors/import_file_stix/rock/rockcraft.yaml +++ b/connectors/import_file_stix/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd internal-import-file/import-file-stix cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-import-file-stix + cat entrypoint.sh | grep opencti-connector-import-file-stix mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/misp_feed/rock/rockcraft.yaml b/connectors/misp_feed/rock/rockcraft.yaml index 9780d46..2b172a8 100644 --- a/connectors/misp_feed/rock/rockcraft.yaml +++ b/connectors/misp_feed/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd external-import/misp-feed cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-misp-feed + cat entrypoint.sh | grep opencti-connector-misp-feed mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/mitre/rock/rockcraft.yaml b/connectors/mitre/rock/rockcraft.yaml index 31ef4eb..82a8c0b 100644 --- a/connectors/mitre/rock/rockcraft.yaml +++ b/connectors/mitre/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd external-import/mitre cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-mitre + cat entrypoint.sh | grep opencti-connector-mitre mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/sekoia/rock/rockcraft.yaml b/connectors/sekoia/rock/rockcraft.yaml index 3a2f56d..c885b67 100644 --- a/connectors/sekoia/rock/rockcraft.yaml +++ b/connectors/sekoia/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd external-import/sekoia cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-sekoia + echo 'cd /opt/opencti-connector-sekoia; python3 sekoia.py' > entrypoint.sh cat entrypoint.sh | grep opencti-connector-sekoia mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/urlscan/rock/rockcraft.yaml b/connectors/urlscan/rock/rockcraft.yaml index 7d000d0..5aaf58e 100644 --- a/connectors/urlscan/rock/rockcraft.yaml +++ b/connectors/urlscan/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd external-import/urlscan cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-urlscan + cat entrypoint.sh | grep opencti-connector-urlscan mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/urlscan_enrichment/rock/rockcraft.yaml b/connectors/urlscan_enrichment/rock/rockcraft.yaml index bf15e7d..7652f46 100644 --- a/connectors/urlscan_enrichment/rock/rockcraft.yaml +++ b/connectors/urlscan_enrichment/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd internal-enrichment/urlscan-enrichment cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-urlscan-enrichment + cat entrypoint.sh | grep opencti-connector-urlscan-enrichment mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/connectors/vxvault/rock/rockcraft.yaml b/connectors/vxvault/rock/rockcraft.yaml index c20c87e..d37b2dd 100644 --- a/connectors/vxvault/rock/rockcraft.yaml +++ b/connectors/vxvault/rock/rockcraft.yaml @@ -32,6 +32,7 @@ parts: mkdir -p $CRAFT_PART_INSTALL/opt cd external-import/vxvault cp -rp src $CRAFT_PART_INSTALL/opt/opencti-connector-vxvault + cat entrypoint.sh | grep opencti-connector-vxvault mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages pip install \ diff --git a/scripts/gen_connector_charm.py b/scripts/gen_connector_charm.py index 5f69b3a..98951ac 100644 --- a/scripts/gen_connector_charm.py +++ b/scripts/gen_connector_charm.py @@ -139,6 +139,7 @@ def render_template( display_name, config, charm_override: str = "", + generate_entrypoint: str = "", template_dir: pathlib.Path = pathlib.Path("connector-template"), output_dir: pathlib.Path = pathlib.Path("connectors"), ): @@ -168,6 +169,7 @@ def render_template( {"config": {"options": sort_config(config)}}, width=99999, sort_keys=False ), charm_override=charm_override, + generate_entrypoint=generate_entrypoint, ), encoding="utf-8", ) @@ -229,6 +231,7 @@ def _gen_env(self) -> dict[str, str]: "default": True, }, }, + generate_entrypoint="echo 'cd /opt/opencti-connector-sekoia; python3 sekoia.py' > entrypoint.sh", ) if connector == "" or connector == "all": render_template(