473,796 Members | 2,455 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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********@ucda vis.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 2105

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

Similar topics

2
9004
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 question is now, where can I find a manual that describes what the read method does with the ifstream object? I'm sitting here with my Linux/Debian machine, but I have not found any
6
3477
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 bytes actually read? What the code fragment should do is read up to 1000 bytes into a buffer, or finish early if reading failed. Just your average read loop. I have: (this is a simplified version; I know there's no detailed error
12
11666
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 currently have as a test for using std::ifstream::read(). Is there anything wrong with the way I'm getting the file? #include <vector> #include <iomanip> #include <fstream> #include <iostream>
2
3093
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 this by aggregating new content from all databases into a single indexed database and then saving a timestamp in the account database (for the current user) that tells me when the user last read items in the aggregated database.
4
3847
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 socket read after a certain delay. The logic is (I will provide a test program below): - create and connect socket
1
4005
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
4757
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 the client application establish a connection, and send data, which appears in plain, de-crypted text on the server - this works.
6
5719
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 * vector<string>. Now, use istringstream to read read each line * from the vector a word at a time.
4
2808
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 following data.bin (3 Data appended to 2 Data): 2, data0, data1, 3, data0, data1, data2
5
12870
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 read() call will block indefinite, keeping me from killing it. The folloing sample code illustrates the problem: proc = subprocess.Popen(,
0
9680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10455
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10173
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7547
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.