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

doesn't support encrypted database connections #297

Open
fcevado opened this issue Apr 12, 2020 · 1 comment · May be fixed by #301
Open

doesn't support encrypted database connections #297

fcevado opened this issue Apr 12, 2020 · 1 comment · May be fixed by #301

Comments

@fcevado
Copy link

@fcevado fcevado commented Apr 12, 2020

Describe the bug

if you start MySQL with --ssl mode enabled writefreely won't connect to the database.

Steps to reproduce (if necessary)

Steps to reproduce the behavior:

  1. start MySQL with --ssl mode.
  2. run writefreely --config and set the proper database credentials
  3. writefreely will error try to connect to the databse with this authentication plugin is not supported

Expected behavior

What should've happened?
During the config I'd expect it to ask if it will require ssl mode or not and be able to work properly with it.

Application configuration

  • Single mode or Multi-user mode? Multi-user mode
  • Database? [mysql/sqlite] MySQL
  • Open registration? [yes/no] no
  • Federation enabled? [yes/no] yes

Version or last commit:
0.11.2

@thebaer
Copy link
Member

@thebaer thebaer commented Apr 15, 2020

Thanks for reporting this! A simple fix will probably involve:

  • Adding a new DatabaseCfg flag that enables TLS / SSL
  • If that flag is true, include &tls=true in the database connection string:
    db, err = sql.Open(app.cfg.Database.Type, fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=true&loc=%s", app.cfg.Database.User, app.cfg.Database.Password, app.cfg.Database.Host, app.cfg.Database.Port, app.cfg.Database.Database, url.QueryEscape(time.Local.String())))
    • (Really, you can include &tls=true or &tls=false, where true / false is the value of the config flag)

This is a pretty straightforward fix, so please feel free to submit a pull request for it!

joicemjoseph added a commit to joicemjoseph/writefreely that referenced this issue Apr 15, 2020
joicemjoseph added a commit to joicemjoseph/writefreely that referenced this issue Apr 15, 2020
joicemjoseph added a commit to joicemjoseph/writefreely that referenced this issue Apr 16, 2020
joicemjoseph pushed a commit to joicemjoseph/writefreely that referenced this issue Apr 16, 2020
@joicemjoseph joicemjoseph linked a pull request that will close this issue Apr 16, 2020
1 of 1 task complete
@thebaer thebaer linked a pull request that will close this issue Apr 18, 2020
1 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.