Replies: 6 comments 26 replies
-
|
Here is my workaround to enable TLS for MariaDB by directly editing the mosparo sources. SetupController.php $tmpConnection = DriverManager::getConnection([
[...]
'driverOptions' => [
\PDO::MYSQL_ATTR_SSL_KEY => '/certs/client-key.pem',
\PDO::MYSQL_ATTR_SSL_CERT => '/certs/client-cert.pem',
\PDO::MYSQL_ATTR_SSL_CA => '/certs/ca.pem',
\PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => true
]
]);In doctrine.yaml doctrine:
dbal:
[...]
options:
!php/const PDO::MYSQL_ATTR_SSL_KEY: '%env(DATABASE_PRIV_KEY)%'
!php/const PDO::MYSQL_ATTR_SSL_CERT: '%env(DATABASE_PUB_KEY)%'
!php/const PDO::MYSQL_ATTR_SSL_CA: '%env(DATABASE_CA_CERT)%'
!php/const PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT: true |
Beta Was this translation helpful? Give feedback.
-
|
Hi @gnieser
Thank you very much for your kind words! It's incredible to read such feedback!
Thank you very much for bringing these things to our attention and for the workaround. TLS Encrypted Database ConnectionThe easiest thing for us is to add some additional environment variables and a hint in the setup to let users know how to configure the encrypted connection. Adding the required configuration fields is also possible, but it makes the setup more complicated. What do you think? Would the environment variables be enough? Deployment on OpenShiftWhat exactly do you need here? Do you need a different Docker image? Or does such a setup need changes in the code?
Our main goal is to provide software that can be used in every situation and on every host (on a simple shared web host or a cluster of servers). So we're interested in learning more about other setups that we don't know or for which we don't have knowledge. Please let me know what problems we have to solve. We're very interested in all suggestions and ideas to make mosparo better. Java Client LibraryThat would be awesome! I worked with Java before (Android and desktop apps), but I'm not that good in Java to write a library. I helped another user integrate mosparo into Keycloak. Here is the code: https://git.schuerz.at/jakob/keycloak-mosparo (Just in case you need an example of how to communicate with the mosparo API in Java). Thank you very much for your help in making mosparo better! Please let me know if you need anything or have any questions! Kind regards, zepich |
Beta Was this translation helpful? Give feedback.
-
|
Hi @gnieser I have an update for you. :) I've worked on the unprivileged image, and I think I did it... :) https://hub.docker.com/r/mosparo/mosparo-unprivileged There is no Unprivileged imageAs discussed, I've adjusted the Dockerfile, the run.sh, and the nginx configuration and added some functions to mosparo to make it happen (primarily to define a config file stored in a different location). I used the nginx-unprivileged Dockerfile as an example and adjusted the required things to make it work. The image contains nginx and PHP, but you can choose what to turn on with environment variables. You can see the example configuration in this additional Docker Compose file: https://github.com/mosparo/mosparo/blob/master/docker/unprivileged/docker-compose.yaml The unprivileged Docker image does not contain the cron daemon. I did not find an easy solution to run it unprivileged. But, as you already mentioned, the official way for Kubernetes is to use the Kubernetes cronjobs anyway. Additionally, since mosparo v1.2, you can use the web cronjob, so technically, you could also use an additional cronjob image and call the cronjob via web request. Of course, this part needs some documentation, but from the technical aspect, I think we don't need the cron daemon inside the image. I tested the image with OpenShift Local but only with SQLite as a database and not with an additional database container (I was too busy (or lazy?) to learn how to add another container). Please have a look at the new image and let me know what you think. MySQL TLSI've also added the environment variables to enable TLS for MySQL. You can configure the following environment variables: DATABASE_MYSQL_SSL=0 # 0 = disabled, 1 = enabled
DATABASE_MYSQL_SSL_KEY= # Path to the SSL key file
DATABASE_MYSQL_SSL_CERT= # Path to the SSL certificate file
DATABASE_MYSQL_SSL_CA= # Path to the SSL CA file
DATABASE_MYSQL_SSL_VERIFY_SERVER_CERT=0 # 0 = do not verify, 1 = verifyThere is no visual hint regarding these variables in the setup right now. I would also like to hear your feedback regarding this part. Thank you very much for all your help, and I look forward to hearing from you! Kind regards, zepich |
Beta Was this translation helpful? Give feedback.
-
|
Hi @zepich The unprivileged image works for me without any further customization and with the new environment variables for MySQL TLS. Here is the deployment resource: apiVersion: apps/v1
kind: Deployment
metadata:
name: deployment
spec:
replicas: 1
selector:
matchLabels: { }
template:
spec:
containers:
- name: mosparo
image: mosparo/mosparo-unprivileged:v1.3.1-alpha.4
imagePullPolicy: Always
envFrom:
- configMapRef:
name: configmap
ports:
- containerPort: 8080
name: http-8080
protocol: TCP
volumeMounts:
- mountPath: /mosparo-config
name: mosparo-config
- mountPath: /mosparo/public/resources
name: mosparo-public-resources
- mountPath: /mosparo/var
name: mosparo-var
- mountPath: /certs
name: certs
volumes:
- name: certs
secret:
defaultMode: 420
secretName: certs
- name: mosparo-config
persistentVolumeClaim:
claimName: config-pvc
- name: mosparo-public-resources
persistentVolumeClaim:
claimName: public-resources-pvc
- name: mosparo-var
persistentVolumeClaim:
claimName: var-pvcThanks a lot! I'm also making progress on the Java client library. Kind regards |
Beta Was this translation helpful? Give feedback.
-
|
Hi @zepich It works fine, sources and javadoc as well. That's indeed very handy to test snapshots versions! Here is a I added the needed dependencies because I've defined their scope to provided in the library. I thought it would be easier for users who embeds the library in existing tools (e.g. Keycloak) so they don't have to tweak transitive dependencies. Would I have put them in the default scope, they won't be needed in the below pom.xml. I'm not sure what's best... <?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>
<groupId>io.mosparo</groupId>
<artifactId>my-mosparo-client</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mosparo.version>1.0.0-SNAPSHOT</mosparo.version>
<httpclient.version>4.5.14</httpclient.version>
<jackson.version>2.18.2</jackson.version>
<commons-codec.version>1.13</commons-codec.version>
</properties>
<repositories>
<repository>
<name>Central Portal Snapshots</name>
<id>central-portal-snapshots</id>
<url>https://central.sonatype.com/service/rest/repository/browse/maven-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.mosparo</groupId>
<artifactId>java-api-client</artifactId>
<version>${mosparo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
</dependencies>
</project>Best regards |
Beta Was this translation helpful? Give feedback.
-
|
I haven't really documented the build, and forgot to mention that the revision property, is a special Maven property. The GitHub release action overrides it from the release tag ( |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm currently evaluating spam protection solutions and I've just found mosparo.
First of all, congratulations for all the hard work to create such a nice open source product, that makes the internet a safer place.
I have some security requirements that are not met out of the box:
I think can somehow help mosparo meet them.
I have a workaround for the TLS database connection by override SetupController.php and doctrine.yaml
I have a very complicated setup for OpenShift to ditch the nginx privileged process and avoid writing inside the image
I also need to integrate mosparo with a java backend, so I will probably also write a java client library.
Please let me know whether you are interested, and if so I shall proceed.
Best regards
Beta Was this translation helpful? Give feedback.
All reactions