~launchpad-pqm/launchpad/devel

10693.2.7 by Jonathan Lange
Parametrize the portal in the SSH service
1
# Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
8687.15.8 by Karl Fogel
Add the copyright header block to more files.
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
0.1.8 by Andrew Bennetts
Copyright notices, explain how to use .tac file
4
# This is a Twisted application config file.  To run, use:
5
#     twistd -noy sftp.tac
6
# or similar.  Refer to the twistd(1) man page for details.
7
3858.1.12 by jml at canonical
Make the SFTP tac file use the service defined in c.l.daemons.sftp
8
from twisted.application import service
9
10693.2.11 by Jonathan Lange
Parametrize a bunch of other things
10
from canonical.config import config
11765.1.1 by Robert Collins
Split out the launchpad-buildd needed component from tachandler.py.
11
from canonical.launchpad.daemons import readyservice
10693.2.11 by Jonathan Lange
Parametrize a bunch of other things
12
10693.3.27 by Jonathan Lange
Move the codehosting-specific stuff out of service and into daemon
13
from lp.codehosting.sshserver.daemon import (
10693.4.2 by Jonathan Lange
Fix a bunch of stupid oversights
14
    ACCESS_LOG_NAME, get_key_path, LOG_NAME, make_portal, OOPS_CONFIG_SECTION,
10693.3.32 by Jonathan Lange
Oops. Missed another.
15
    PRIVATE_KEY_FILE, PUBLIC_KEY_FILE)
10693.5.6 by Jonathan Lange
Move the service logic
16
from lp.services.sshserver.service import SSHService
10693.2.7 by Jonathan Lange
Parametrize the portal in the SSH service
17
18
10693.2.8 by Jonathan Lange
Fix old, old comment
19
# Construct an Application that has the codehosting SSH server.
0.1.3 by Andrew Bennetts
Remove cruft, flesh out the code and a sample tac file a bit more
20
application = service.Application('sftponly')
10693.2.9 by Jonathan Lange
Push the key path parametrization out to the SSH service
21
svc = SSHService(
22
    portal=make_portal(),
23
    private_key_path=get_key_path(PRIVATE_KEY_FILE),
10693.2.11 by Jonathan Lange
Parametrize a bunch of other things
24
    public_key_path=get_key_path(PUBLIC_KEY_FILE),
10693.4.2 by Jonathan Lange
Fix a bunch of stupid oversights
25
    oops_configuration=OOPS_CONFIG_SECTION,
26
    main_log=LOG_NAME,
27
    access_log=ACCESS_LOG_NAME,
28
    access_log_path=config.codehosting.access_log,
10693.2.19 by Jonathan Lange
Fix invocation
29
    strport=config.codehosting.port,
10693.2.11 by Jonathan Lange
Parametrize a bunch of other things
30
    idle_timeout=config.codehosting.idle_timeout,
31
    banner=config.codehosting.banner)
2902.2.32 by Andrew Bennetts
Move authserver config into launchpad.conf; remove test-only variants of authserver.tac and sftp.tac; remove a hard-coded path from a test.
32
svc.setServiceParent(application)
0.1.3 by Andrew Bennetts
Remove cruft, flesh out the code and a sample tac file a bit more
33
2902.2.32 by Andrew Bennetts
Move authserver config into launchpad.conf; remove test-only variants of authserver.tac and sftp.tac; remove a hard-coded path from a test.
34
# Service that announces when the daemon is ready
11765.1.1 by Robert Collins
Split out the launchpad-buildd needed component from tachandler.py.
35
readyservice.ReadyService().setServiceParent(application)