welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 168 forks source link

Password required on remote mysqldymp #665

Open dompl opened 1 year ago

dompl commented 1 year ago

Hi there.

I stared experiencing strange behaviour on some of my websites.

To push the website to the server I am using SSH with key. All files and going through smoothly but when it comes to mysqldump is prompting for server password.

▬▬ Pushing Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ remote | mysqldump --host=[secret] --port=3306 --user=BD_USER --password=DB_PASSWORD --result-file="[secret]/wp-content/dump.sql" DB_NAME server@SERVER IP's password:

Anyone has an idea what could cause it?

themkvz commented 1 year ago

Hi!

I have the same issue, but it happened not on all servers, I don't know what the difference is between servers. These servers look very similar. Pull/Push via ssh works fine for anything, except the database

Any ideas?

themkvz commented 1 year ago

@alessandro-fazzi @maiorano84 for visibility ^

I found only one distinction between servers, it is a version of ubuntu (22.04 vs 20.04)

Also, I tried to add ssh keys to a keychain and used different keys. Very strange why it is working on one the server but doesn't work on another one

maiorano84 commented 1 year ago

Hmmm.... never seen this one before. When connecting remotely, are you connecting as a manually created user? Or root?

I do know that attempting to connect as root without sudo on Ubuntu 22 with MySQL / MariaDb after using mysql_secure_installation will fail (root users are pretty locked down nowadays), and I don't think Wordmove attempts to do anything with sudo access. I could be mistaken on that, though.

themkvz commented 1 year ago

@maiorano84 Thanks for your response. I have two vps that installed the same CP (hestiacp) and the same settings (also regular user, not root), but only one difference in the Ubuntu version. On 22.04 I get a password prompt when I try pull/push DB

maiorano84 commented 1 year ago

@themkvz Only other thing I can think of to try is to run the mysqldump utility with all of the parameters filled in directly on the server. If after running it manually you're still getting a password prompt, then it has more to do with the installation of your MySQL server than Wordmove itself.

Using the original ticket's remote output as a template, the steps would look something like the following:

  1. ssh yoursshuser@yourdomain.com
  2. mysqldump --host=<host goes here> --port=<port goes here> --user=<mysql user goes here> --password=<mysql password goes here> --result-file="<path/to/dump.sql>" <database name goes here>

If the remote command can be run directly on the server but not over SSH, then we may need to look into adding some logging behaviors to make sure everything is being handled and escaped as expected.

themkvz commented 1 year ago

@maiorano84 Sorry for the late response and many blurs)

I was able to create a dump.sql file without requiring any additional password after successfully connecting to the remote server and running the following command. mysqldump --host=localhost --port=3306 --user=user --password=pwd --result-file="./dump.sql" db_name SCR-20230504-rptd

maiorano84 commented 1 year ago

@alessandro-fazzi

We may want to flag this as a potential bug here for further investigation. This appears to be related to Ubuntu 22.04 and also possibly mysql_secure_installation.

I'll see if I can find some time to replicate the issue. I haven't looked at the codebase in a long time, but we may need to employ further debugging and logging options. Not sure if this is environment-related, or some edge case that Wordmove hasn't accounted for yet.

@themkvz

For reference purposes, can you provide a copy of your movefile (sensitive information redacted of course) along with a brief summary of your server environment (ie: OS, Version, Database Type, Database Version, etc.)?

mindfullsilence commented 4 months ago

Having same issues as the others on some new servers I've set up. Works fine on Ubuntu 20.04, and I get a password prompt for db pull/push on 22.04

I ran mysql dump on the server via ssh manually as outlined here: https://github.com/welaika/wordmove/issues/665#issuecomment-1530217442

Worked fine. Logged out of ssh and immediately ran wordmove pull -d -e staging and got the password prompt. Here is my wordmove file:

local:
  vhost: https://mysite.test
  wordpress_path: /Users/timothyanderson/Documents/clients/mysite

  database:
    name: mysite
    user: root
    password:
    host: localhost
    port: 3306

staging:
  vhost: https://<redacted>
  wordpress_path: <redacted>

  database:
    name: <redacted>
    user: <redacted>
    password: '<redacted>'
    host: localhost

  exclude:
    - '.git/'
    - 'node_modules/'
    - 'bin/'
    - 'tmp/*'
    - 'Gemfile*'
    - 'Movefile'
    - 'movefile'
    - 'movefile.yml'
    - 'movefile.yaml'
    - 'wp-config.php'
    - 'wp-content/*.sql.gz'
    - '*.orig'
    - 'backupbuddy_backups/*'
    - 'pb_backupbuddy/*'
    - 'backupbuddy_temp/*'

  ssh:
    host: "<redacted>"
    user: "<redacted>"
    rsync_options: "--verbose --chmod=Du=rwx,Dgo=rx,Fu=rw,Fog=r"

Rest of the dev team is experiencing the same problem. Using phpmyadmin for now for the DB portion - which works but is less than ideal. Let me know if you need anything else @maiorano84 and I'll be happy to provide.