# mutator daemon/server/client This document talks about mutator's daemon, client and server.
Please keep in mind that this feature is still under development. That means that it's still rough around the edges and produces a lot of diagnostic messages.
With all that being said, it works so feel free to try it out.
### How it works? It's simple. The client sends a command to the server run by the daemon(`mutatord`) to execute. The server then runs the command. by passing it to the driver(`mutator.sh`).
The mutator client is a thin client which is also the whole point of all of this: Plugin.
The daemon generates a log file in the `daemon` directory under root named `mutatordlog`.
The daemon will need to read some VARS from a config file that is generated by `make install` inside the daemon directory named `mutator.config`.
### How to use it? Just run the makefile in the `daemon` directory:
```bash make all ``` Or just run that from the main makefile. After that, run `mutatord` to start up the server and then run `mutatorclient` and send your commands.
The server passes the commands to `mutator.sh` to execute. For a list of available options you can run `mutator.sh -h` or just read the `README.md` in project root.
To run commands on the server, use normal mutator driver commands excluding the driver name:
```bash -f /home/user1/mutator/samples/action_file.mutator ``` To kill the client and server(and also the daemon) just send `end_comm` as the command through the client.
## WARNING Currently there are some checks on the commands sent to the server. The server uses `popen()` to run the commands prefixed by the driver name, `mutator.sh`.
The server checks to see whether the command string is null-terminated and whether it contains `|` or `;`. Thats's all the checks it runs before running a command from the root directory.
The daemon will switch to the root directory as soon as it is run and the server will inherit the permissions that the daemon was ran by. There is no reason to run the daemon as sudo.
### Directory Content * `mutatord.c` holds the source code for the daemon.
* `daemon_aux.c` contains the source code for the server run by the daemon.
* `mutatorclient` contains the source code for the client.
* `mutatorserver` contains the server as a standlone. This is only for testing.
* `README.md` is the thing you are reading right now.
* `makefile` builds the client/server/daemon.
### Limitations * The server uses only one pipe so the only thing captured is stdout. I'll later add another pipe to capture stderr.
* For the time being the server can only accept one client. I'll add code to handle more clients if the need is felt.
* Currently the client(daemon) and server need to be on the same host. Again this limitation could be removed if it is ever needed.