-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OpenCTI Connector Charms #3
Changes from 68 commits
07170cf
11dbfc8
4f210cf
1dbcebf
a948dcb
e990cd3
3632067
22077d2
676b9a0
dc9ce01
d1c0c05
38db050
8a1264b
0caebdc
020665a
336b84c
702add8
1f2b5c5
403aa75
4dbc03a
e494868
875e116
9387460
61e7daa
89e1c49
c13a476
e5c0518
ab0eb50
88ae9c1
a781a43
92d83ef
83203ef
8063053
baa8794
09ddd12
54ad996
c5bb243
fc961a0
0c77534
a8ab93c
ecbc738
8e15609
e8be78f
5676858
758231a
06bce03
6d95cc3
f99ae13
3fd81c1
f5e2459
d0fba99
d726821
5a6e508
3de4d69
5eb4d6c
b4ab9cd
6a3efdb
fc7a38d
aeb5724
41153f6
980ba73
d97b412
397d070
02b05d7
de0619d
7b19242
635b74e
2011fac
2baabee
32c6c1d
63ea921
568084a
b9d58ab
630894c
4cd5b01
31bae7c
dc90606
65df516
2e5d8a1
69f953a
8050ec7
52caf97
0f11219
d06c74f
f9a26aa
8903c1e
e3eb510
c110a56
a65d5c1
f98e9ef
f9bbd2e
3862ed9
2902463
bf51888
0f2d1ad
0e41229
ccd2f3d
8f49061
020e8ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ __pycache__/ | |
.vscode | ||
.mypy_cache | ||
*.egg-info/ | ||
*/*.rock | ||
*.rock |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# cross-spawn (package.json) | ||
CVE-2024-21538 | ||
# esbuild | ||
CVE-2024-24790 | ||
CVE-2023-45288 | ||
CVE-2024-34156 | ||
# pebble | ||
CVE-2024-45338 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ignore_files: | ||
- lib/charms/redis_k8s/v0/redis.py | ||
- connectors/** | ||
- scripts/** | ||
- tests/unit/test_connectors.py |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,100 @@ | ||
# Copyright 2024 Canonical Ltd. | ||
# Copyright 2025 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
# This file configures Charmcraft. | ||
# See https://juju.is/docs/sdk/charmcraft-config for guidance. | ||
|
||
name: opencti | ||
title: OpenCTI Charm | ||
summary: OpenCTI charm. | ||
links: | ||
documentation: https://github.com/canonical/opencti-operator/blob/main/README.md | ||
issues: https://github.com/canonical/opencti-operator/issues | ||
source: https://github.com/canonical/opencti-operator | ||
contact: https://launchpad.net/~canonical-is-devops | ||
|
||
description: | | ||
A [Juju](https://juju.is/) [charm](https://juju.is/docs/olm/charmed-operators) | ||
for deploying and managing the [OpenCTI](https://filigran.io/solutions/open-cti/) | ||
open-source threat intelligence platform in your systems. | ||
|
||
This charm simplifies the configuration and maintenance of OpenCTI across a | ||
range of environments, organize your cyber threat intelligence to enhance | ||
and disseminate actionable insights. | ||
|
||
config: | ||
options: | ||
admin-user: | ||
type: string | ||
description: | | ||
OpenCTI admin user email and password. | ||
The content of this configuration should be a Juju user secret ID. | ||
The Juju user secret should contain two fields, `email` and `password`, | ||
where `email` is the admin user email, and `password` is the admin user password. | ||
Use the following commands to create a Juju user secret for this configuration: | ||
`juju add-secret opencti-admin-user email=admin@example.com password#file=/path/to/password.txt` | ||
`juju grant-secret opencti-admin-user opencti` | ||
|
||
requires: | ||
opensearch-client: | ||
interface: opensearch_client | ||
optional: false | ||
limit: 1 | ||
redis: | ||
interface: redis | ||
optional: false | ||
limit: 1 | ||
amqp: | ||
interface: rabbitmq | ||
optional: false | ||
limit: 1 | ||
s3: | ||
interface: s3 | ||
optional: false | ||
limit: 1 | ||
ingress: | ||
interface: ingress | ||
optional: false | ||
limit: 1 | ||
opencti-connector: | ||
interface: opencti_connector | ||
logging: | ||
interface: loki_push_api | ||
optional: true | ||
|
||
provides: | ||
metrics-endpoint: | ||
interface: prometheus_scrape | ||
optional: true | ||
grafana-dashboard: | ||
interface: grafana_dashboard | ||
optional: true | ||
|
||
peers: | ||
opencti-peer: | ||
interface: opencti_peer | ||
|
||
type: charm | ||
bases: | ||
- build-on: | ||
- name: ubuntu | ||
channel: "22.04" | ||
run-on: | ||
- name: ubuntu | ||
channel: "22.04" | ||
base: ubuntu@24.04 | ||
build-base: ubuntu@24.04 | ||
platforms: | ||
amd64: | ||
parts: | ||
charm: | ||
build-snaps: | ||
- rustup | ||
override-build: | | ||
rustup default stable | ||
craftctl default | ||
build-packages: | ||
- libffi-dev | ||
- libssl-dev | ||
- pkg-config | ||
|
||
containers: | ||
opencti: | ||
resource: opencti-image | ||
resources: | ||
opencti-image: | ||
type: oci-image | ||
description: OCI image for the OpenCTI platform/worker. | ||
|
||
assumes: | ||
- juju >= 3.4 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright 2025 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
name: opencti-{{ name }}-connector | ||
title: OpenCTI {{ display_name_short }} Charm | ||
summary: OpenCTI {{ display_name }} charm. | ||
links: | ||
documentation: https://discourse.charmhub.io | ||
issues: https://github.com/canonical/opencti-operator/issues | ||
source: https://github.com/canonical/opencti-operator | ||
contact: https://launchpad.net/~canonical-is-devops | ||
|
||
description: | | ||
A [Juju](https://juju.is/) [charm](https://juju.is/docs/olm/charmed-operators) | ||
for deploying and managing the [OpenCTI Connectors](https://docs.opencti.io/latest/deployment/connectors/) | ||
for the OpenCTI charm. | ||
|
||
This charm simplifies the configuration and maintenance of OpenCTI Connectors | ||
across a range of environments, organize your cyber threat intelligence to | ||
enhance and disseminate actionable insights. | ||
|
||
{{ config | safe }} | ||
|
||
provides: | ||
opencti-connector: | ||
interface: opencti_connector | ||
limit: 1 | ||
|
||
type: charm | ||
base: ubuntu@24.04 | ||
build-base: ubuntu@24.04 | ||
platforms: | ||
amd64: | ||
parts: | ||
charm: {} | ||
|
||
containers: | ||
opencti-{{ name }}-connector: | ||
resource: opencti-{{ name }}-connector-image | ||
resources: | ||
opencti-{{ name }}-connector-image: | ||
type: oci-image | ||
description: OCI image for the OpenCTI {{ display_name }} connector. | ||
|
||
assumes: | ||
- juju >= 3.4 |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing newline at the end of the file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update the Jinja2 template to retain the trailing newline, thanks! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ops |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2025 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
name: opencti-{{ name }}-connector | ||
base: ubuntu@24.04 | ||
version: &version '{{ version }}' | ||
summary: OpenCTI {{ display_name }} Connector | ||
description: >- | ||
OpenCTI connectors are the cornerstone of the OpenCTI platform and | ||
allow organizations to easily ingest, enrich or export data. | ||
platforms: | ||
amd64: | ||
|
||
parts: | ||
{{ name }}-connector: | ||
source: https://github.com/OpenCTI-Platform/connectors.git | ||
source-type: git | ||
source-tag: *version | ||
source-depth: 1 | ||
plugin: nil | ||
build-packages: | ||
- python3-pip | ||
stage-packages: | ||
- python3-dev | ||
weiiwang01 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- libmagic1 | ||
- libffi-dev | ||
weiiwang01 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
override-build: | | ||
craftctl default | ||
ls -lah | ||
weiiwang01 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mkdir -p $CRAFT_PART_INSTALL/opt | ||
cd {{ constant_to_kebab(connector_type) }}/{{ connector_name }} | ||
cp -rp src $CRAFT_PART_INSTALL/opt/{{ install_location }} | ||
{{ generate_entrypoint }} | ||
cat entrypoint.sh | grep {{ install_location }} | ||
mkdir -p $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages | ||
pip install \ | ||
--target $CRAFT_PART_INSTALL/usr/local/lib/python3.12/dist-packages \ | ||
-r $(find -name requirements.txt) | ||
cp entrypoint.sh $CRAFT_PART_INSTALL/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright 2025 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
"""OpenCTI {{ display_name }} connector charm the service.""" | ||
|
||
import pathlib | ||
|
||
import ops | ||
|
||
from charms.opencti.v0.opencti_connector import OpenctiConnectorCharm | ||
|
||
|
||
class Opencti{{ kebab_to_pascal(name) }}ConnectorCharm(OpenctiConnectorCharm): | ||
connector_type = "{{ connector_type }}" | ||
|
||
@property | ||
def charm_dir(self) -> pathlib.Path: | ||
return pathlib.Path(__file__).parent.parent.absolute() | ||
|
||
{{ charm_override | safe | indent(4) }} | ||
|
||
if __name__ == "__main__": | ||
ops.main(Opencti{{ kebab_to_pascal(name) }}ConnectorCharm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think our team should be using the edge self hosted runners.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think I will continue using the GitHub-hosted runner during rapid development to speed up iteration. I will switch to self-hosted runners once the project becomes more stable.