getAllowedSSHPrincipals from config
This commit is contained in:
parent
46278d689f
commit
4497a2b71e
2 changed files with 11 additions and 2 deletions
|
@ -23,9 +23,11 @@ def serve_principal(sshUser, principals):
|
|||
|
||||
if '@' in sshUser:
|
||||
for user in [ sshUser, sshUser.split('@')[0] ]:
|
||||
print TEMPLATE % dict(user=user, principals=principals)
|
||||
print TEMPLATE % dict(user=user,
|
||||
principals=getAllowedSSHPrincipals(cfg))
|
||||
else:
|
||||
print TEMPLATE % dict(user=sshUser, principals=principals)
|
||||
print TEMPLATE % dict(user=sshUser,
|
||||
principals=util.getAllowedSSHPrincipals(cfg))
|
||||
|
||||
|
||||
class Main(app.App):
|
||||
|
|
|
@ -41,3 +41,10 @@ def getSSHPrincipalsPath(config):
|
|||
except (NoSectionError, NoOptionError):
|
||||
path = os.path.expanduser('~/.ssh/principals')
|
||||
return path
|
||||
|
||||
def getAllowedSSHPrincipals(config):
|
||||
try:
|
||||
principals = config.get('gitosis', 'allowedPrincipals')
|
||||
except (NoSectionError, NoOptionError):
|
||||
principals = "git"
|
||||
return path
|
||||
|
|
Loading…
Reference in a new issue