Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Cranspasswords
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gabriel Detraz
Cranspasswords
Commits
8baac337
Commit
8baac337
authored
Apr 10, 2013
by
Vincent Le gallic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Possibilité de déclarer le serveur comme read-only
parent
81233f5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
server.py
server.py
+5
-1
serverconfig.example.py
serverconfig.example.py
+3
-0
No files found.
server.py
View file @
8baac337
...
...
@@ -12,7 +12,7 @@ import datetime
from
email.mime.text
import
MIMEText
from
email.mime.multipart
import
MIMEMultipart
from
serverconfig
import
CRANSP_MAIL
,
DEST_MAIL
,
KEYS
,
ROLES
,
STORE
from
serverconfig
import
READONLY
,
CRANSP_MAIL
,
DEST_MAIL
,
KEYS
,
ROLES
,
STORE
MYUID
=
pwd
.
getpwuid
(
os
.
getuid
())[
0
]
if
MYUID
==
'root'
:
...
...
@@ -153,11 +153,15 @@ def notification(subject,corps,fname,old):
conn
.
sendmail
(
frommail
,
tomail
,
msg
.
as_string
())
conn
.
quit
()
WRITE_COMMANDS
=
[
"putfile"
,
"rmfile"
]
if
__name__
==
"__main__"
:
argv
=
sys
.
argv
[
1
:]
if
len
(
argv
)
not
in
[
1
,
2
]:
sys
.
exit
(
1
)
command
=
argv
[
0
]
if
READONLY
and
command
in
WRITE_COMMANDS
:
raise
IOError
(
"Ce serveur est read-only."
)
filename
=
None
try
:
filename
=
argv
[
1
]
...
...
serverconfig.example.py
View file @
8baac337
...
...
@@ -10,6 +10,9 @@ Dans le futur, sera remplacé par une connexion ldap.
STORE
=
'/root/cranspasswords/db/'
""" Répertoire de stockage """
READONLY
=
False
""" Ce serveur est-il read-only (on ne peut pas y modifier les mots de passe) """
CRANSP_MAIL
=
"cranspasswords <root@crans.org>"
""" Expéditeur du mail de notification """
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment