1 /*
2  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3  * Copyright (c) 2013 Zmanda, Inc.  All Rights Reserved.
4  * All Rights Reserved.
5  *
6  * Permission to use, copy, modify, distribute, and sell this software and its
7  * documentation for any purpose is hereby granted without fee, provided that
8  * the above copyright notice appear in all copies and that both that
9  * copyright notice and this permission notice appear in supporting
10  * documentation, and that the name of U.M. not be used in advertising or
11  * publicity pertaining to distribution of the software without specific,
12  * written prior permission.  U.M. makes no representations about the
13  * suitability of this software for any purpose.  It is provided "as is"
14  * without express or implied warranty.
15  *
16  */
17 /*
18  */
19 #include <amanda.h>
20 
main(void)21 int main(void)
22 {
23     FILE *sec_file = fopen("amanda-security.conf", "w");
24     if (!sec_file) {
25 	fprintf(stderr,"Can't create amanda-security.conf");
26 	exit(1);
27     }
28     fprintf(sec_file,"############################################################\n");
29     fprintf(sec_file,"# /etc/amanda-security.conf                                #\n");
30     fprintf(sec_file,"#                                                          #\n");
31     fprintf(sec_file,"# See: man amanda-security.conf                            #\n");
32     fprintf(sec_file,"#                                                          #\n");
33     fprintf(sec_file,"# This file must be installed at /etc/amanda-security.conf #\n");
34     fprintf(sec_file,"#                                                          #\n");
35     fprintf(sec_file,"# It list all executables amanda can execute as root.      #\n");
36     fprintf(sec_file,"# This file must contains realpath to executable, with     #\n");
37     fprintf(sec_file,"# all symbolic links resolved.                             #\n");
38     fprintf(sec_file,"# You can use the 'realpath' command to find them.         #\n");
39     fprintf(sec_file,"#                                                          #\n");
40     fprintf(sec_file,"# It list program and a symbolic name for the program      #\n");
41     fprintf(sec_file,"# Followed by the realpath of the binary                   #\n");
42     fprintf(sec_file,"#                                                          #\n");
43     fprintf(sec_file,"# Uncomment and edit the following lines to let Amanda to  #\n");
44     fprintf(sec_file,"# use customized system commands.  If multiple PATH is     #\n");
45     fprintf(sec_file,"# necessary, please put them in different lines.           #\n");
46     fprintf(sec_file,"# e.g.:                                                    #\n");
47     fprintf(sec_file,"# amgtar:GNUTAR_PATH=/usr/bin/tar                          #\n");
48     fprintf(sec_file,"# amgtar:GNUTAR_PATH=/usr/bin/tar-1.28                     #\n");
49     fprintf(sec_file,"#                                                          #\n");
50     fprintf(sec_file,"# If a program and symbolic name is not listed, then the   #\n");
51     fprintf(sec_file,"# configured binary is allowed to be run as root.          #\n");
52     fprintf(sec_file,"# You can find the configured binary with amgetconf        #\n");
53     fprintf(sec_file,"#     amgetconf build.gnutar_path                          #\n");
54     fprintf(sec_file,"#     amgetconf build.star_path                            #\n");
55     fprintf(sec_file,"#     amgetconf build.bsdtar_path                          #\n");
56     fprintf(sec_file,"#                                                          #\n");
57     fprintf(sec_file,"############################################################\n");
58 
59 #ifdef GNUTAR
60     fprintf(sec_file,"#runtar:gnutar_path=%s\n", GNUTAR);
61     fprintf(sec_file,"#amgtar:gnutar_path=%s\n", GNUTAR);
62 #else
63     fprintf(sec_file,"#runtar:gnutar_path=/no/default/gnutar/path\n");
64     fprintf(sec_file,"#amgtar:gnutar_path=/no/default/gnutar/path\n");
65 #endif
66 #ifdef STAR
67     fprintf(sec_file,"#amstar:star_path=%s\n", STAR);
68 #else
69     fprintf(sec_file,"#amstar:star_path=/no/default/star/path\n");
70 #endif
71 #ifdef BSDTAR
72     fprintf(sec_file,"#ambsdtar:bsdtar_path=%s\n", BSDTAR);
73 #else
74     fprintf(sec_file,"#ambsdtar:bsdtar_path=/no/default/bsdtar/path\n");
75 #endif
76 
77     fprintf(sec_file,"\n");
78     fprintf(sec_file,"#restore_by_amanda_user=no\n");
79     fclose(sec_file);
80 
81     return 0;
82 }
83 
84