473,387 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

read-only 'Process_priv' privilege?

Greetings:

Long time reader, first time poster. Here we go:

==Specific question:

Does there exist in MySQL a privilege configuration which will allow an account
to issue `SHOW MASTER STATUS` and `SHOW SLAVE STATUS`, but will disallow the
running of any other commands (such as `KILL`)?

==Efforts thus far:

I had noticed the 'Process_priv' field in mysql.user, so I created an account to
which I delegated only that privilege. Upon testing, however, I found that in
addition to being able to view processes, I was also able to kill processes.
This is an unacceptable level of access for my particular exercise (but which
is evidently expected behaviour for that privilege). [1][2] I am hopeful that
someone out there knows of a clever combination of privileges which will yield
the desired behaviour.

==Overall goal:

We are about to deploy into production a pair of database servers with
bi-directional replication. One of the machines has been in production for
some time in an unreplicated manner, but the objective of the new architecture
we're rolling out is to have a hot standby system in the event the primary
fails. We would also like to be able to swap the primary/secondary roles at
will so that we can take each system down individually for patching without
impacting the availability of the service; ideally this would be done via a
`cron` or `at` job. The goal is not to effect a load balancing configuration
(which is unnecessary at this point), but "merely" to achieve near instantaneous
failover ability. Failing over manually works fine, but I dislike having to
wake up 04:00 to do things like swap around database servers. :-)

To this end, I plan to develop a script to automate the failover process
so that the switch can be made safely without manual intervention by a MySQL
DBA. In order to determine whether it is "safe", I planned to have the
(hypothetical) script compare the results of `SHOW MASTER STATUS` and `SHOW
SLAVE STATUS` to ensure that the systems *are* in fact properly synched up
before the failover is executed. [3] In order to accomplish this without
embedding passwords in random scripts, I'd like to be able to create a
passwordless MySQL account which would be able to run these SHOW commands, but
which (in the interest of security) will have no other privileges, since this
account will not have the benefit of a password. [4] The ability to kill
processes in the database violates this fundamental requirement, so simply
delegating 'Process_priv' is not an attractive option, though so far it seems
to be the only one.

==Environment:

Solaris 8/SPARC (64-bit)
MySQL 3.23.57
gcc 3.2
GNU make 3.79
Standard compilation flags:
CC=gcc
CXX=gcc
CFLAGS="-O3 -fno-omit-frame-pointer -mcpu=v8 -Wa,-xarch=v8plusa"
CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
-fno-exceptions -fno-rtti -mcpu=v8 -Wa,-xarch=v8plusa"
./configure --prefix=/usr/local/mysql-3.23.57 \
--datadir=/var/opt/mysql \
--localstatedir=/var/opt/mysql \
--enable-assembler \
--enable-local-infile \
--with-innodb \
--with-mysqld-user=mysql\
--with-gnu-ld=/usr/local/bin/ld


Note: I compile MySQL just once then push it out to all of our MySQL database
servers, hence the InnoDB support, though on the replicated systems in question
we 'skip-innodb'. I don't expect that any of these details actually have any
bearing whatsoever on the question being discussed here today, but I thought
I'd provide this information in the interest of full disclosure.

==Final plea:

Any ideas? I would imagine that people who have already deployed replicated
MySQL databases have some sort of general monitoring mechanism which they use
to ensure that replication is working properly amongst their servers at any
given time. Would any of you care to divulge such trade secrets?

==Footnotes:

[1] After observing this behaviour, I dusted off my copy of the ORA _MySQL
Reference Manual_ and looked up this privilege. In section 4.2.2, the reader
is warned not to freely delegate this privilege because it will allow someone
to spy on the activity of other users. It is not until section 4.2.7 that the
reader is told that 'Process_priv' includes `kill` ability. Should there be a
second edition of this book, I'd suggest also noting the `kill` ramification of
'Process_priv' upfront in section 4.2.2. I personally consider the ability to
arbitrarily terminate processes in the database to be much more of a security
concern than simply being able to observe what queries other users may be
running.

[2] Some time back I gave up on using http://www.mysql.com/doc/en/index.html
as a reference because I grew weary of time and again thinking that I had
found the answer to my question of the moment, only to discover that the
described command or switch is only available on MySQL 4.x. The "About"
section of the online manual states "Functional changes are always indicated
with reference to the version, so this manual is also suitable if you are using
an older version of the MySQL software"; however, I've never noticed any such
indications on the manual pages as returned by the search engine. Perhaps I've
just never looked closely enough and someone will be kind enough to point out
precisely where on the web pages these notations appear.

[3] Specifically, the web application servers comprising the front end of the
overall system are to be reconfigured to point to an extra IP address which
will be passed back and forth between the two database servers by means of
upping/downing a logical network interface on each machine as appropriate.

[4] We already take a similar approach to shutting down our databases. We set
root passwords on our MySQL installations, then create a passwordless account
with only the 'Shutdown_priv' privilege assigned to it. The rc script runs
`mysqladmin` as this user to shut MySQL down cleanly when the systems are
rebooted.

TIA,
-C
--
#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#! #!#!#!#!#!#!#!#!#!
Chris Callahan - UCD Information Technology - cr********@ucdavis.edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
"[T]he most important point being debated here today is whether
governments have the right to intrude on the privacy of their
citizens in such a way that citizens ultimately cannot have a
private conversation. I should be able to whisper in your ear,
even if your ear is a thousand kilometers away." --Philip Zimmerman



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 2082

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gunnar | last post by:
Hello, I've just written a CPP program that reads integers from a binary file, and used this code while (my_ifstram.read( (char* ) &number, sizeof(int)) { // do something with number } My...
6
by: Steve | last post by:
Hi, I'm trying to convert a file reading loop into one using streams. The BSD OS read API returns the number of bytes read, but istream::read returns itself. How can I find out the number of...
12
by: Steven T. Hatton | last post by:
I know of a least one person who believes std::ifstream::read() and std::ofstream::write() are "mistakes". They seem to do the job I want done. What's wrong with them. This is the code I...
2
by: Sandman | last post by:
Just looking for suggestion on how to do this in my Web application. The goal is to keep track of what a user has and hasn't read and present him or her with new material I am currently doing...
4
by: Ollie Cook | last post by:
Hi, I am having some difficulty with read(2) and interrupting signals. I expect I am misunderstanding how the two work together, so would appreciate some guidance. I am trying to 'time out' a...
1
by: Jose Reckoner | last post by:
I'm running python 2.3 on Windows XP. Anyone have a quick small script to convert .DT1 and .DEM data to ASCII or some other format? I don't need a viewer. Thanks!
0
by: phplasma | last post by:
Hey, I am currently attempting to implement a multi-threaded C# socket, using SSL (.pem file/certification/private key combo) server using Visual Studio C# Express. I have successfully made...
6
by: arnuld | last post by:
This works fine, I welcome any views/advices/coding-practices :) /* C++ Primer - 4/e * * Exercise 8.9 * STATEMENT: * write a program to store each line from a file into a *...
4
by: zl2k | last post by:
hi, there I have a appendable binary file of complex data structure named data.bin created by myself. It is written in the following format: number of Data, Data array Suppose I have...
5
by: Thomas Christensen | last post by:
This issue has been raised a couple of times I am sure. But I have yet to find a satisfying answer. I am reading from a subprocess and this subprocess sometimes hang, in which case a call to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.