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

fixes inability to configure $MYSQL_CMD variable #153

Closed
wants to merge 1 commit into from

Conversation

Amorik
Copy link

@Amorik Amorik commented Sep 20, 2024

Makes it so that the $MYSQL_CMD variable can be set as a docker environmental variable to adjust the the command executed by the container to connect to a database. Usefully for making custom adjustments such as connecting via a socket instead of a network.

@ostefano
Copy link
Collaborator

Can you explain a bit more the use case, and why you can not achieve the same thing by setting the MYSQL env vars individually?

@Amorik
Copy link
Author

Amorik commented Sep 25, 2024

The number of available environmental variables available to the client via the docker execution scripts is limited. For example, in my current setup I run mariadb on the local system (not docker) and bind mount the socket into the misp-core instance. This works with v2.4.194 (core)

compose file

...
volumes:
  - /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock
environment:
  - "MYSQL_SOCKET=${MYSQL_SOCKET}"
  - "MYSQLCMD=${MYSQLCMD}"
...

.env file

...
MYSQL_SOCKET=/run/mysqld/mysqld.sock
MYSQLCMD="mysql -u $MYSQL_USER -p$MYSQL_PASSWORD --socket=$MYSQL_SOCKET -r -N $MYSQL_DATABASE"
...

While most users will primarily use a docker container for mariadb/mysql as indicated in the setup documentation sometimes more advanced setups use different components in different places. Another example of this would be using a remote database where one may one to utilize SSL/TLS encryption, or network compression; options available via the client and sometimes required by the server.

While these could be added to the docker misp setup configs it may be easier (short term anyways) to simply allow advanced users to modify the client command instead. Though its not documented currently.

@ostefano
Copy link
Collaborator

My point is also that the variable will not populate the database.php file used by MISP, so I am wondering whether a better handling of the many MYSQL variables would be a better solution instead.

@Amorik
Copy link
Author

Amorik commented Sep 25, 2024

My apologies, I did not even consider the PHP database config; i was only looking at the client command - I over simplified the issue.

Considering that the cake PHP and the client configurations dont seem to align 100% in terms of options I agree a different solution would be better. Acceptable variables would likely also have to be limited to what Cake PHP supports.

I'm not proficient in PHP but will look at how to address the issue differently.

@ostefano ostefano added the invalid This doesn't seem right label Sep 27, 2024
@ostefano ostefano closed this Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants