This is an automated email from the ASF dual-hosted git repository. lahirujayathilake pushed a commit to branch ssh-certificates-poc in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
commit bacebe2926276f4ea1bbb0524f2e05f223eca656 Author: lahiruj <[email protected]> AuthorDate: Sun Sep 21 21:01:04 2025 -0400 ssh signer gateway initial implementation --- pom.xml | 2 + signer/pom.xml | 75 ++++++++++++++++++ .../main/assembly/signer-gateway-bin-assembly.xml | 91 ++++++++++++++++++++++ .../custos/signer/SignerGatewayApplication.java | 13 ++++ signer/src/main/resources/application.yml | 50 ++++++++++++ signer/src/main/resources/logback-spring.xml | 56 +++++++++++++ 6 files changed, 287 insertions(+) diff --git a/pom.xml b/pom.xml index 0be83a925..0bffccdb1 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,7 @@ <module>services</module> <module>api</module> <module>application</module> + <module>signer</module> </modules> <dependencyManagement> @@ -205,6 +206,7 @@ <ssh.username>ubuntu</ssh.username> <jakarta.ws.version>4.0.0</jakarta.ws.version> <custos.dist.name>apache-airavata-custos-${project.version}</custos.dist.name> + <signer.dist.name>apache-airavata-custos-signer-${project.version}</signer.dist.name> </properties> <repositories> diff --git a/signer/pom.xml b/signer/pom.xml new file mode 100644 index 000000000..34c2323b8 --- /dev/null +++ b/signer/pom.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.custos</groupId> + <artifactId>custos</artifactId> + <version>1.2-SNAPSHOT</version> + </parent> + + <artifactId>signer-gateway</artifactId> + + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <exclusions> + <exclusion> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-to-slf4j</artifactId> + </exclusion> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>jul-to-slf4j</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jul-to-slf4j</artifactId> + </dependency> + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + </dependency> + <dependency> + <groupId>org.apache.custos</groupId> + <artifactId>custos-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.vault</groupId> + <artifactId>spring-vault-core</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-assembly-plugin</artifactId> + <version>${maven.assembly.plugin}</version> + <executions> + <execution> + <id>signer-distribution-package</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + <configuration> + <tarLongFileMode>posix</tarLongFileMode> + <finalName>${signer.dist.name}</finalName> + <descriptors> + <descriptor>src/main/assembly/signer-gateway-bin-assembly.xml</descriptor> + </descriptors> + <attach>false</attach> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file diff --git a/signer/src/main/assembly/signer-gateway-bin-assembly.xml b/signer/src/main/assembly/signer-gateway-bin-assembly.xml new file mode 100644 index 000000000..c1d74e065 --- /dev/null +++ b/signer/src/main/assembly/signer-gateway-bin-assembly.xml @@ -0,0 +1,91 @@ + +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<!DOCTYPE assembly [ + <!ELEMENT assembly (id|includeBaseDirectory|baseDirectory|formats|fileSets|dependencySets)*> + <!ELEMENT id (#PCDATA)> + <!ELEMENT includeBaseDirectory (#PCDATA)> + <!ELEMENT baseDirectory (#PCDATA)> + <!ELEMENT formats (format)*> + <!ELEMENT format (#PCDATA)> + <!ELEMENT fileSets (fileSet)*> + <!ELEMENT fileSet (directory|outputDirectory|fileMode|includes)*> + <!ELEMENT directory (#PCDATA)> + <!ELEMENT outputDirectory (#PCDATA)> + <!ELEMENT includes (include)*> + <!ELEMENT include (#PCDATA)> + <!ELEMENT dependencySets (dependencySet)*> + <!ELEMENT dependencySet (outputDirectory|outputFileNameMapping|includes)*> + ]> +<assembly> + <id>bin</id> + <includeBaseDirectory>true</includeBaseDirectory> + <baseDirectory>${custos.dist.name}</baseDirectory> + <formats> + <format>tar.gz</format> + <format>zip</format> + </formats> + + <fileSets> + <fileSet> + <directory>src/main/resources/distribution/bin</directory> + <outputDirectory>bin</outputDirectory> + <fileMode>777</fileMode> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>src/main/resources/distribution/conf</directory> + <outputDirectory>conf</outputDirectory> + <includes> + <include>application.yml</include> + <include>truststore.jks</include> + <include>logback-spring.xml</include> + </includes> + </fileSet> + <fileSet> + <directory>./</directory> + <outputDirectory>logs</outputDirectory> + <excludes> + <exclude>*/**</exclude> + </excludes> + </fileSet> + <fileSet> + <directory>target</directory> + <outputDirectory>lib</outputDirectory> + <includes> + <include>*.jar</include> + </includes> + </fileSet> + </fileSets> + + <dependencySets> + <dependencySet> + <useProjectArtifact>false</useProjectArtifact> + <outputDirectory>lib</outputDirectory> + <includes> + <include>*</include> + </includes> + </dependencySet> + </dependencySets> + +</assembly> diff --git a/signer/src/main/java/org/apache/custos/signer/SignerGatewayApplication.java b/signer/src/main/java/org/apache/custos/signer/SignerGatewayApplication.java new file mode 100644 index 000000000..201f0485c --- /dev/null +++ b/signer/src/main/java/org/apache/custos/signer/SignerGatewayApplication.java @@ -0,0 +1,13 @@ +package org.apache.custos.signer; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; + +@SpringBootApplication +@EnableJpaAuditing +public class SignerGatewayApplication { + public static void main(String[] args) { + SpringApplication.run(SignerGatewayApplication.class, args); + } +} diff --git a/signer/src/main/resources/application.yml b/signer/src/main/resources/application.yml new file mode 100644 index 000000000..307d0e883 --- /dev/null +++ b/signer/src/main/resources/application.yml @@ -0,0 +1,50 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +server: + port: 8082 + +spring: + application: + name: custos-signer + datasource: + url: "jdbc:mysql://localhost:3306/custos" + username: admin + password: admin + driver-class-name: com.mysql.cj.jdbc.Driver + jpa: + hibernate: + ddl-auto: update + show-sql: false + database-platform: org.hibernate.dialect.MySQL8Dialect + cloud: + vault: + uri: http://127.0.0.1:8200 + token: 00000000-0000-0000-0000-000000000000 # Update this with your token + ssl: + enabled: false # if self-signed certs, disable for prototype + +logging: + pattern: + level: '%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]' + level: + root: info + +springdoc: + swagger-ui: + title: CUSTOS SIGNER API + oauth: + use-pkce-with-authorization-code-grant: true \ No newline at end of file diff --git a/signer/src/main/resources/logback-spring.xml b/signer/src/main/resources/logback-spring.xml new file mode 100644 index 000000000..8f06b797f --- /dev/null +++ b/signer/src/main/resources/logback-spring.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> + +<configuration> + <include resource="org/springframework/boot/logging/logback/base.xml"/> + <springProperty scope="context" name="appName" source="spring.application.name"/> + <!-- Rolling File Appender --> + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>logs/custos-signer.log</file> + <encoder> + <pattern>%date{YYYY-MM-dd HH:mm:ss.SSS} app=${appName}, host=${HOSTNAME}, traceID=%X{traceId:-NONE}, level=%-5level, [%thread] %logger{36} - %msg%n</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>logs/%d{yyyy-MM}/custos-signer-log-%d{MM-dd-yyyy}-%i.log.gz</fileNamePattern> + <maxFileSize>10MB</maxFileSize> + <!-- number of days to keep the log files --> + <maxHistory>30</maxHistory> + <!-- If the total size of all log files exceeds this value, the oldest files will be removed --> + <totalSizeCap>1GB</totalSizeCap> + </rollingPolicy> + </appender> + + <!-- Asynchronous Rolling File Appender --> + <appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender"> + <appender-ref ref="FILE"/> + <queueSize>500</queueSize> + <discardingThreshold>0</discardingThreshold> + <includeCallerData>true</includeCallerData> + </appender> + + <logger name="org.hibernate" level="ERROR"/> + <logger name="org.springframework" level="INFO"/> + + <root level="INFO"> + <appender-ref ref="ASYNC_FILE"/> + </root> +</configuration>
