aboutsummaryrefslogtreecommitdiffstats
path: root/src/firejail/fs_var.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/firejail/fs_var.c')
-rw-r--r--src/firejail/fs_var.c38
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
356Testing servers:
357
358brctl addbr br0
359ifconfig br0 10.10.20.1/24
360
361apt-get install snmpd
362insserv -r snmpd
363sudo 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
365apt-get install apache2
366insserv -r apache2
367sudo 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
369apt-get install nginx
370insserv -r nginx
371sudo 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
373apt-get install lighttpd
374insserv -r lighttpd
375sudo 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
377apt-get install isc-dhcp-server
378insserv -r isc-dhcp-server
379sudo 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