Remove chroot from some processes
This commit is contained in:
@@ -8,13 +8,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
// Change the root of the process so it doesn't have access to anything else.
|
const char *message_queue_path = "/djumbai/fifos/message_queue";
|
||||||
chdir("/djumbai");
|
|
||||||
if (chroot("/djumbai") != 0) {
|
|
||||||
perror("chroot /djumbai");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
const char *message_queue_path = "fifos/message_queue";
|
|
||||||
|
|
||||||
if (access(message_queue_path, F_OK) != -1) {
|
if (access(message_queue_path, F_OK) != -1) {
|
||||||
// FIFO exists, delete it
|
// FIFO exists, delete it
|
||||||
@@ -44,7 +38,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Open the FIFO for writing
|
// Open the FIFO for writing
|
||||||
const char *send_fifo_path = "fifos/send_fifo";
|
const char *send_fifo_path = "/djumbai/fifos/send_fifo";
|
||||||
int send_fifo_fd;
|
int send_fifo_fd;
|
||||||
send_fifo_fd = open(send_fifo_path, O_WRONLY);
|
send_fifo_fd = open(send_fifo_path, O_WRONLY);
|
||||||
if (send_fifo_fd == -1) {
|
if (send_fifo_fd == -1) {
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
#include "djumbai_enqueue.h"
|
#include "djumbai_enqueue.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
//Change the root of the djumbai_enqueue process so it doesn't have access to anything else.
|
|
||||||
chroot("/djumbai/queue/");
|
|
||||||
const char *message_queue_path =
|
const char *message_queue_path =
|
||||||
"mailqueue";
|
"/djumbai/fifos/mailqueue";
|
||||||
|
|
||||||
// Open the FIFO for writing
|
// Open the FIFO for writing
|
||||||
int queue_fd;
|
int queue_fd;
|
||||||
|
|||||||
Reference in New Issue
Block a user