Commit Graph

142 Commits

Author SHA1 Message Date
Avgustin Marinov
016bada08b Fix unused tenant param in AmqpMessageDispatcherService (#2101)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-23 11:15:56 +02:00
Avgustin Marinov
37dea970d2 Fix EventPublisherAuthConfiguration to run as system (#2099)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-22 17:59:25 +02:00
Avgustin Marinov
4de34eacc3 Fix AmqpMessageDispatcherServiceTest.testSendCancelRequest - set action tenant (#2098)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-22 17:36:07 +02:00
Avgustin Marinov
9df68e2d97 Fix DMF context (as system) (#2097)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-22 15:32:00 +02:00
Avgustin Marinov
e41c0efd3d Add postgress docker compose examples + Flyway Modularity Support (#2089)
* added postgress docker compose examples
* move mysql flyway into server (remove from hawkbit-repository-jpa-flyway)
* in starters is added posgress and sqlserver flyway support - see [Flyway Modularity](https://github.com/flyway/flyway/issues/3780)

_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-20 18:08:11 +02:00
Avgustin Marinov
9bce89fcb8 Revert adding mariadb (#2087)
* Revert "Add mariadb-java-client to the server images (#2086)"

This reverts commit 8d3aa7c9ce.

* Revert adding mariadb as runtime dependency - resticted license

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>

---------

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-20 15:52:01 +02:00
Avgustin Marinov
8d3aa7c9ce Add mariadb-java-client to the server images (#2086)
So, they will be ready to connect to mysql

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-20 09:57:36 +02:00
Avgustin Marinov
c3bcc4371d Code formating and removing unused imports (#2072)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-18 09:13:58 +02:00
Avgustin Marinov
7cb617007a Code refactoring of hawkbit-mgmt (#2055)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-17 13:35:51 +02:00
Avgustin Marinov
ca2c50ffa5 Code refactoring of hawkbit-dmf-amqp (#2054)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-16 20:17:13 +02:00
Avgustin Marinov
7902b89268 Unify artifact names (#2021)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-12 15:09:03 +02:00
Avgustin Marinov
5182217745 Rename hawkbit-security-intenal -> hawkbit-security-controller (#2015)
as it is controller only related

* DmfTenantSecurityToken renamed to ControllerSecurityToken - as it is such
* hawkbit.security classes from http-security-internal moved to hawkbit.security.controller - as they are such and it is bad practice to have same package in multiple modules

_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-12 12:45:09 +02:00
Avgustin Marinov
c85518be3c Split SecurityManagedConfiguration to mgmt and ddi starters (#2014)
* SecurityManagedConfiguration is moved to hawkbit-rest-core with commons for mgmt and ddi only
* Configurations for DDI and Management API are moved to respective starters
* hawkbit-http-security is removed - DosFilter (as common) is moved in hawkbit-rest-security, rest to the ddi starter as used only there
* some classes are moved into different packages - it is a bad practice to have same packet into multiple artifacts

_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-12 12:06:56 +02:00
Avgustin Marinov
b03985c887 Rename hawkBit boots (#2010)
* hawkbit-boot-starter -> hawkbit-starter
* hawkbit-boot-starter-ddi-api -> hawkbit-ddi-starter
* hawkbit-boot-starter-dmf-api -> hawkbit-dmf-starter
* hawkbit-boot-starter-mgmt-api -> hawkbit-mgmt-starter

_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-12 08:40:09 +02:00
Avgustin Marinov
baab2fcf95 Move Mgmt artifacts into hawkbit-mgmt (#2003)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-11 15:57:56 +02:00
Avgustin Marinov
05d8d6cc7e Moves DDI artifacts into a dedicated directory/artifact parent (#2002)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-11 15:11:07 +02:00
Avgustin Marinov
25c09a7d39 Move all DMF artifacts in hawkbit-dmf (#2000)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-11 14:22:11 +02:00
Avgustin Marinov
56ff8168f9 Rename org.eclipse.hawkbit.api -> org.eclipse.hawkbit.artifact.repository.urlhandler (#1980)
_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 17:40:27 +02:00
Avgustin Marinov
6dec398cb9 Remove unusied org.eclipse.hawkbit.HawkbitServerProperties (#1979)
_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 17:18:59 +02:00
Avgustin Marinov
56c548e474 Remove unused org.eclipse.hawkbit.api.HostnameResolver (#1978)
_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 17:05:14 +02:00
Avgustin Marinov
bafbc46881 Remove unnecessary slf4j dependency (#1975)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 16:42:42 +02:00
Avgustin Marinov
3975c887ec Remote test dependencies dupplications (#1974)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 16:28:24 +02:00
Avgustin Marinov
3effa996dd Refactor tenancy classes (#1972)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 16:12:18 +02:00
Avgustin Marinov
7a0735c17e Remove AUTHENTICATION_EXCHANGE as unused (#1953)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-06 11:38:52 +02:00
Avgustin Marinov
8d3cc6d59f Fix sonar findings (#1951)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-11-05 16:19:29 +02:00
Avgustin Marinov
7161b8803a Code format hawkbit-dmf (#1938)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-11-05 11:26:09 +02:00
Avgustin Marinov
e18181bd7b Code format hawkbit-dmf-rabbitmq-test (#1937)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-11-05 11:25:09 +02:00
Avgustin Marinov
ec5b797d41 Code format hawkbit-dmf-amqp (#1936)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-11-05 11:24:04 +02:00
Avgustin Marinov
8d78cea9d2 Web env none in tests where not needed (#1871)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-10-04 16:51:10 +03:00
Avgustin Marinov
d958d8e82c Remove download by downloadId functionality (#1820)
This functionallity seems to get via AMQP (after some authentication)
a private (wihtout need of authentication) url to an artifact assigned
to the controller.

By default, DDI or DMF shall provide proper urls (for direct download)
to devices and if they have to be without authentication this shall be
solved in different ways - for instance separate download server providing
dedicated private / signed urls.

This functinallity is not a real hawkBit part but more like something
intended to solve some edge cases.
Since it is complicated, heeds support, doesn't solve wide spread use
cases, and could be achieved with other means - better to be removed.

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-08-14 17:28:46 +03:00
Avgustin Marinov
9e76223a91 [#1580] Software Module & Distribution Set lock: implicit (#1649)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-18 23:01:55 +02:00
Avgustin Marinov
c320a45b55 Refactoring/Improving source: dmf 2 (#1612)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-04 11:46:43 +02:00
Avgustin Marinov
da3a6470ec Refactoring/Improving source: dmf (#1611)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-04 11:05:38 +02:00
Avgustin Marinov
791b87b27b Reduce dependency on Guava 2 (#1590)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-03 00:43:10 +02:00
Avgustin Marinov
ee5e12a300 Test lombok on AmqpProperties (#1585)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-03 00:15:15 +02:00
Avgustin Marinov
bce69676d2 Reduce dependency on Guava (#1589)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-02 22:21:46 +02:00
Avgustin Marinov
537a942021 Made implicit tenant meta data creation configurable (#1575)
In hawkBit up to 0.4.1 it was true - getTenantMetadate created implicitly a tenant metadata.  It was disable in latest commits - but now it is made optional - disabled by default

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-01-30 15:46:39 +02:00
Stanislav Trailov
cbc2185561 Make Amqp Handler service conditional in order to add possibility to be overriden (#1567)
Signed-off-by: TRS1SF3 <Stanislav.Trailov@bosch.io>
2024-01-26 17:41:32 +02:00
charvadzo
49a5509e89 Enable specifying target type when created using DMF API (#1472)
Extension of DMF API with possibility of setting target
type name when creating target. If a target type with the
provided name is found (was created beforehand) then it
is associated with the new target.

Signed-off-by: Ondrej Charvat <ondrej.charvat@proton.me>
2024-01-22 15:01:00 +02:00
charvadzo
af56b71d53 Provide artifact last modified timestamp on DMF API (#1470)
Sets lastModified filed of DmfArtifact DTO according to artifact's last modification timestamp so it is server over DMF.

Signed-off-by: Ondrej Charvat <ondrej.charvat@proton.me>
2024-01-22 10:33:26 +02:00
Avgustin Marinov
7440d90f59 [#1383] Spring Boot 3 migration Step 2 (#1559)
* [#1383] Spring Boot 3 migration Step 2

Some of the steps:

1. Change spring version parent and versions in root pom.xml
2. update eclipselink versions
3. javax.annotation -> jakarta.annotation (*.java)
4. javax.persistence -> jakarta.persistence (*.java)
5. javax.servlet -> jakarta.servlet (*.java, pom.xml)
6. javax.validation:validation-api -> jakarta.validation:jakarta.validation-api (pom.xml)
7. javax.validation -> jakarta.validation (*.java)
8. javax.transaction -> jakarta.transaction (*.java)
9. replace spring-cloud-stream-binder-test (hawkbit-repository-test) with
```
<dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-stream-test-binder</artifactId>
</dependency>
```
, TestSupportBinderAutoConfiguration.class }) -> })
@Import(TestChannelBinderConfiguration.class)
10. Set to Simple UI standard parent
11. requestMatchers to securityMatcher
12. @SpringBootApplication(scanBasePackages = "org.eclipse.hawkbit") (otherwise for instance flyway doesn't work - suffix is default ".sql", not H2.sql and don't differentiate dbs? strange is there a change?)
13. @NonEmpty for Long leads to validation exception - replaced with @NotNull
14. RSQLUtilityTest.correctRsqlBuildsPredicate - fixed - mock query builder add method
15. https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#spring-mvc-and-webflux-url-matching-changes - aliases as targers/ return 404 - remove trailing slash
16. firewall tests (allowedHostNameWithNotAllowedHost) doesn't throw 'rejected exception' but return 400 instead (as probably is expected anyway)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com

* Fix tenant listing to do not mix with multitenancy

Tenant metadata is not multitenancy aware while depend on distribution set type
which is. Thus querying all tenant metadata (in non tenant context) sometimes leads to
resolution of distribution set type which is tenant scoped and leads to problems.

So, now listing tenant lists just their ids - not fill entities.

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

---------

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-01-20 15:57:17 +02:00
Avgustin Marinov
1ae72d4ead Remove WithSpringContextRule (#1505)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-12-07 23:52:23 +02:00
Avgustin Marinov
0021b03c9a CI friendly maven poms - use $revision for version (#1477)
https://maven.apache.org/maven-ci-friendly.html

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-11-16 17:23:01 +02:00
Avgustin Marinov
b982039a74 Feature/ctx aware and access controller2 (#1456)
* Introduce the AccessControlManager and use if for the TargetManagement and TargetTypeManagement.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Extend the access control manager by an API to serialize the current active context and persist it for scheduled background operations like auto-assignment.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Verify modification is permitted before performing automatic assignment

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Start with controlling distribution set type access. Perform some refactoring.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Support distribution set access control. Increase character limit to 512 chars for access control context. Refactor default implementations.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Introduce ContextRunner and define admin execution to check for duplicates before creating/updating entities.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Introduce Software Module, Module Type and Artifact control management. Fix tests.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Introduce access controlling test base. Add first test verifying the read operations for target types.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Finalize target type access controlling test.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Introduce ContextRunnerTest and TargetAccessControllingTest.
Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Introduce DistributionSetAccessControllingTest and fix missing access control specifications.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Extend test cases. Include only updatable targets into rollout.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Fix action visibility.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Modifiable->Updatable & UPDATE check where needed

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* ContextRunner superseded by ContextAware

+ ContextRunner remaned to ContextAware (move as a cenral entry/concept).
  It now extends (and replace) TenantAware
+ SecurityContextTenantAware becomes ContextAware
+ Pluggable serialization mechanism
  (default Java serialization of contexts) for SecurityContextTenantAware
  (using SecurityContextSerializer)
+ AccessControl methods are added to ensure no entities fill be retrieved
  just to call access control - so, if all permitted - no additional db
  queries will be made
+ &lt;repo type&gt;AccessControl classes removed and replaced with
  AccessControl &lt;repo type&gt; generics
+ AccessControlService removed - every AccessControl is registered and
  overiden independently
+ access_control_context in DB increased to 4k (in order to support java
  security context serialization)
+ needed adaptaion of implemtation and tests done

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Refactor SoftModules & DistSets

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Refactoring of the Repositories

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Repostiotory level permissions

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Improvements

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Simplification of AccessControl interface

* Simplifications & management package

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Implementation improvements

+ Artifact management & repo reviewed and tuned
+ Action(Status) management & repo reviewed and tuned
+ SoftwareModule(Type/Meta) management & repo reviewed and tuned
+ DistributionSet(Type/Tag/Meta) management(+Invalidation) & repo reviewed and tuned
+ Target(Tag/Type/Meta) management & repo reviewed and tuned
+ TargetQueryFilter management & repo reviewed and tuned

* Apply suggestions from code review

Suggestions accepted. Thanks @herdt-michael

Co-authored-by: Michael Herdt <michael.herdt@bosch.com>

* Apply suggestions from code review 2

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

---------

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
Co-authored-by: Michael Herdt <Michael.Herdt@bosch.com>
2023-11-16 11:07:06 +02:00
Avgustin Marinov
9c86729a68 [#1393,#1008] Switch to Eclipse v2.0 license (#1427)
Switching license from EPL v1 to v2. Following
https://www.eclipse.org/legal/epl-2.0/faq.php#h.tci84nlsqpgw

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-09-14 11:03:20 +03:00
Avgustin Marinov
acff82f60f Small security improvements (#1412)
Typos fixed

Disables empty string gateway token for sure. Test if the gateway token is not empty string ecplicitly.
Empty string is the default value and if accepted could be a security vulnerability (e.g. enabling gateway token
authentication and using empty string as token). According to https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4
the header value shall not have trailing spaces and the http server shall already have trimmed them. So if execution passes
start with "GatewayToken " then token shall not be empty. But but let's check anyway

In UI first set key then enable the gateway token authentication. Otherwise the key might be left empty (default). This however
shall not be really problem since (because of token trimming) the empty token will be rejected anyway.

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-08-16 14:25:17 +03:00
Avgustin Marinov
56ea5b15c9 [#1383] Spring Boot 3 Migration / Step 1 (#1384)
1. PagingAndSortingRepository doesn't extend CrudRepository anymore. For all extending that interface repositories CrudRepository super interface shall be now declared (https://spring.io/blog/2022/02/22/announcing-listcrudrepository-friends-for-spring-data-3-0 -
```
The popular PagingAndSortingRepository used to extend from CrudRepository, but it no longer does. This lets you combine it
with either CrudRepository or ListCrudRepository or a base interface of your own creation. This means you now have to
explicitly extend from a CRUD fragment, even when you already extend from PagingAndSortingRepository.
```
)
2. org.eclipse.hawkbit.autoconfigure.mgmt.ui -> move in hawkbit-ui (to be ready for removal), anyway - it's a better location for ui related configs
3. extends WebMvcConfigurerAdapter -> implements WebMvcConfigurer
4. remove WebSecurityConfigurerAdapter -> https://docs.spring.io/spring-security/reference/5.8/migration/servlet/config.html#_stop_using_websecurityconfigureradapter, https://spring.io/blog/2022/02/21/spring-security-without-the-websecurityconfigureradapter
and add @Order to the bean reg!!
5. Use configurers (the other will be deprecated / removed), e.d:  http.csrf().disable() -> http.csrf(AbstractHttpConfigurer::disable)
6. configure(final AuthenticationManagerBuilder auth) -> put in httpsecurity config - http.getSharedObject(AuthenticationManagerBuilder.class).... (https://www.baeldung.com/spring-security-authentication-provider)
7. configure(final WebSecurity webSecurity) ->
```
@Bean
public WebSecurityCustomizer webSecurityCustomizer() {
    return (web) -> web.ignoring().antMatchers("/documentation/**", "/VAADIN/**", "/*.*", "/docs/**");
}
```
(https://spring.io/blog/2022/02/21/spring-security-without-the-websecurityconfigureradapter)
8. AuthenticationManager authenticationManagerBean() ->
```
@Bean
AuthenticationManager authenticationManager(final AuthenticationConfiguration authenticationConfiguration) throws Exception {
    return authenticationConfiguration.getAuthenticationManager();
}
```
(https://backendstory.com/spring-security-how-to-replace-websecurityconfigureradapter/)
9. WebMvcAutoConfiguration could be removed - it uses deprectated methods, and sets properties that are same by default - hence - not neeeded
(https://github.com/spring-projects/spring-framework/issues/23915#issuecomment-563987147)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-07-17 10:36:26 +03:00
Melchior Moos
bcc2616e73 Do not retry AMQP messages which violates a quota (#1392) 2023-07-13 14:00:21 +03:00
Stanislav Trailov
1b342001a2 Fix CANCEL_REJECTED dmf behaviour (#1346)
* Fix CANCEL_REJECTED dmf behaviour
* Proper formatting
* Remove unused imports

Signed-off-by: Stanislav Trailov <stanislav.trailov@bosch.io>
2023-04-13 11:13:33 +02:00
Michael Herdt
fbda9764b1 Fix circular rollout dependencies (#1337)
* Do some refactoring to fix dependencies between rollout management, executor and evaluator beans.
* Move rollout retrieving in same transaction as execution.
* Do some refactoring. Extend logging and exception handling.
* Remove unnecessary transactional and validation annotations.
* remove catching never thrown bean
* Fix new rollout handling API
2023-04-03 09:13:00 +02:00