Skip to content
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

feat(container.provider): added container instance digest enforcement #1

Closed

Conversation

sfiorani
Copy link
Owner

@sfiorani sfiorani commented Mar 18, 2024

⚠️ This PR is just a test pull request for the one that will be opened in future targeting the eclipse kura official repo.

This PR adds the container enforcement digest option to the container instances components. If provided and if the ContainerInstance is enabled, it is used in addition to the ContainerOrchestrationService digest allowlist for monitoring the docker containers run on the device. Some examples of the behaviours when the ContainerInstance is enabled are:

  • If ContainerOrchestrationService enforcement is disable, this option is not considered
  • If ContainerOrchestrationService enforcement is enable with empty allowlist and ContainerInstance digest option is empty, container will be stopped as it tries to be run
  • If ContainerOrchestrationService enforcement is enable with empty allowlist and ContainerInstance digest option is filled with correct digest, the container will be let starting
  • If ContainerOrchestrationService enforcement is enable with correctly filled allowlist and ContainerInstance digest option is empty, the container will be let starting
  • If ContainerOrchestrationService enforcement is enable with correctly filled allowlist and ContainerInstance digest option is filled with correct digest, the container will be let starting
  • If ContainerOrchestrationService enforcement is enable with wrongly filled allowlist and ContainerInstance digest option is filled with wrong digest, container will be stopped as it tries to be run

During Enforcement monitoring, all Container Instances digests options are merged into the Container Orchestration Service Allowlist: this means that if an user tries to run from the CLI a docker container whose digest is equals to one of the enabled Container Instances, it will be let starting.

Each time the Container Instance digest is removed or changed (could be a Container Instances updating, disabling or deleting) the enforcement monitor all the running continer for the digests check. Let's make some examples of possibile situation: let's suppose that a ContainerInstance with digest option DIGEST A was enabled, and now it's disabled, while the monitor is enabled with ContainerOrchestrationService Allowlist filled with DIGEST B. Once the ContainerInstance is disabled, no more Possible situations:

  • A container created from the CLI and running with DIGEST A, will then be stopped due to absence of the DIGEST A from the disabled container instance
  • A container created from the CLI and running with DIGEST B, will be untouched because its digest is still present in the allowlist of the service

Be careful, then, to rely only on the use of the digest set in the container instances options. If you think you need to launch containers from the CLI, it is preferable to use the allowlist of the container orchestration service.

mattdibi and others added 26 commits March 4, 2024 09:32
* fix(distrib): added libudev.so.0 symlink

Signed-off-by: Marcello Martina <[email protected]>

* revert: readded old shebang

Signed-off-by: Marcello Martina <[email protected]>

* refactor: added check for target existence

Signed-off-by: Marcello Martina <[email protected]>

---------

Signed-off-by: Marcello Martina <[email protected]>
…rtificate entry after DNs have been added as column in the table. (eclipse-kura#5165)

Workaround for fix GWT strange behavior when deleting a certificate entry after DNs have been added to the table.
…-kura#5163)

* Added better error message for password never set

* Added japanese message.

* Updated Japanese message
…#5183)

* feat: Limit the UI certificate add to a single PEM cert

Signed-off-by: MMaiero <[email protected]>

* chore: Updated copyright

Signed-off-by: MMaiero <[email protected]>

* feat: added Japanese translations

Signed-off-by: MMaiero <[email protected]>

* fix: Update Messages_ja.properties

---------

Signed-off-by: MMaiero <[email protected]>
eclipse-kura#5179)

* Updated flooding protection metatype

Signed-off-by: pierantoniomerlino <[email protected]>

* Update kura/org.eclipse.kura.network.threat.manager/src/main/java/org/eclipse/kura/internal/floodingprotection/FloodingProtectionOptions.java

Co-authored-by: Matteo Maiero <[email protected]>

* Updated metatype

Signed-off-by: pierantoniomerlino <[email protected]>

---------

Signed-off-by: pierantoniomerlino <[email protected]>
Co-authored-by: Matteo Maiero <[email protected]>
eclipse-kura#5192)

Added additional configuration also on configuration change

Signed-off-by: pierantoniomerlino <[email protected]>
…list (eclipse-kura#5162)

* feat(container.orchestration.provider): added first implementation of enforcement allowlist

Signed-off-by: SimoneFiorani <[email protected]>

* feat(container.orchestration.provider): enforcement allowlist implemented

Signed-off-by: SimoneFiorani <[email protected]>

* feat(container.orchestration.provider): updated copyright and method signature

Signed-off-by: SimoneFiorani <[email protected]>

* feat(container.orchestration.provider): improved implementation, tests added

Signed-off-by: SimoneFiorani <[email protected]>

* feat(container.orchestration.provider): corrected typo in option description

Signed-off-by: SimoneFiorani <[email protected]>

* feat(container.orchestration.provider): fixed indendation

Co-authored-by: Mattia Dal Ben <[email protected]>

* feat(container.orchestration.provider): implemented suggestion and validation of already running containers

Signed-off-by: SimoneFiorani <[email protected]>

* feat(container.orchestration.provider): added tests for monitor-starting phase

Signed-off-by: SimoneFiorani <[email protected]>

* feat(container.orchestration.provider): refactored allowlist monitor class

Signed-off-by: SimoneFiorani <[email protected]>

* fix: typo in log

* style: fix copyright header

* fix: copyright header year

* refactor: refactor with suggestions

Signed-off-by: SimoneFiorani <[email protected]>

* refactor: refactored allowlist enforcement starting

* refactor: added null checks on closing monitor

---------

Signed-off-by: SimoneFiorani <[email protected]>
Co-authored-by: Mattia Dal Ben <[email protected]>
…d code from ContainerOrchestrationServiceImpl (eclipse-kura#5175)

* refactor(ContainerOrchestration): removed deprecated code from ContainerOrchestrationServiceImpl class

Signed-off-by: SimoneFiorani <[email protected]>

* refactor(ContainerOrchestration): removed debug logger

Signed-off-by: SimoneFiorani <[email protected]>

* refactor(ContainerOrchestration): updated tests

Signed-off-by: SimoneFiorani <[email protected]>

* refactor: refactored unit test method name

---------

Signed-off-by: SimoneFiorani <[email protected]>
….eclipse.kura.container.provider.ContainerInstance.xml

Co-authored-by: Mattia Dal Ben <[email protected]>
…n/java/org/eclipse/kura/container/orchestration/provider/impl/enforcement/AllowlistEnforcementMonitor.java

Co-authored-by: Mattia Dal Ben <[email protected]>
@sfiorani
Copy link
Owner Author

sfiorani commented Apr 4, 2024

Closed as it was merged into Eclipse Kura develop

@sfiorani sfiorani closed this Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants