getAllowedSSHPrincipals from config

This commit is contained in:
Jakobus Schürz 2019-08-02 00:58:21 +02:00
parent 46278d689f
commit 4497a2b71e
2 changed files with 11 additions and 2 deletions

View file

@ -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):

View file

@ -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