1
2
3
4
5
6
7
8 """
9 Fichier de configuration de l'application Zephir
10 """
11 from os.path import join, dirname, abspath, isdir, isfile
12 from os import listdir
13 from creole.parsedico import parse_dico
14 import locale
15 from twisted.python import log
16 log.FileLogObserver.timeFormat = "%Y/%m/%d %H:%M:%S %Z"
17
18 conf = parse_dico()
19
20 charset = "UTF-8"
21
22 ADRESSE_LDAP = conf["adresse_ip_ldap"]
23 ADRESSE_ZEPHIR = conf["adresse_ip_eth0"]
24 BASE_LDAP = conf["ldap_base_dn"]
25 LDAP_TLS = conf["ldap_tls"]
26 LDAP_CLIENT = conf.get('activer_client_ldap', 'local')
27 SLAPD_SSL = conf.get('ldap_ssl', 'non')
28 PORT_HTTP = "8090"
29 PORT_ZEPHIR = "7080"
30 PORT_WEB = 8070
31 NO_LOCAL_AGENTS = conf.get("no_local_agents", "non")
32
33
34
35 if LDAP_CLIENT == "local" and SLAPD_SSL != "uniquement":
36 LDAP_TLS = "non"
37
38 LOG_ACTIONS = False
39 if conf.get('log_actions', 'non') == 'oui':
40
41 LOG_ACTIONS = True
42
43 USE_THREADS = False
44
45 if conf.get('zephir_use_threads', 'oui') == 'oui':
46
47 USE_THREADS = True
48 CREOLE_CACHE = False
49
50 if conf.get('zephir_creole_cache', 'oui') == 'oui':
51
52 CREOLE_CACHE = True
53
54
55 ROOT_DIR = "/usr/share/zephir/"
56 PORT_AGENT = "8090"
57 AGENT_DIR = "agents"
58 CLIENT_UPDATE_HOST = "eoleng.ac-dijon.fr"
59 CLIENT_NG_URL = "/eoleng/eole-%s-security/%s"
60 SERVEURS_MAJ_CLIENTS = conf['serveur_maj_clients']
61
62 MAIL_ADRESSE = conf["passerelle_smtp"]
63 MAIL_TLS = conf["tls_smtp"]
64 MAIL_ACCOUNT = conf["system_mail_from"]
65
66
67 PATH_ZEPHIR = "/var/lib/zephir/"
68 PATH_TEMP = join("/tmp", "zephir_temp")
69 ADRESSE_SAUVEGARDE = join(PATH_ZEPHIR, 'user_prefs')
70
71
72 cert_file = conf.get('server_cert', '') or '/etc/eole/ssl/eole.crt'
73 key_file = conf.get('server_key', '') or '/etc/eole/ssl/eole.key'
74
75
76 PRELUDE_PORT = 4691
77
78
79 DISTRIBS = {1:("Mdk 9.X", "1.X", False),
80 2:("feisty", "2.0", False),
81 3:("gutsy", "2.1", False),
82 4:("hardy", "2.2", True),
83 5:("lucid", "2.3", True),
84 6:("precise", "2.4", True)}
85
86
87 CREOLE_VERSIONS = {1:'creole1',
88 2:'creole2',
89 3:'creole2',
90 4:'creole2',
91 5:'creole2',
92 6:'creole3',
93 }
94
95 liste_modules = {}
96 PATH_DEF_MODULES = join(ROOT_DIR, 'default_modules')
97
98 liste_modules = {
99 1:['amon-1.5','sphynx-1.1','scribe-1.0','horus-1.0']
100 }
101 for num_dist in DISTRIBS.keys()[1:]:
102
103 modules = []
104 dist_dir = join(PATH_DEF_MODULES, str(num_dist))
105 for mod_name in listdir(dist_dir):
106
107 if isfile(join(dist_dir, mod_name)) and not \
108 (mod_name.endswith('~') or \
109 mod_name.endswith('.bak') or \
110 mod_name.endswith('.swp')):
111
112
113 modules.append(mod_name)
114 liste_modules[num_dist] = modules
115
116
117
118
119 allowed_upgrades = {'horus':{2:[4]},
120 'scribe':{2:[4]},
121 'amon':{2:[4]}
122 }
123
124
125 allowed_migrations = {1:[2,3,4], 4:[5,6], 5:[6]}
126
127
128 allowed_mod_edits = {4:{'amon':['amonecole'],
129 'amonecole':['amon']},
130 5:{'amon':['amonecole'],
131 'amonecole':['amon']}
132 }
133
134
135 verrous = {'uucp':['Execution des tâches Zephir'],
136 'sauvegarde':['Maj-Auto','Maj-Cd'],
137 'maj':[],
138 'configure':[],
139 'reconfigure':[]}
140
141
142 data_files = {0:('Tout', ['dicos','patchs','fichiers_perso','fichiers_zephir','zephir.eol','dico.eol','auth_keys','droits_zephir', 'droits_variante']),
143 1:('Dictionnaires/templates/patchs/configuration/clés ssh', ['dicos','patchs','fichiers_perso','zephir.eol','auth_keys']),
144 2:('Dictionnaires/templates/patchs', ['dicos','patchs','fichiers_perso']),
145 3:('Fichiers divers/paquets', ['fichiers_zephir', 'droits_zephir', 'droits_variante']),
146 4:('Configuration seulement (config.eol)', ['zephir.eol']),
147 5:('Clés ssh seulement', ['auth_keys']),
148 }
149
150
151 type_res_label = {'rne':('numéro RNE', 'etablissements', 'rne'),
152 'groupe':('numéro de groupe', 'groupes_serveurs', 'id'),
153 'id_s':('numéro de serveur', 'serveurs', 'id'),
154 'id_var':('numéro de variante', 'variantes', 'id'),
155 'id_mod':('numéro de module', 'modules', 'id'),
156 }
157
158
159 xml_table={'\\xc9':'\\xc3\\xa9',
160 '\\xe9':'\\xc3\\xa9',
161 '\\xc8':'\\xc3\\xa8',
162 '\\xe8':'\\xc3\\xa8',
163 '\\xf4':'\\xc3\\xb4',
164 '\\xe0':'\\xc3\\xa0',
165 }
166
167
168 var_portail = ['web_url', 'posh_url', 'scribe_envole_url', 'cas_domainname']
169 mod_portail = ['scribe', 'amonecole']
170
171
172 SCAN_DELAY = 300
173