Skip to content

Commit 6e941f1

Browse files
author
Richard Jones
committed
Added the Password property type.
See "pydoc roundup.password" for implementation details. Have updated some of the documentation too.
1 parent d89533c commit 6e941f1

File tree

17 files changed

+337
-67
lines changed

17 files changed

+337
-67
lines changed

CHANGES.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ Changed:
1818
. The schemas have had their page headings modified to cope with the new
1919
login handling. Existing installations should copy the interfaces.py
2020
file from the roundup lib directory to their instance home.
21+
. Passwords are now encoded by default (except exising databases which
22+
will only be encoded when the passwords are changed). The scheme used
23+
at the moment is SHA - but the code is flexible enough to take any
24+
number of encoding systems.
25+
. The roundup-admin tool always operates as the "admin" user now. Database
26+
protection should be achieved using file system protections (see the
27+
documentation for details.)
2128

2229
Fixed:
2330
. Incorrectly had a Bizar Software copyright on the cgitb.py module from
@@ -30,8 +37,8 @@ Fixed:
3037
. Fixed a deviation from the spec: trying to modify the 'id' property of
3138
an item now throws an exception.
3239
. The plain() template function now html-escapes the content.
40+
. Change message was stuffing up for multilinks with no key property.
3341

34-
--------------------
3542

3643
2001-08-30 - 0.2.8
3744
Fixed:

doc/announcement.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
Roundup 0.3.0 - an issue tracking system
22

3-
** note for existing users of extended schema
3+
** existing users _must_ read the MIGRATION.txt that accompanies the
4+
source.
45

5-
This release includes several bug fixes and usability improvements. It
6-
also switches the CGI interface authentication over from HTTP Basic to cookie
7-
based. For a more detailed in the CHANGES file accompanying the source.
6+
This release includes several bug fixes and usability improvements. It
7+
switches the CGI interface authentication over from HTTP Basic to cookie
8+
based. It introduces encoded password storage. For a more detailed in
9+
the CHANGES file accompanying the source.
810

911
Roundup is a simple-to-use and -install issue-tracking system with
1012
command-line, web and e-mail interfaces. It is based on the winning design

doc/index.html

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ <h1>Contents</h1>
2121
<li><a href="#startcmd">Command Line Tool</a>
2222
<li><a href="#startweb">E-Mail Interface</a>
2323
<li><a href="#startweb">Web Interface</a>
24-
<li><a href="#users">Users</a> (Users and permissions, Adding users)
24+
<li><a href="#users">Users and Access Control</a> (Users and permissions, Adding users)
2525
<li><a href="#issues">Issues</a>
2626
</ul>
2727
<li><a href="#guide">User Guide</a>
@@ -126,6 +126,14 @@ <h2><a name="startcmd">Command Line Tool</a></h2>
126126
<li>Administration user "admin" password.
127127
</ol>
128128

129+
You should also think about whether there is going to be controlled access
130+
to the instance on the machine the instance is running on. That is, who can
131+
actually make changes to the database using the roundup-admin tool. See
132+
the section on <a href="#users">Users and Access Control</a> for
133+
information on how to secure your instance from the start.
134+
135+
<p>
136+
129137
Roundup is configurable using an instance_config.py file in the instance home.
130138
It should be edited before roundup is used, and may have the following
131139
variable declarations:
@@ -227,9 +235,25 @@ <h3>Users and permissions</h3>
227235
following repurcussions:
228236
<dl>
229237
<dt><strong>Command-line interface</strong>
230-
<dd>The data modification commands (create, init, retire, set) are not
231-
available without a login, and if one is not supplied on the command line
232-
(-u user:pass) then it will be prompted for.
238+
<dd>The data modification commands (create, init, retire, set) are
239+
performed as the "admin" user. It is therefore important that the database
240+
be protected by the filesystem if protection is required. On a Unix system,
241+
the easiest and most flexible method of doing so is:
242+
<ol>
243+
<li>Add a new user and group to your system (e.g. "issue_tracker")
244+
<li>When creating a new instance home, use the following commands
245+
(substituting instance_home for the directory you want to use):<br>
246+
<pre>
247+
mkdir instance_home
248+
chown issue_tracker:issue_tracker instance_home
249+
chmod g+rwxs instance_home
250+
chmod o-rwx instance_home
251+
roundup-admin -i instance_home init
252+
</pre>
253+
<li>Now, edit the /etc/group line for issue_tracker so it includes the unix
254+
logins of all the users who are going to administer your roundup instance.
255+
</ol>
256+
233257
<dt><strong>E-Mail interface</strong>
234258
<dd>Users are identified by e-mail address - a new user entry will be
235259
created for any e-mail address that is not recognised, so users are
@@ -240,12 +264,6 @@ <h3>Users and permissions</h3>
240264
automatically logged in as that user. This gives them write access.
241265
</dl>
242266
<p>
243-
There has been only a half-hearted attempt to restrict certain activities
244-
to the "admin" user. For example, the "extended" schema web interface enables
245-
some fnuctionality for the "admin" user. On the fil-side, it is possible to
246-
obtain the admin user's password using the read-only access on the command
247-
line (it would also be possible to access the database files directly to
248-
obtain this information).
249267

250268
<h3>Adding users</h3>
251269
To add users, use one of the following interfaces:
@@ -1085,7 +1103,7 @@ <h1><a name="ack">Acknowledgements</a></h1>
10851103

10861104
<p>&nbsp;</p>
10871105
<hr>
1088-
$Id: index.html,v 1.10 2001-10-08 21:49:30 richard Exp $
1106+
$Id: index.html,v 1.11 2001-10-09 07:25:59 richard Exp $
10891107
<p>&nbsp;</p>
10901108

10911109
</body></html>

roundup-admin

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: roundup-admin,v 1.21 2001-10-05 02:23:24 richard Exp $
19+
# $Id: roundup-admin,v 1.22 2001-10-09 07:25:59 richard Exp $
2020

2121
import sys
2222
if int(sys.version[0]) < 2:
2323
print 'Roundup requires python 2.0 or later.'
2424
sys.exit(1)
2525

2626
import string, os, getpass, getopt, re
27-
from roundup import date, roundupdb, init
27+
from roundup import date, roundupdb, init, password
2828
import roundup.instance
2929

3030
def usage(message=''):
@@ -180,6 +180,8 @@ def do_set(db, args):
180180
type = properties[key]
181181
if isinstance(type, hyperdb.String):
182182
continue
183+
elif isinstance(type, hyperdb.Password):
184+
props[key] = password.Password(value)
183185
elif isinstance(type, hyperdb.Date):
184186
props[key] = date.Date(value)
185187
elif isinstance(type, hyperdb.Interval):
@@ -379,11 +381,6 @@ def main():
379381
return 0
380382
if opt == '-i':
381383
instance_home = arg
382-
if opt == '-u':
383-
l = arg.split(':')
384-
name = l[0]
385-
if len(l) > 1:
386-
password = l[1]
387384
if opt == '-c':
388385
comma_sep = 1
389386

@@ -418,24 +415,18 @@ def main():
418415
if command == 'init':
419416
return do_init(instance_home, args)
420417

421-
# open the database
422-
if command in ('create', 'set', 'retire', 'freshen'):
423-
while not name:
424-
name = raw_input('Login name: ')
425-
while not password:
426-
password = getpass.getpass(' password: ')
427-
428-
# get the instance
429-
instance = roundup.instance.open(instance_home)
430-
431418
function = figureCommands().get(command, None)
432419

433420
# not a valid command
434421
if function is None:
435422
usage('Unknown command "%s"'%command)
436423
return 1
437424

438-
db = instance.open(name or 'admin')
425+
# get the instance
426+
instance = roundup.instance.open(instance_home)
427+
db = instance.open('admin')
428+
429+
# do the command
439430
try:
440431
return function(db, args[1:])
441432
finally:
@@ -449,6 +440,26 @@ if __name__ == '__main__':
449440

450441
#
451442
# $Log: not supported by cvs2svn $
443+
# Revision 1.21 2001/10/05 02:23:24 richard
444+
# . roundup-admin create now prompts for property info if none is supplied
445+
# on the command-line.
446+
# . hyperdb Class getprops() method may now return only the mutable
447+
# properties.
448+
# . Login now uses cookies, which makes it a whole lot more flexible. We can
449+
# now support anonymous user access (read-only, unless there's an
450+
# "anonymous" user, in which case write access is permitted). Login
451+
# handling has been moved into cgi_client.Client.main()
452+
# . The "extended" schema is now the default in roundup init.
453+
# . The schemas have had their page headings modified to cope with the new
454+
# login handling. Existing installations should copy the interfaces.py
455+
# file from the roundup lib directory to their instance home.
456+
# . Incorrectly had a Bizar Software copyright on the cgitb.py module from
457+
# Ping - has been removed.
458+
# . Fixed a whole bunch of places in the CGI interface where we should have
459+
# been returning Not Found instead of throwing an exception.
460+
# . Fixed a deviation from the spec: trying to modify the 'id' property of
461+
# an item now throws an exception.
462+
#
452463
# Revision 1.20 2001/10/04 02:12:42 richard
453464
# Added nicer command-line item adding: passing no arguments will enter an
454465
# interactive more which asks for each property in turn. While I was at it, I

roundup/backends/back_anydbm.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.8 2001-09-29 13:27:00 richard Exp $
18+
#$Id: back_anydbm.py,v 1.9 2001-10-09 07:25:59 richard Exp $
1919

2020
import anydbm, os, marshal
21-
from roundup import hyperdb, date
21+
from roundup import hyperdb, date, password
2222

2323
#
2424
# Now the database
@@ -104,6 +104,8 @@ def addnode(self, classname, nodeid, node):
104104
node[key] = node[key].get_tuple()
105105
elif isinstance(properties[key], hyperdb.Interval):
106106
node[key] = node[key].get_tuple()
107+
elif isinstance(properties[key], hyperdb.Password):
108+
node[key] = str(node[key])
107109

108110
# now save the marshalled data
109111
db[nodeid] = marshal.dumps(node)
@@ -126,6 +128,10 @@ def getnode(self, classname, nodeid, cldb=None):
126128
res[key] = date.Date(res[key])
127129
elif isinstance(properties[key], hyperdb.Interval):
128130
res[key] = date.Interval(res[key])
131+
elif isinstance(properties[key], hyperdb.Password):
132+
p = password.Password()
133+
p.unpack(res[key])
134+
res[key] = p
129135

130136
if not cldb: db.close()
131137
return res
@@ -220,6 +226,10 @@ def rollback(self):
220226

221227
#
222228
#$Log: not supported by cvs2svn $
229+
#Revision 1.8 2001/09/29 13:27:00 richard
230+
#CGI interfaces now spit up a top-level index of all the instances they can
231+
#serve.
232+
#
223233
#Revision 1.7 2001/08/12 06:32:36 richard
224234
#using isinstance(blah, Foo) now instead of isFooType
225235
#

roundup/backends/back_bsddb.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_bsddb.py,v 1.9 2001-08-12 06:32:36 richard Exp $
18+
#$Id: back_bsddb.py,v 1.10 2001-10-09 07:25:59 richard Exp $
1919

2020
import bsddb, os, marshal
21-
from roundup import hyperdb, date
21+
from roundup import hyperdb, date, password
2222

2323
#
2424
# Now the database
@@ -103,6 +103,8 @@ def addnode(self, classname, nodeid, node):
103103
node[key] = node[key].get_tuple()
104104
elif isinstance(properties[key], hyperdb.Interval):
105105
node[key] = node[key].get_tuple()
106+
elif isinstance(properties[key], hyperdb.Password):
107+
node[key] = str(node[key])
106108

107109
# now save the marshalled data
108110
db[nodeid] = marshal.dumps(node)
@@ -124,6 +126,10 @@ def getnode(self, classname, nodeid, cldb=None):
124126
res[key] = date.Date(res[key])
125127
elif isinstance(properties[key], hyperdb.Interval):
126128
res[key] = date.Interval(res[key])
129+
elif isinstance(properties[key], hyperdb.Password):
130+
p = password.Password()
131+
p.unpack(res[key])
132+
res[key] = p
127133

128134
if not cldb: db.close()
129135
return res
@@ -219,6 +225,9 @@ def rollback(self):
219225

220226
#
221227
#$Log: not supported by cvs2svn $
228+
#Revision 1.9 2001/08/12 06:32:36 richard
229+
#using isinstance(blah, Foo) now instead of isFooType
230+
#
222231
#Revision 1.8 2001/08/07 00:24:42 richard
223232
#stupid typo
224233
#

roundup/backends/back_bsddb3.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_bsddb3.py,v 1.7 2001-08-12 06:32:36 richard Exp $
18+
#$Id: back_bsddb3.py,v 1.8 2001-10-09 07:25:59 richard Exp $
1919

2020
import bsddb3, os, marshal
21-
from roundup import hyperdb, date
21+
from roundup import hyperdb, date, password
2222

2323
#
2424
# Now the database
@@ -103,6 +103,8 @@ def addnode(self, classname, nodeid, node):
103103
node[key] = node[key].get_tuple()
104104
elif isinstance(properties[key], hyperdb.Interval):
105105
node[key] = node[key].get_tuple()
106+
elif isinstance(properties[key], hyperdb.Password):
107+
node[key] = str(node[key])
106108

107109
# now save the marshalled data
108110
db[nodeid] = marshal.dumps(node)
@@ -124,6 +126,10 @@ def getnode(self, classname, nodeid, cldb=None):
124126
res[key] = date.Date(res[key])
125127
elif isinstance(properties[key], hyperdb.Interval):
126128
res[key] = date.Interval(res[key])
129+
elif isinstance(properties[key], hyperdb.Password):
130+
p = password.Password()
131+
p.unpack(res[key])
132+
res[key] = p
127133

128134
if not cldb: db.close()
129135
return res
@@ -219,6 +225,9 @@ def rollback(self):
219225

220226
#
221227
#$Log: not supported by cvs2svn $
228+
#Revision 1.7 2001/08/12 06:32:36 richard
229+
#using isinstance(blah, Foo) now instead of isFooType
230+
#
222231
#Revision 1.6 2001/08/07 00:24:42 richard
223232
#stupid typo
224233
#

roundup/cgi_client.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: cgi_client.py,v 1.28 2001-10-08 00:34:31 richard Exp $
18+
# $Id: cgi_client.py,v 1.29 2001-10-09 07:25:59 richard Exp $
1919

2020
import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes
2121
import base64, Cookie, time
2222

23-
import roundupdb, htmltemplate, date, hyperdb
23+
import roundupdb, htmltemplate, date, hyperdb, password
2424

2525
class Unauthorised(ValueError):
2626
pass
@@ -503,7 +503,10 @@ def login_action(self, message=None):
503503
return self.login(message='No such user "%s"'%name)
504504

505505
# and that the password is correct
506+
pw = self.db.user.get(uid, 'password')
507+
print password, pw, `pw`
506508
if password != self.db.user.get(uid, 'password'):
509+
self.make_user_anonymous()
507510
return self.login(message='Incorrect password')
508511

509512
# construct the cookie
@@ -659,6 +662,8 @@ def parsePropsFromForm(cl, form, nodeid=0):
659662
proptype = cl.properties[key]
660663
if isinstance(proptype, hyperdb.String):
661664
value = form[key].value.strip()
665+
elif isinstance(proptype, hyperdb.Password):
666+
value = password.Password(form[key].value.strip())
662667
elif isinstance(proptype, hyperdb.Date):
663668
value = date.Date(form[key].value.strip())
664669
elif isinstance(proptype, hyperdb.Interval):
@@ -701,6 +706,9 @@ def parsePropsFromForm(cl, form, nodeid=0):
701706

702707
#
703708
# $Log: not supported by cvs2svn $
709+
# Revision 1.28 2001/10/08 00:34:31 richard
710+
# Change message was stuffing up for multilinks with no key property.
711+
#
704712
# Revision 1.27 2001/10/05 02:23:24 richard
705713
# . roundup-admin create now prompts for property info if none is supplied
706714
# on the command-line.

0 commit comments

Comments
 (0)