Début de restructuration
This commit is contained in:
parent
bfb5dbb98d
commit
d994ae836f
8 changed files with 95 additions and 91 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
clientconfig.py
|
||||
serverconfig.py
|
||||
*.pyc
|
11
README
Normal file
11
README
Normal file
|
@ -0,0 +1,11 @@
|
|||
Bienvenue sur l'outil de gestion de mot de passe du Cr@ns.
|
||||
Ce dépôt git contient à la fois le programme client (à utiliser sur votre
|
||||
ordinateur) et le serveur.
|
||||
|
||||
== Installation et configuration du client ==
|
||||
* Copier le dépôt git sur votre ordinateur:
|
||||
$ git clone git://git.crans.org/git/cranspasswords.git
|
||||
* Copier clientconfig.example.py en clientconfig.py et adapter
|
||||
à vos besoins
|
||||
* ???
|
||||
|
28
converter.py
28
converter.py
|
@ -1,28 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
import json
|
||||
import glob
|
||||
import os,sys
|
||||
# Basic converter to json, avec roles nounous partout
|
||||
|
||||
init_path = '/home/dstan/crans/passwords/'
|
||||
final_path = '/home/dstan/crans/passwords/v2/'
|
||||
|
||||
os.chdir(init_path)
|
||||
|
||||
filenames = glob.glob('*.asc')
|
||||
|
||||
encoder=json.JSONEncoder()
|
||||
for filename in filenames:
|
||||
fname=final_path+filename[:-4]+'.json'
|
||||
if os.path.exists(fname):
|
||||
print "%s already exists, ignored" % filename
|
||||
continue
|
||||
else:
|
||||
print "Traitement de %s" % filename
|
||||
nf = file(fname,'w')
|
||||
|
||||
nf.write(encoder.encode({'roles':['nounous']\
|
||||
,'contents':open(filename).read()}))
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
sudo /root/cranspasswords/cranspasswords-server.py $*
|
|
@ -10,7 +10,7 @@ import os
|
|||
import atexit
|
||||
import argparse
|
||||
import re
|
||||
import config
|
||||
import clientconfig as config
|
||||
|
||||
## Password pattern in files:
|
||||
PASS = re.compile('[\t ]*pass(?:word)?[\t ]*:[\t ]*(.*)\r?\n?$', \
|
||||
|
@ -222,7 +222,7 @@ def show_files():
|
|||
os.waitpid(proc.pid,0)
|
||||
|
||||
def show_roles():
|
||||
print """Liste des roles disponibles"""
|
||||
print """Liste des roles disponibles"""
|
||||
for role in all_roles().keys():
|
||||
if role.endswith('-w'): continue
|
||||
print " * " + role
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
"""cranspasswords-server.py: Serveur pour cranspasswords"""
|
||||
|
||||
MYDIR = '/root/cranspasswords/'
|
||||
STORE = MYDIR+'db/'
|
||||
|
||||
import glob
|
||||
import os
|
||||
import pwd
|
||||
|
@ -15,66 +12,12 @@ import datetime
|
|||
from email.mime.text import MIMEText
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
|
||||
from serverconfig import CRANSP_MAIL, DEST_MAIL, KEYS, ROLES, STORE
|
||||
|
||||
MYUID = pwd.getpwuid(os.getuid())[0]
|
||||
if MYUID == 'root':
|
||||
MYUID = os.environ['SUDO_USER']
|
||||
|
||||
CRANSP_MAIL = "root@crans.org"
|
||||
DEST_MAIL = "root@crans.org"
|
||||
|
||||
KEYS = {
|
||||
"aza-vallina": ("Damien.Aza-Vallina@crans.org", None),
|
||||
"dandrimont": ("nicolas.dandrimont@crans.org", "66475AAF"),
|
||||
"blockelet": ("blockelet@crans.org", "AF087A52"),
|
||||
"chambart": ("pierre.chambart@crans.org", "F2530FCE"),
|
||||
"dimino": ("jdimino@dptinfo.ens-cachan.fr", "2127F85A"),
|
||||
"durand-gasselin": ("adg@crans.org", "8E96ACDA"),
|
||||
"glondu": ("Stephane.Glondu@crans.org", "49881AD3"),
|
||||
"huber": ("olivier.huber@crans.org", "E0DCF376"),
|
||||
"lagorce": ("xavier.lagorce@crans.org", "0BF3708E"),
|
||||
"parret-freaud": ("parret-freaud@crans.org", "7D980513"),
|
||||
"tvincent": ("vincent.thomas@crans.org", "C5C4ACC0"),
|
||||
"iffrig": ("iffrig@crans.org","5BEC9A2F"),
|
||||
"becue": ("becue@crans.org", "194974E2"),
|
||||
"dstan": ("daniel.stan@crans.org", "6E1C820B"),
|
||||
"samir": ("samir@crans.org", "41C2B76B"),
|
||||
"boilard": ("boilard@crans.org", "C39EB6F4"),
|
||||
"cauderlier": ("cauderlier@crans.org",None), #Méchant pas beau
|
||||
"maioli": ("maioli@crans.org",None), #Bis (maybe 9E5026E8)
|
||||
"legallic": ("legallic@crans.org", "3784CFC3"),
|
||||
}
|
||||
|
||||
RTC=[
|
||||
"iffrig"
|
||||
]
|
||||
NOUNOUS=RTC+[
|
||||
"blockelet",
|
||||
"becue",
|
||||
"dstan",
|
||||
"chambart",
|
||||
"dimino",
|
||||
"durand-gasselin",
|
||||
"glondu",
|
||||
"huber",
|
||||
"lagorce",
|
||||
"parret-freaud",
|
||||
"cauderlier",
|
||||
"maioli",
|
||||
"samir",
|
||||
"boilard",
|
||||
"legallic",
|
||||
]
|
||||
|
||||
CA=[]
|
||||
|
||||
ROLES = {
|
||||
"ca": CA,
|
||||
"ca-w": CA,
|
||||
"nounous": NOUNOUS,
|
||||
"nounous-w": NOUNOUS,
|
||||
}
|
||||
|
||||
|
||||
def validate(roles,mode='r'):
|
||||
"""Valide que l'appelant appartient bien aux roles précisés
|
||||
Si mode mode='w', recherche un rôle en écriture
|
77
serverconfig.example.py
Executable file
77
serverconfig.example.py
Executable file
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
""" Configuration Serveur de cranspasswords.
|
||||
Sont définis ici les utilisateurs et les rôles associés.
|
||||
Ce fichier est donné à titre d'exemple, mais n'est PAS
|
||||
utilisé lorsque fonctionnement en mode client.
|
||||
Dans le futur, sera remplacé par une connexion ldap.
|
||||
"""
|
||||
|
||||
STORE = '/root/cranspasswords/db/'
|
||||
""" Répertoire de stockage """
|
||||
|
||||
CRANSP_MAIL = "root@crans.org"
|
||||
""" Expéditeur du mail de notification """
|
||||
|
||||
DEST_MAIL = "root@crans.org"
|
||||
""" Destinataire du mail de notification """
|
||||
|
||||
|
||||
KEYS = {
|
||||
"aza-vallina": ("Damien.Aza-Vallina@crans.org", None),
|
||||
"dandrimont": ("nicolas.dandrimont@crans.org", "66475AAF"),
|
||||
"blockelet": ("blockelet@crans.org", "AF087A52"),
|
||||
"chambart": ("pierre.chambart@crans.org", "F2530FCE"),
|
||||
"dimino": ("jdimino@dptinfo.ens-cachan.fr", "2127F85A"),
|
||||
"durand-gasselin": ("adg@crans.org", "8E96ACDA"),
|
||||
"glondu": ("Stephane.Glondu@crans.org", "49881AD3"),
|
||||
"huber": ("olivier.huber@crans.org", "E0DCF376"),
|
||||
"lagorce": ("xavier.lagorce@crans.org", "0BF3708E"),
|
||||
"parret-freaud": ("parret-freaud@crans.org", "7D980513"),
|
||||
"tvincent": ("vincent.thomas@crans.org", "C5C4ACC0"),
|
||||
"iffrig": ("iffrig@crans.org","5BEC9A2F"),
|
||||
"becue": ("becue@crans.org", "194974E2"),
|
||||
"dstan": ("daniel.stan@crans.org", "6E1C820B"),
|
||||
"samir": ("samir@crans.org", "41C2B76B"),
|
||||
"boilard": ("boilard@crans.org", "C39EB6F4"),
|
||||
"cauderlier": ("cauderlier@crans.org",None), #Méchant pas beau
|
||||
"maioli": ("maioli@crans.org",None), #Bis (maybe 9E5026E8)
|
||||
"legallic": ("legallic@crans.org", "3784CFC3"),
|
||||
}
|
||||
|
||||
# Les variables suivantes sont utilisées pour définir le dictionnaire des
|
||||
# rôles.
|
||||
RTC=[
|
||||
"iffrig"
|
||||
]
|
||||
NOUNOUS=RTC+[
|
||||
"blockelet",
|
||||
"becue",
|
||||
"dstan",
|
||||
"chambart",
|
||||
"dimino",
|
||||
"durand-gasselin",
|
||||
"glondu",
|
||||
"huber",
|
||||
"lagorce",
|
||||
"parret-freaud",
|
||||
"cauderlier",
|
||||
"maioli",
|
||||
"samir",
|
||||
"boilard",
|
||||
"legallic",
|
||||
]
|
||||
|
||||
CA=[
|
||||
"samir",
|
||||
"iffrig",
|
||||
"cauderlier",
|
||||
]
|
||||
|
||||
## Les vrais rôles !
|
||||
ROLES = {
|
||||
"ca": CA,
|
||||
"ca-w": CA,
|
||||
"nounous": NOUNOUS,
|
||||
"nounous-w": NOUNOUS,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue