mirror of
https://github.com/Finb/bark-server.git
synced 2026-04-28 07:05:54 +03:00
[PR #319] [MERGED] Add MySQL TLS/SSL support #318
Labels
No labels
enhancement
in progress
need test
pull-request
v2
v2
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/bark-server#318
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Finb/bark-server/pull/319
Author: @xinlon-z
Created: 11/16/2025
Status: ✅ Merged
Merged: 11/17/2025
Merged by: @Finb
Base:
master← Head:master📝 Commits (1)
4b237f8Add MySQL TLS/SSL support📊 Changes
2 files changed (+98 additions, -1 deletions)
View changed files
📝
database/mysql.go(+52 -0)📝
main.go(+46 -1)📄 Description
Hi maintainer,
This PR adds optional TLS/SSL support for MySQL connections in Bark Server. It allows the server to connect to MySQL securely using a CA certificate, and optionally a client certificate + key. MySQL TLS/SSL is disabled by default, so existing setups continue to work without any changes.
And I have added the following CLI flags to support this feature:
--mysql-tls--mysql-skip-verify--mysql-certclient-cert.pem).--mysql-keyclient-key.pem).--mysql-caExample usage:
./bark-server \
--dsn "user:pass@tcp(host:port)/dbname" \
--mysql-tls \
--mysql-ca /path/to/ca.pem \
--mysql-client-cert /path/to/client-cert.pem \
--mysql-client-key /path/to/client-key.pem \
--mysql-tls-skip-verify
I have fully validated it with MySQL 8.4.7 locally:
xinlon@ubuntu-pc:~/work/bark-server$ ./bark-server --dsn "bark:test_passwd@tcp(192.168.11.22:3306)/Bark_Server" --mysql-ca /home/xinlon/ca.pem --mysql-client-cert /home/xinlon/client-cert.pem --mysql-client-key /home/xinlon/client-key.pem --mysql-tls --mysql-tls-skip-verify
2025-11-16 12:12:06 INFO create apns client: 0
2025-11-16 12:12:06 INFO init apns client success...
2025-11-16 12:12:06 INFO Bark Server Has No Basic Auth.
2025-11-16 12:12:06 INFO load route [register_compat] success...
2025-11-16 12:12:06 INFO load route [misc] success...
2025-11-16 12:12:06 INFO load route [push] success...
2025-11-16 12:12:06 INFO load route [register] success...
2025-11-16 12:12:06 INFO load route [push_compat] success...
2025-11-16 12:12:06 INFO MySQL TLS CA: /home/xinlon/ca.pem
2025-11-16 12:12:06 INFO MySQL TLS client cert: /home/xinlon/client-cert.pem
2025-11-16 12:12:06 INFO MySQL TLS client key: /home/xinlon/client-key.pem
2025-11-16 12:12:06 INFO Server certificate verification skipped: true
2025-11-16 12:12:06 INFO Bark Server Listen at: 0.0.0.0:8080 , Database: *database.MySQL
┌───────────────────────────────────────────────────┐
│ Fiber v2.52.9 │
│ http://[::]:8080 │
│ │
│ Handlers ............ 28 Processes ........... 1 │
│ Prefork ....... Disabled PID ............. 24704 │
└───────────────────────────────────────────────────┘
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.