Ejemplo n.º 1
0
    def _setupSslProxyCert(self):
        if self.sunstoneSslProxyCert:
            self.lighttpd_cert = self.sunstoneSslProxyCert
        else:
            dummy_cert = """
-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDQCc1NmyEZgk6u
NsZo2o8gSEGG3uANugp/TPX5BRQ/sxzPaU7tMZ9Ige567icPUWQjQG8lZiGbIL+q
m8zt3ezBNwS4LH+7OfzjISeJ8y2lo/Xdk9UUlVcBnibPYJdzh25pBXNSHBp9FAzu
GFvv2XKpY1RzGLGuE0kr4EC6Sou/Jch/NnryCEQUt5OCrzqd+qGEJxDuuTnx0uqt
8XoTULXnZuSz+v1iz31QRRomofk7POQFBLkcU1TCAfX7q1qM6/sYDxppyZHUr8PA
PAEn6M+j33HnotzyR3AkcQV+HL1XO3sC8ZM5Q7WG5md3mflgJq364wSWFPhnyt9v
y53gxtHbAgMBAAECggEAAYyRIsrM7Eu0Gkf+Ijm+ZxcipcZzFKcV/OytyDTpea/z
vvehxtJfxUJybCfp0otgm4KXUUf5aBZOVw7h78N/R9EJD/YE3XgJEgflK3nMFTer
VQMMyyJxi2mKEHE/r3SKte18dlgPOm8zyXIU/Sw5VlmO/2xnpkwud00sLjbv43R5
IeMQlptho5g+Nqo6VGODLC7xp6GXI2gBDMF89R5tgtbT9RvzpkyHyfBuW5M18k+P
PqCaY7rB3a+WCK7PJrd6pawo3RMzzTmglIl0TJCIcT25aRK1DC97utN2YdwSIuNo
RehwxsdC1KHF+Gj21BaBXRyj9IdVH26D1T5bp/6ggQKBgQDnOOF2cbrfjNeC+yyR
ooB/7xyuPmUW0XPyrKqp5LOKaOnHEhe7CrU/o3ZDdZ9NFzvsM+gFNq7E0aF07Xjq
xmkPjUZuub4SGABW9jr7DwW9FqZGoTtbDdL7TBP+ogEzJshTFH6bXNidO0SxfTUp
V7k1jpvPJdQZpXoXKdEHPow9YwKBgQDmVOrNERrnKo9g1wQ8l+N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cGn0UDO4YW+/ZcqljVHMYsa4T
SSvgQLpKi78lyH82evIIRBS3k4KvOp36oYQnEO65OfHS6q3xehNQtedm5LP6/WLP
fVBFGiah+Ts85AUEuRxTVMIB9furWozr+xgPGmnJkdSvw8A8ASfoz6Pfceei3PJH
cCRxBX4cvVc7ewLxkzlDtYbmZ3eZ+WAmrfrjBJYU+GfK32/LneDG0dsCAwEAATAN
BgkqhkiG9w0BAQUFAAOCAQEAwTIyerWZXfcDTaNwqxy59JzHm+v0UqZqKxQ2wYh2
PHGx19qA41W7trm7BlxaSwaq7iskcwgfhmmd2kXur9rs58rALDbAv7MRCQ7xfjb2
oAPTQTar2UVC4yxzeEYU7NGdqkPUC0/HeMstVdYX8W0B9UyuokjU0FAibPzFLaSu
eEIH1OTZu9Il2Co3X5ClDgc3Q/LjVQFNqhpJyUIu00tKB2nfDXrbco8L/7Q4NIJu
gxkHOHYxOMO7tclnJR3HX+8HogcWHSqPTMgJYX+ihM0E5X5lm9cWBUeAseNPasy6
3AxkYyyBEKMOcZTehs7kwvFWajUBFkvPgI3a6GsfCX5VpA==
-----END CERTIFICATE-----
"""
            filePutContent(self.lighttpd_cert, dummy_cert, neverShowData=True)
            os.chmod(self.lighttpd_cert, 0600)

        appendOrReplaceInFile(self.lighttpd_cfg, 'ssl.pemfile', 
                                   'ssl.pemfile = "%s"' % self.lighttpd_cert)
Ejemplo n.º 2
0
    def _enableSslProxy(self):
        appendOrReplaceInFile(self.lighttpd_cfg, 'ssl.engine',
                                   'ssl.engine = "enable"')

        appendOrReplaceInFile(self.lighttpd_cfg, 'server.port', 
                                   'server.port = %s' % self.sunstoneSslProxyPort)

        sunstone_proxy_cfg = '/etc/lighttpd/conf.d/sunstone-proxy.conf'
        conf = """
    server.modules += ("mod_alias")
    server.modules += ("mod_proxy")
    server.modules += ("mod_compress")
    proxy.server = ("" => ( "" => ( "host" => "127.0.0.1", "port" => %s ) ) )
    """ % self.sunstonePort
        filePutContent(sunstone_proxy_cfg, conf)
Ejemplo n.º 3
0
 def _updateSunstoneConfig(self):
     appendOrReplaceInFile(self.sunstone_cfg,
                           ':port:', ':port: %s' % self.sunstonePort)
Ejemplo n.º 4
0
 def enableIpForwarding():
     Util.printDetail('Enabling packets forwarding.')
     file(FILE_IPFORWARD_HOT_ENABLE, 'w').write('1')
     appendOrReplaceInFile(FILE_IPFORWARD_PERSIST,
                           'net.ipv4.ip_forward',
                           'net.ipv4.ip_forward = 1')
Ejemplo n.º 5
0
 def enableIpForwarding():
     Util.printDetail("Enabling packets forwarding.")
     file(FILE_IPFORWARD_HOT_ENABLE, "w").write("1")
     appendOrReplaceInFile(FILE_IPFORWARD_PERSIST, "net.ipv4.ip_forward", "net.ipv4.ip_forward = 1")