Why does using --acls and --xattrs together stop the mapping of ACL users from remote to local? - acl

I'm trying to copy files and preserve EVERYTHING from a remote server to a local server where the same users exist, but with different IDs. By default, rsync should map the names correctly and this seems to be the case when --acls, -A is used, but not when also preserving extended attributes with --xattrs, -X:
Preserves ACLs and maps user names from remote to users on local:
sudo -E rsync -avzA --delete --rsync-path="sudo rsync" me#10.0.0.1:/var/www /var
# file: www/
# owner: root
# group: root
user::rwx
user:foo:r-x
group::r-x
group:www-data:r-x
mask::rwx
other::---
Preserves ACLs, but user name mapping does not work:
sudo -E rsync -avzAX --delete --rsync-path="sudo rsync" me#10.0.0.1:/var/www /var
# file: www/
# owner: root
# group: root
user::rwx
user:1006:r-x
group::r-x
group:cockpit:r-x
mask::rwx
other::---
Why does using --acls and --xattrs together stop the mapping of ACL users from remote to local?
rsync version 3.1.3 protocol version 31

Related

How to change default MySQL username and password using docker setup?

I want to change the default MySQL username and password either during setup or after.
I've tried a bit of a scattershot approach and changed every config file I can find with username and password, but still doesn't work.
Files I've edited below:
> ~/.env
> ~/conf/dist/env.ac
> ~/conf/dist/env.docker
> ~/conf/config.sh
> ~/env/docker/etc/authserver.conf.dockerdist
> ~/env/docker/etc/worldserver.conf.dockerdist
> ~/docker-compose.yml
Error during rebuild:
> Searching on /azerothcore/data/sql/custom/db_world/ ...
> ===== DONE =====
> ===== CHECKING DBs ===== ERROR 1045 (28000): Access denied for user 'wowadmin'#'172.19.0.3' (using password: YES)
From the FAQ of the official guide:
How can I change the docker containers configuration?
You can copy the file /conf/dist/.env.docker to .env and place it in the root folder of the project, then edit it according to your needs.
In the .env file you can configure:
the location of the data, etc and logs folders
the open ports
the MySQL root password
Then your docker-compose up will automatically locate the .env with your custom settings.
Okay got this sorted out, here's the solution.
You can copy the file /conf/dist/.env.docker to .env and place it in the root folder of the project, then edit it according to your needs.
In the .env file you can configure:
the location of the data, etc and logs folders
the open ports
the MySQL root password
Then your docker-compose up will automatically locate the .env with your custom settings.
.env file:
DOCKER_AC_ENV_FILE=C:\Games\WoW-WotLK-Server\azerothcore-wotlk\conf\dist\env.ac
DOCKER_VOL_DATA=
DOCKER_VOL_ETC=
DOCKER_VOL_LOGS=
DOCKER_VOL_CONF=
DOCKER_WORLD_EXTERNAL_PORT=
DOCKER_SOAP_EXTERNAL_PORT=
DOCKER_AUTH_EXTERNAL_PORT=
DOCKER_DB_EXTERNAL_PORT=
DOCKER_DB_ROOT_PASSWORD=yourpassword
...
Note: Apparently there is an unresolved issue with using a # in password so dont.
..\azerothcore-wotlk\conf\dist\
env.ac file:
DB_AUTH_CONF=MYSQL_USER='root'; MYSQL_PASS='yourpassword'; MYSQL_HOST='ac-database'; MYSQL_PORT='3306';
DB_CHARACTERS_CONF=MYSQL_USER='root'; MYSQL_PASS='yourpassword'; MYSQL_HOST='ac-database'; MYSQL_PORT='3306';
DB_WORLD_CONF=MYSQL_USER='root'; MYSQL_PASS='yourpassword'; MYSQL_HOST='ac-database'; MYSQL_PORT='3306';
..\azerothcore-wotlk\env\docker\etc
authserver.conf file:
###############################################
# AzerothCore Auth Server configuration file #
###############################################
[authserver]
# Do not change this
# Files in LogsDir will reflect on your host directory: docker/authserver/logs
LogsDir = "/azerothcore/env/dist/logs"
# Change this configuration accordingly with your docker setup
# The format is "hostname;port;username;password;database":
# - docker containers must be on the same docker network to be able to communicate
# - the DB hostname will be the name of the database docker container
LoginDatabaseInfo = "ac-database;3306;root;yourpassword;acore_auth"
# Add more configuration overwrites by copying settings from from authserver.conf.dist
LogLevel = 3
SQLDriverLogFile = "SQLDriver.log"
SQLDriverQueryLogging = 1
worldserver.conf:
################################################
# AzerothCore World Server configuration file #
################################################
[worldserver]
# Do NOT change those Dir configs
# Files in LogsDir will reflect on your host directory: docker/worldserver/logs
LogsDir = "/azerothcore/env/dist/logs"
DataDir = "/azerothcore/env/dist/data"
# Change this configuration accordingly with your docker setup
# The format is "hostname;port;username;password;database":
# - docker containers must be on the same docker network to be able to communicate
# - the DB hostname will be the name of the database docker container
LoginDatabaseInfo = "ac-database;3306;root;yourpassword;acore_auth"
WorldDatabaseInfo = "ac-database;3306;root;yourpassword;acore_world"
CharacterDatabaseInfo = "ac-database;3306;root;yourpassword;acore_characters"
# Add more configuration overwrites by copying settings from worldserver.conf.dist
LogLevel = 2
# Disable idle connections automatic kick since it doesn't work well on macOS + Docker
CloseIdleConnections = 0

multiple MySQL instance on FreeBSD

Dear all Professionals
We have a serious problem to create Mysql Instance on FreeBSD os.
Here is my progress to make an instance:
1- Create new database instance on new destination
mkdir /mysql2/mysql
mkdir /mysql2/mysql/data
mkdir /mysql2/mysql/log
mkdir /mysql2/mysql/run
mkdir /mysql2/mysql/lock
chown -R mysql:mysql /mysql2/mysql
/usr/local/libexec/mysqld --initialize --datadir= /mysql2/mysql/data --user= mysql2
but in the beginning of this progress, i have an error and I cloud not figure out how to solve it:
[Warning] Could not increase number of max_open_files to more than 28782 (request: 263271)
[Warning] Changed limits: table_open_cache: 14310 (requested 131555)
[Warning] Ignoring user change to '' because the user was set to 'mysql' earlier on the command line
[ERROR] --initialize specified but the data directory has files in it. Aborting.
[ERROR] Aborting
FreeBSD 10.3
Mysql57-server-5.7.20_1
We were wondering if anybody could help us to handle this problem
One way to have multiple instances of MySQL could be to use jails in that way you could just install the package like always beside inherit more security.
An easy way is to get an image with ZFS + jails for this you could use fabrik.red, in any case, this are the basic steps to create a jail in your current system, you can find more here: https://www.freebsd.org/doc/handbook/jails-build.html
For this example the jail will be in home/jail/mysql1:
# mkdir -p /home/jail/mysql1
Fetch the base files and extract them into the jail:
# fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/10.3-RELEASE/base.txz -o /tmp/base.txz
# tar -xvf /tmp/base.txz -C /home/jail/mysql1
# fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/10.3-RELEASE/lib32.txz -o /tmp/lib32.txz
# tar -xvf /tmp/lib32.txz -C /home/jail/mysql1
Create /etc/rc.conf/ and /etc/resolv.conf, on each jail home, the /etc/rc.conf can be something like:
cron_flags="$cron_flags -J 60"
sendmail_enable="NONE"
And for the /etc/rc.conf you could just copy the one you have in the main host:
# cp /etc/resolv.conf /home/jail/mysql1/resolv.conf
# cp /etc/resolv.conf /home/jail/mysql1/resolv.conf
Next create a /etc/jail.conf:
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.clean;
mount.devfs;
allow.raw_sockets;
securelevel=3;
host.hostname="$name.your.tld";
mysql1 {
ip4 = inherit;
path = "/home/jail/mysql1";
}
mysql2 {
ip4 = inherit;
path = "/home/jail/mysql2";
}
Notice the ip4 = inherit it will make your jails use the same network on your host so that you don't have to do NAT or add unique IP's but because of this you will need to use a different port for each MySQL instance.
To start the jails do:
# /etc/rc.d/jail start
To check what jails are running type jls that will print something like:
JID IP Address Hostname Path
1 mysql1.your.tld /home/jail/mysql1
2 mysql2.your.tld /home/jail/mysql2
Enter to a jail by using jexec, for example, to access jail 1:
# jexec 1
Once in the jail, install your packages either by using pkg or ports.

MySQL in Docker on Windows: World-writable files ignored

I'm using Docker-Compose with the MySQL Image to fire up a MySQL database as part of a larger project.
As documented in the MySQL image's documentation, I'm mapping in a custom configuration file to /etc/mysql/conf.d/config-file.cnf:
database:
environment:
MYSQL_ROOT_PASSWORD: foo
ports:
- "3306:3306"
volumes:
- "./mysql/conf.d/:/etc/mysql/conf.d"
image: mysql:5.5
This works perfectly fine when running on Mac OS X as the host system (using docker-machine), but it fails when running on Windows (also using docker-machine). MySQL complains about the fact that the /etc/mysql/conf.d/config-file.cnf is world-writable
Warning: World-writable config file '/etc/mysql/conf.d/config-file.cnf' is ignored
When entering the database container, the file is indeed shown as having 0777 permission. This seems to be due to the host file system's permissions (Windows).
Is there any way to change this? I've tried mounting the volume in read-only mode, but the file still has the same permissions.
Any other way around this problem? At the moment, I'm mounting the file to another folder in the container and then copying/chmod'ing it to the required location as part of the startup command:
database:
environment:
MYSQL_ROOT_PASSWORD: foo
ports:
- "3306:3306"
volumes:
- "./mysql/conf.d/:/usr/local/mysqlconf"
image: mysql:5.5
command: >
bash -c "
cp /usr/local/mysqlconf/*.cnf /etc/mysql/conf.d/
&& chmod 644 /etc/mysql/conf.d/*.cnf
&& /entrypoint.sh mysqld
"
Is there a better way to solve this issue?
When you start up a container with -v, --volumes or use volumes: in docker-compose.yml
docker run -v source:/dest:rw busybox ls -l /dest
Docker mounts the source directory from the Linux VM into a container as /dest. Docker mounted volumes only provide their own options rw and r and I think z for selinux. Owner and permission info will be passed through to the container exactly as the Linux VM sees them. If someone who clones your repo runs docker or docker-compose from their local host rather than on the VM, they will mount blank directories.
Docker Machine's Users share
A docker-machine created local VM will share your computer's local users directory by default. C:\Users on Windows and /Users on OSX. This is done as a VirtualBox shared folder called Users. This share is then mounted on the Linux side via VirtualBox's vboxsf mount tool as /Users or maybe /c/Users via a Linux startup script /etc/rc.d/vbox.
When you docker-machine ssh default you should be able to see all your computers file at /Users/nwinkler.
This share allows docker-compose to reference a relative, local directory within C:\Users and have it work on the Linux VM. Outside of C:\Users the data doesn't exist on the VM.
World readable files
I believe what you are seeing is vboxsf's POSIX representation of a Windows file system. If you run:
docker-machine ssh default
$ cd /Users/nwinkler/path/to/mysql-docker
$ ls -l
$ docker run -v $PWD:/mysql busybox ls -l /mysql
You should see all your files as world writable. The only way to change the represented permissions is via the vboxsf mounted share.
The mount options vboxsf provides are:
Available mount options are:
rw mount writable (the default)
ro mount read only
uid=UID set the default file owner user id to UID
gid=GID set the default file owner group id to GID
ttl=TTL set the "time to live" to TID for the dentry
dmode=MODE override the mode of all directories to (octal) MODE
fmode=MODE override the mode of all regular files to (octal) MODE
umask=UMASK set the umask to (octal) UMASK
dmask=UMASK set the umask applied to directories only
fmask=UMASK set the umask applied to regular files only
iocharset CHARSET use the character set CHARSET for I/O operations
(default set is utf8)
convertcp CHARSET convert the folder name from CHARSET to utf8
On the Docker Linux VM, edit /etc/rc.d/box and append the options to the mountOptions variable. These options will apply to all files and directories under /Users on that mount.
You could set an fmask=007 to remove other permissions from all files or fmode=750 to override all permissions for all files.
mountOptions='defaults,iocharset=utf8'
if grep -q '^docker:' /etc/passwd; then
mountOptions="${mountOptions},uid=$(id -u docker),gid=$(id -g docker),fmask=007"
fi
If you ever upgrade or recreate your docker-machine VM you will need to do this again.
I tend to skip relying on virtualbox shares and have local files monitored and synchronised to my hosts on change (fsevents and rsync).

Can I change my.inf in OpenShift without root access?

I want to sync a local database with OpenShift MySQL, but I can't change my.inf because I don't have root access. Is it possible to get root access on OpenShift?
I believe you are interested in my.cnf. If you ssh into your gear (rhc ssh <yourApp>) and check the file (~/mysql/conf/my.cnf), you will see that it's owned by you, the root access is not needed.
However, if you check the beginning of the file, you will see:
# WARNING: Changes to this file will be lost on every restart/upgrade. Configurable values can be set with environment variables through rhc env set...
#
# Ex: rhc env set OPENSHIFT_MYSQL_LOWER_CASE_TABLE_NAMES=1 -a myapp && rhc cartridge restart -c mysql-5.5 -a myapp
#
# Configurable Values:
# lower_case_table_names -> OPENSHIFT_MYSQL_LOWER_CASE_TABLE_NAMES
# default-storage-engine -> OPENSHIFT_MYSQL_DEFAULT_STORAGE_ENGINE
# max_connections -> OPENSHIFT_MYSQL_MAX_CONNECTIONS
# ft_min_word_len -> OPENSHIFT_MYSQL_FT_MIN_WORD_LEN
# ft_max_word_len -> OPENSHIFT_MYSQL_FT_MAX_WORD_LEN
Which should answer your question on what is configurable and how to do it.

Run multiple MySQL server on a single machine

Can we run multiple MySQL servers on a single machine?
Thanks.
Yes, you just need to run them on separate ports and point them at different lib directories for their data.
Here's a good reference: http://dev.mysql.com/doc/refman/5.1/en/mutiple-servers.html
(If you want to use this for testing, I suggest checking out MySQL Sandbox which is now replaced by dbdeployer)
There are various methods to run multiple instances of mysql (on different ports) on the same machine. Here I have used the same binary and used a separate configuration file (with separate port, pid, socket and data directory).
We need to create new directories for our datadir and log folder (if used). Also we need to assign proper permissions on those folders:
# mkdir /var/lib/mysql2
# chown -R mysql.mysql /var/lib/mysql2/
# mkdir /var/log/mysql2
# chown -R mysql.mysql /var/log/mysql2
Next we need a separate configuration file same as a default mysql configuration file. So start by copying the existing one and changing the needed values.
# cp /etc/my.cnf /etc/my2.cnf
(or change the path appropriately for your configuration file is in a different place).
Next, we need to edit our new configuration file with different mysql port (default to 3306), the pid and socket than the default ones, and also point the data and log folders to the ones created before.
# cd /etc
# sed -i ‘s/3306/3307/g’ my2.cnf
# sed -i ‘s/mysqld.sock/mysqld2.sock/g’ my2.cnf
# sed -i ‘s/mysqld.pid/mysqld2.pid/g’ my2.cnf
# sed -i ‘s/var\/lib\/mysql/var\/lib\/mysql2/g’ my2.cnf
# sed -i ‘s/var\/log\/mysql/var\/log\/mysql2/g’ my2.cnf
Finally we need to initialize the default dbs:
# mysql_install_db –user=mysql –datadir=/var/lib/mysql2/
Finally we can start our new mysql instance with:
# mysqld_safe – -defaults-file=/etc/my2.cnf &
We can connect to our new instance using:
# mysql -S /var/run/mysqld/mysqld2.sock
or
# mysql -h 127.0.0.1 -P 3307
and if we no longer need it, stop it with:
# mysqladmin -S /var/run/mysqld/mysqld2.sock shutdown
Ref Site : https://linuxinpakistan.com/start-multiple-instances-mysql-machine
My steps on Windows 10:
Copy C:\ProgramData\MySQL\MySQL Server 8.0\my.ini to C:\ProgramData\MySQL\MySQL Server 8.0\my1.ini
Open my1.ini and modify:
port=3307(under Client and Server Section)
datadir=C:/ProgramData/MySQL/MySQL Server 8.0/Data1
report_port=3307
Copy C:\ProgramData\MySQL\MySQL Server 8.0\Data to C:\ProgramData\MySQL\MySQL Server 8.0\Data1
Run on cmd prompt: (With Administrator privileges if necessary)
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqld --install MySQL80-1 --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my1.ini"
If all went well, you will see:
Service successfully installed.
Win+R
Type services.msc, find the service name MySQL80-1, right-click on it and click Start.
If all went well, you will see the Status change to Running.
If it did not go well, open xxx.err file found in C:\ProgramData\MySQL\MySQL Server 8.0\Data1 to check why.
If you do not want the service anymore:
Stop it
Delete it on the cmd prompt using sc delete MySQL80-1 where MySQL80-1 is your service name.
For Windows, if the version of mysql server is different then using MYSQL Installer download and install the different versions of the MYSQL server.
Select Reconfigure for each MYSQL server and configure the PORT differently. Complete the configuration steps by clicking next until it is finished
Yes definitely,
Create multiple configuration files with different ports.
This is the best resource to understand:
Video Tutorial: MySQL Multiple Instances
Reference article: Click here