diff options
author | netblue30 <netblue30@yahoo.com> | 2015-11-02 11:02:12 -0500 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2015-11-02 11:02:12 -0500 |
commit | ea97f7c534769181b2cf3ea4ba0d4d9c5e0078cb (patch) | |
tree | a99142d2769d5645332b6347ec47091812fde303 /src/firejail/fs_var.c | |
parent | whitelisting ~/.fonts (diff) | |
download | firejail-ea97f7c534769181b2cf3ea4ba0d4d9c5e0078cb.tar.gz firejail-ea97f7c534769181b2cf3ea4ba0d4d9c5e0078cb.tar.zst firejail-ea97f7c534769181b2cf3ea4ba0d4d9c5e0078cb.zip |
cleanup
Diffstat (limited to 'src/firejail/fs_var.c')
-rw-r--r-- | src/firejail/fs_var.c | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/src/firejail/fs_var.c b/src/firejail/fs_var.c index 93625633a..7e822f614 100644 --- a/src/firejail/fs_var.c +++ b/src/firejail/fs_var.c | |||
@@ -317,10 +317,8 @@ void fs_var_utmp(void) { | |||
317 | // create a new utmp file | 317 | // create a new utmp file |
318 | if (arg_debug) | 318 | if (arg_debug) |
319 | printf("Create the new utmp file\n"); | 319 | printf("Create the new utmp file\n"); |
320 | char *utmp; | 320 | |
321 | if (asprintf(&utmp, "%s/utmp", MNT_DIR) == -1) | 321 | FILE *fp = fopen(UTMP_FILE, "w"); |
322 | errExit("asprintf"); | ||
323 | FILE *fp = fopen(utmp, "w"); | ||
324 | if (!fp) | 322 | if (!fp) |
325 | errExit("fopen"); | 323 | errExit("fopen"); |
326 | 324 | ||
@@ -339,42 +337,16 @@ void fs_var_utmp(void) { | |||
339 | // save new utmp file | 337 | // save new utmp file |
340 | fwrite(&u_boot, sizeof(u_boot), 1, fp); | 338 | fwrite(&u_boot, sizeof(u_boot), 1, fp); |
341 | fclose(fp); | 339 | fclose(fp); |
342 | if (chown(utmp, 0, utmp_group) < 0) | 340 | if (chown(UTMP_FILE, 0, utmp_group) < 0) |
343 | errExit("chown"); | 341 | errExit("chown"); |
344 | if (chmod(utmp, S_IRUSR | S_IWRITE | S_IRGRP | S_IWGRP | S_IROTH ) < 0) | 342 | if (chmod(UTMP_FILE, S_IRUSR | S_IWRITE | S_IRGRP | S_IWGRP | S_IROTH ) < 0) |
345 | errExit("chmod"); | 343 | errExit("chmod"); |
346 | 344 | ||
347 | // mount the new utmp file | 345 | // mount the new utmp file |
348 | if (arg_debug) | 346 | if (arg_debug) |
349 | printf("Mount the new utmp file\n"); | 347 | printf("Mount the new utmp file\n"); |
350 | if (mount(utmp, "/var/run/utmp", NULL, MS_BIND|MS_REC, NULL) < 0) | 348 | if (mount(UTMP_FILE, "/var/run/utmp", NULL, MS_BIND|MS_REC, NULL) < 0) |
351 | errExit("mount bind utmp"); | 349 | errExit("mount bind utmp"); |
352 | } | 350 | } |
353 | 351 | ||
354 | 352 | ||
355 | #if 0 | ||
356 | Testing servers: | ||
357 | |||
358 | brctl addbr br0 | ||
359 | ifconfig br0 10.10.20.1/24 | ||
360 | |||
361 | apt-get install snmpd | ||
362 | insserv -r snmpd | ||
363 | sudo firejail --net=br0 --ip=10.10.20.10 "/etc/init.d/rsyslog start; /etc/init.d/ssh start; /etc/init.d/snmpd start; sleep inf" | ||
364 | |||
365 | apt-get install apache2 | ||
366 | insserv -r apache2 | ||
367 | sudo firejail --net=br0 --ip=10.10.20.10 "/etc/init.d/rsyslog start; /etc/init.d/ssh start; /etc/init.d/apache2 start; sleep inf" | ||
368 | |||
369 | apt-get install nginx | ||
370 | insserv -r nginx | ||
371 | sudo firejail --net=br0 --ip=10.10.20.10 "/etc/init.d/rsyslog start; /etc/init.d/ssh start; /etc/init.d/nginx start; sleep inf" | ||
372 | |||
373 | apt-get install lighttpd | ||
374 | insserv -r lighttpd | ||
375 | sudo firejail --net=br0 --ip=10.10.20.10 "/etc/init.d/rsyslog start; /etc/init.d/ssh start; /etc/init.d/lighttpd start; sleep inf" | ||
376 | |||
377 | apt-get install isc-dhcp-server | ||
378 | insserv -r isc-dhcp-server | ||
379 | sudo firejail --net=br0 --ip=10.10.20.10 "/etc/init.d/rsyslog start; /etc/init.d/ssh start; /etc/init.d/isc-dhcp-server start; sleep inf" | ||
380 | #endif | ||