Skip to content

Commit

Permalink
chore: rpc tls is enabled by default
Browse files Browse the repository at this point in the history
Refs: XRDDEV-2839
  • Loading branch information
justasnortal committed Feb 26, 2025
1 parent 20111e1 commit 286d89c
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@
@SpringBootTest(
classes = {ApplicationIpRateLimitTest.TestIpRateLimitController.class},
webEnvironment = SpringBootTest.WebEnvironment.MOCK,
properties = {"xroad.admin-service.rate-limit-requests-per-minute=10", "xroad.admin-service.rate-limit-requests-per-second=5"}
properties = {
"xroad.admin-service.rate-limit-requests-per-minute=10",
"xroad.admin-service.rate-limit-requests-per-second=5",
"xroad.common.rpc.use-tls=false"
}
)
@ComponentScan({"org.niis.xroad.cs.admin.core.config"})
@ActiveProfiles({"test"})
Expand Down
1 change: 1 addition & 0 deletions src/central-server/admin-service/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ dependencies {

implementation(libs.apache.commonsCompress)
implementation(libs.mapstruct)
implementation(project(":common:common-rpc-spring"))

testImplementation(project(":common:common-test"))
testImplementation("org.springframework.boot:spring-boot-starter-test")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import jakarta.servlet.Filter;
import org.niis.xroad.common.api.throttle.IpThrottlingFilter;
import org.niis.xroad.common.rpc.spring.SpringRpcConfig;
import org.niis.xroad.globalconf.spring.SpringGlobalConfConfig;
import org.niis.xroad.restapi.config.AddCorrelationIdFilter;
import org.niis.xroad.restapi.config.AllowedFilesConfig;
Expand All @@ -42,7 +43,8 @@
import org.springframework.core.annotation.Order;

@Import({SpringGlobalConfConfig.class,
SpringSignerClientConfiguration.class})
SpringSignerClientConfiguration.class,
SpringRpcConfig.class})
@Configuration
public class BootstrapConfiguration {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public List<String> customizeCommandParts() {
"-Xmx600m",
"-XX:MaxMetaspaceSize=200m",
"-Dlogging.config=/etc/xroad/conf.d/centralserver-admin-service-logback.xml",
"-Dxroad.common.rpc.use-tls=false",
"-Dxroad.signer.enforce-token-pin-policy=true");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public void beforeStart(@NotNull GenericContainer<?> genericContainer) {
"-Xmx50m",
"-XX:MaxMetaspaceSize=70m",
"-Djava.library.path=/root/lib/",
"-Dxroad.common.rpc.use-tls=false",
enableHwModule ? "-Dxroad.signer.addon.hwtoken.enabled=true" : "",
"-jar",
"/root/app/quarkus-run.jar");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,13 @@
*/
package org.niis.xroad.common.properties.spring;

import org.springframework.context.annotation.Bean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
//@EnableConfigurationProperties({
// SpringCommonGlobalConfProperties.class,
// SpringCommonRpcProperties.class
//})
@EnableConfigurationProperties({
SpringCommonRpcProperties.class
})
public class SpringCommonPropertiesConfiguration {

@Bean
SpringCommonRpcProperties springCommonRpcProperties() {
//TODO hardcoded as spring boot is not present in most modules
return new SpringCommonRpcProperties(false, null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,18 @@

package org.niis.xroad.common.properties.spring;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.niis.xroad.common.properties.CommonRpcProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;


@NoArgsConstructor
@AllArgsConstructor
@Setter
@ConfigurationProperties(prefix = "xroad.common.rpc")
public class SpringCommonRpcProperties implements CommonRpcProperties {

private boolean useTls;
private boolean useTls = Boolean.parseBoolean(DEFAULT_USE_TLS);
private SpringCertificateProvisionProperties certificateProvisioning;

@Override
Expand All @@ -55,9 +52,7 @@ public CertificateProvisionProperties certificateProvisioning() {
}

@Setter
@ConfigurationProperties(prefix = "xroad.common.rpc.certificate-provisioning")
public class SpringCertificateProvisionProperties
implements CertificateProvisionProperties {
static class SpringCertificateProvisionProperties implements CertificateProvisionProperties {

private String issuanceRoleName;
private String commonName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@

@ConfigMapping(prefix = "xroad.common.rpc")
public interface CommonRpcProperties {
String DEFAULT_USE_TLS = "true";

@WithName("use-tls")
@WithDefault("false")
@WithDefault(DEFAULT_USE_TLS)
boolean useTls();

@WithName("certificate-provisioning")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ logging:
xroad:
common:
rpc:
use-tls: false #TODO disabled until all components are ready
certificate-provisioning:
secret-store-pki-path: xrd-pki
issuance-role-name: xrd-rpc-internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void customizeDockerFileBuilder(@NotNull DockerfileBuilder dockerfileBuil
public List<String> customizeCommandParts() {
return List.of(
"-Dxroad.signer.enforce-token-pin-policy=true",
"-Dxroad.common.rpc.use-tls=false",
"-Dspring.cloud.vault.enabled=false");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public String getConfigProfile() {
@Override
public Map<String, String> getConfigOverrides() {
return Map.of(
"quarkus.log.level", "INFO"
"quarkus.log.level", "INFO",
"xroad.common.rpc.use-tls", "false"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public class ConfClientTestProfile implements QuarkusTestProfile {
@Override
public Map<String, String> getConfigOverrides() {
return Map.of(
"quarkus.log.level", "INFO"
"quarkus.log.level", "INFO",
"xroad.common.rpc.use-tls", "false"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public class MonitorTestProfile implements QuarkusTestProfile {
public Map<String, String> getConfigOverrides() {
return Map.of(
"quarkus.log.level", "INFO",
"xroad.common.global-conf.source", "FILESYSTEM"
"xroad.common.global-conf.source", "FILESYSTEM",
"xroad.common.rpc.use-tls", "false"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Map<String, String> getConfigOverrides() {
return Map.of(
"quarkus.log.level", "INFO",
"xroad.common.global-conf.source", "FILESYSTEM",

"xroad.common.rpc.use-tls", "false",
"xroad.proxy.client-proxy.client-http-port", valueOf(findRandomPort()),
"xroad.proxy.client-proxy.client-https-port", valueOf(findRandomPort()),
"xroad.proxy.server.listen-port", valueOf(findRandomPort())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
package org.niis.xroad.signer.application;

import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
import org.junit.jupiter.api.Test;

@QuarkusTest
@TestProfile(SignerTestProfile.class)
class SignerMainTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* The MIT License
*
* Copyright (c) 2019- Nordic Institute for Interoperability Solutions (NIIS)
* Copyright (c) 2018 Estonian Information System Authority (RIA),
* Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK)
* Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

package org.niis.xroad.signer.application;

import io.quarkus.test.junit.QuarkusTestProfile;

import java.util.Map;

public class SignerTestProfile implements QuarkusTestProfile {

@Override
public Map<String, String> getConfigOverrides() {
return Map.of(
"quarkus.log.level", "INFO",
"xroad.common.rpc.use-tls", "false"
);
}

}

0 comments on commit 286d89c

Please sign in to comment.