def pluginMethod(self): if ('rappublickey' not in self.rpathcfg or 'rapprivatekey' not in self.rpathcfg): return puburl = self.rpathcfg['rappublickey'] privurl = self.rpathcfg['rapprivatekey'] util.urlgrab(puburl, filename='/etc/raa/raa-service.pubkey') util.urlgrab(privurl, filename='/etc/raa/raa-service.privkey')
def configure(self): baseurl = 'http://s3.amazonaws.com/ec2-downloads/' map = { ('2.6.16', 'i686'): 'modules-2.6.16-ec2.tgz', ('2.6.16.33', 'x86_64'): 'ec2-modules-2.6.16.33-xenU-x86_64.tgz', ('2.6.18', 'i686'): 'ec2-modules-2.6.18-xenU-i686.tgz', ('2.6.18', 'x86_64'): 'ec2-modules-2.6.18-xenU-x86_64.tgz' } version = os.uname()[2].split('-')[0] arch = os.uname()[4] key = (version, arch) if key not in map: return url = baseurl + map[key] file = util.urlgrab(url, filename=tempfile.mktemp()) tf = tarfile.TarFile.gzopen(file) for member in tf.getmembers(): tf.extract(member, path='/') util.call(['depmod', '-a'])
def configure(self): baseurl = 'http://s3.amazonaws.com/ec2-downloads/' map = {('2.6.16', 'i686'): 'modules-2.6.16-ec2.tgz', ('2.6.16.33', 'x86_64'): 'ec2-modules-2.6.16.33-xenU-x86_64.tgz', ('2.6.18', 'i686'): 'ec2-modules-2.6.18-xenU-i686.tgz', ('2.6.18', 'x86_64'): 'ec2-modules-2.6.18-xenU-x86_64.tgz'} version = os.uname()[2].split('-')[0] arch = os.uname()[4] key = (version, arch) if key not in map: return url = baseurl + map[key] file = util.urlgrab(url, filename=tempfile.mktemp()) tf = tarfile.TarFile.gzopen(file) for member in tf.getmembers(): tf.extract(member, path='/') util.call(['depmod', '-a'])
def configure(self): """ [openvpn] nameserver = 192.168.1.1 search = foo.example.com bar.example.com server = myvpn.example.com port = 1194 proto = tcp ca = <compressed ca cert> cert = <compressed cert> key = <compressed cert> """ cfg = self.ud.getSection('openvpn') template = """\ client dev tun proto %(proto)s remote %(server)s %(port)s resolv-retry infinite nobind #user nobody #group nobody persist-key persist-tun ca %(cafile)s cert %(certfile)s key %(keyfile)s ns-cert-type server cipher BF-CBC comp-lzo verb 3 """ for key in ('server', 'port', 'ca', 'cert', 'key'): if key not in cfg: return if 'proto' not in cfg: cfg['proto'] = 'udp' cfgdir = os.path.join('/', 'etc', 'openvpn', 'amiconfig') util.mkdirChain(cfgdir) cfg['cafile'] = os.path.join(cfgdir, 'ca.crt') cfg['certfile'] = os.path.join(cfgdir, 'cert.crt') cfg['keyfile'] = os.path.join(cfgdir, 'key.key') util.urlgrab(cfg['ca'], filename=cfg['cafile']) cert = util.decompress(util.decode(cfg['cert'])) key = util.decompress(util.decode(cfg['key'])) open(cfg['certfile'], 'w').write(cert) open(cfg['keyfile'], 'w').write(key) cfgfile = os.path.join('/', 'etc', 'openvpn', 'amiconfig.conf') open(cfgfile, 'w').write(template % cfg) if 'nameserver' in cfg: resolv = open('/etc/resolv.conf', 'w') if 'search' in cfg: resolv.write('search %s\n' % cfg['search']) resolv.write('nameserver %s\n' % cfg['nameserver']) resolv.close()
def pluginMethod(self): if 'rapcert' not in self.rpathcfg: return url = self.rpathcfg['rapcert'] util.urlgrab(url, filename='/etc/ssl/pem/raa.pem')