Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cranspasswords
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daniel Stan
Cranspasswords
Commits
8baac337
Commit
8baac337
authored
11 years ago
by
Vincent Le gallic
Browse files
Options
Downloads
Patches
Plain Diff
Possibilité de déclarer le serveur comme read-only
parent
81233f5b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server.py
+5
-1
5 additions, 1 deletion
server.py
serverconfig.example.py
+3
-0
3 additions, 0 deletions
serverconfig.example.py
with
8 additions
and
1 deletion
server.py
+
5
−
1
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
]
...
...
This diff is collapsed.
Click to expand it.
serverconfig.example.py
+
3
−
0
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
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment