Examples of SshKey


Examples of org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.security.SSHKey

        final _CustomizationRequest cust;
        final String keyname = launchSpec.getKeyName();
        if (keyname != null && this.sshKeys != null) {
            cust = this.repr._newCustomizationRequest();
            final SSHKey key = this.sshKeys.findKey(ownerID, keyname);
            if (key == null) {
                throw new RemoteException("There is no key '" + keyname +
                        "' registered for you to use");
            }
            cust.setContent(key.getPubKeyValue());
            cust.setPathOnVM("/root/.ssh/authorized_keys");
        } else {
            cust = null;
        }
View Full Code Here

Examples of org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.security.SSHKey

        final _CustomizationRequest cust;
        final String keyname = req.getKeyName();
        if (keyname != null && this.sshKeys != null) {
            cust = this.repr._newCustomizationRequest();
            final SSHKey key = this.sshKeys.findKey(ownerID, keyname);
            if (key == null) {
                throw new RemoteException("There is no key '" + keyname +
                        "' registered for you to use");
            }
            cust.setContent(key.getPubKeyValue());
            cust.setPathOnVM("/root/.ssh/authorized_keys");
        } else {
            cust = null;
        }
View Full Code Here

Examples of org.nimbustools.messaging.gt4_0_elastic.v2008_05_05.security.SSHKey

        }
        if (fingerprint == null) {
            throw new IllegalArgumentException("fingerprint may not be null");
        }

        final SSHKey key = new SSHKey(ownerID, keyName,
                                      pubKeyContent, fingerprint);

        try {
            final boolean exists = persistence.getSSHKey(ownerID, keyName) != null;
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

    Machine machine = instances.findMachine(gitService);
    if (machine == null) {
      throw new OpsException("Server machine not found:" + gitService);
    }

    SshKey sshKey = service.getSshKey();
    OpsTarget target = machine.getTarget(sshKey);

    getRecursionState().pushChildScope(OpsTarget.class, target);
  }
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

    addChild(ItemTagger.build(tag));
  }

  private void addDirectStore(ImageStore model) throws OpsException {
    // Serious bootstrapping problem here!!!
    SshKey serviceKey = service.getSshKey();
    PublicKey sshPublicKey = serviceKey.getKeyPair().getPublic();

    OpaqueMachine machine = new OpaqueMachine(NetworkPoint.forPublicHostname(model.dnsName));
    OpsTarget target = machine.getTarget("imagestore", serviceKey.getKeyPair());

    SshAuthorizedKey.ensureSshAuthorization(target, "imagestore", sshPublicKey);

    // addChild(SshAuthorizedKey.build("root", publicKey));
  }
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

    if (url.getScheme().equals("ssh")) {
      String myAddress = url.getHost();
      Machine machine = new OpaqueMachine(NetworkPoint.forPublicHostname(myAddress));
      // This is nasty; we're in the context of another service here...
      SshKey sshKey = sshKeys.findOtherServiceKey(new ServiceType("imagestore"));
      OpsTarget target = machine.getTarget("imagestore", sshKey.getKeyPair());

      DirectImageStore directImageStore = OpsContext.get().getInjector().getInstance(DirectImageStore.class);
      directImageStore.connect(target);
      return directImageStore;
    } else {
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

    String hostname = "openstack";

    MachineCreationRequest request = new MachineCreationRequest();

    SshKey sshKey = service.getSshKey();

    // There are problems using LXC with debootstrap
    request.hostPolicy = new HostPolicy();
    request.hostPolicy.allowRunInContainer = false;

    request.recipeId = null; // Null means 'use bootstrap image'
    request.sshPublicKey = sshKey.getKeyPair().getPublic();
    request.sshPublicKeyName = service.getSshKeyName();
    request.securityGroups = Lists.newArrayList();

    String securityGroup = service.getSecurityGroupName();
    request.securityGroups.add(securityGroup);
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

          waitOperation(powerOnOperation);
        }

        machine = new OpenstackComputeMachine(openstack, cloud, server);

        SshKey sshKey = service.getSshKey();
        target = machine.getTarget(sshKey);
      }
    }

    if (!assignedInstanceIds.isEmpty() && OpsContext.isDelete()) {
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

  @Override
  public PublicKey getSshPublicKey() throws OpsException {
    ServiceContext serviceContext = injector.getInstance(ServiceContext.class);

    SshKey sshKey = serviceContext.getSshKey();
    if (sshKey == null) {
      return null;
    }
    PublicKey publicKey = sshKey.getKeyPair().getPublic();
    return publicKey;
  }
View Full Code Here

Examples of org.platformlayer.ops.helpers.SshKey

        GitServer model = (GitServer) managed.getModel();

        Tag tag = new Tag(Tag.CONDUCTOR_ID, managed.getConductorId());

        SshKey sshKey = service.getSshKey();

        DiskImageRecipe recipe = imageFactory.loadDiskImageResource(getClass(), "DiskImageRecipe.xml");
        String securityGroup = service.getSecurityGroupName();

        int minimumMemoryMB = 256; // Git isn't particularly memory intensive (?)
        Managed<PersistentInstance> foundPersistentInstance = persistentInstances.getOrCreate(tag, recipe, model.dnsName, sshKey.getName(), securityGroup, minimumMemoryMB);

        OpenstackComputeMachine machine = persistentInstances.getMachine(foundPersistentInstance);

        OpsTarget target = machine.getTarget(sshKey);

        // target.mkdir(new File("/opt/scripts"));
        // target.setFileContents(new File("/opt/scripts/dnsdatabasemonitor"),
        // ResourceUtils.loadString(getClass(), "dnsdatabasemonitor"));
        // target.setFileContents(new
        // File("/etc/monit/conf.d/dnsdatabasemonitor"),
        // ResourceUtils.loadString(getClass(), "monitrc"));

        String adminUser = "gitadmin";
        target.executeCommand("adduser --group --system {0}", adminUser);

        File adminHomeDir = new File("/home", adminUser);
        File adminSshDir = new File(adminHomeDir, ".ssh");
        File privateKeyFile = new File(adminSshDir, "id_rsa");
        File publicKeyFile = new File(adminSshDir, "id_rsa.pub");
        File authorizedKeys = new File(adminSshDir, "authorized_keys");

        target.mkdir(adminSshDir);

        String passphrase = "";
        target.executeCommand("ssh-keygen -t rsa -f {0} -P {1}", privateKeyFile, passphrase);

        String privateKeyData = target.readTextFile(privateKeyFile);
        String publicKeyData = target.readTextFile(publicKeyFile);

        target.executeCommand("cat {0} | sudo -H -u gitosis gitosis-init", publicKeyFile);

        target.setFileContents(authorizedKeys, publicKeyData);
        target.executeCommand("chown -R {0} {1}", adminUser, adminSshDir);
        target.executeCommand("chmod -R 600 {0}", adminSshDir);
        target.executeCommand("chmod 700 {0}", adminSshDir);

        target.executeCommand("chsh -s /bin/bash {0}", adminUser);

        SshKey adminSshKey = new SshKey(null, adminUser, KeyPairUtils.deserialize(privateKeyData));

        OpsTarget adminTarget = machine.getTarget(adminSshKey);
        {
            ProcessExecution execution = adminTarget.executeCommand("ssh-keyscan 127.0.0.1");
            File knownHosts = new File(adminSshDir, "known_hosts");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.