Class GridCAImpl

  • All Implemented Interfaces:
    GridCA

    public class GridCAImpl
    extends java.lang.Object
    implements GridCA
    Default implementation of the GridCA Uses the sge_ca script which is delivered with gridengine to perform actions on the gridengine ca.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void createDaemon​(java.lang.String daemon, java.lang.String user, java.lang.String email)
      Create private key and certificate for a sdm daemon.
      java.security.KeyStore createDaemonKeyStore​(java.lang.String daemon)
      Get the keystore for a daemon.
      java.security.KeyStore createKeyStore​(java.lang.String username, char[] keystorePassword, char[] privateKeyPassword)
      Create a keystore which contains the private key and certificate of an user.
      protected Expect createProcess()  
      java.security.KeyStore createSGEDaemonKeyStore​(java.lang.String daemon, char[] keystorePassword, char[] privateKeyPassword)
      Get the keystore for a SGE daemon.
      void createUser​(java.lang.String username, java.lang.String email)
      Create private key and certificate for a user.
      void createUser​(java.lang.String username, java.lang.String gecos, java.lang.String email)
      Deprecated.
      the gecos field is no longer used, use @{link #createUser(String,String)} instead
      protected void execute​(Expect pb)  
      protected void execute​(Expect pb, boolean setLock)  
      protected java.io.File getCertFileForDaemon​(java.lang.String daemon)  
      protected java.io.File getCertFileForUser​(java.lang.String username)  
      java.security.cert.X509Certificate getCertificate​(java.lang.String username)
      Get the X.509 certificate of a user.
      java.security.cert.X509Certificate getDaemonCertificate​(java.lang.String daemon)
      Get the X.509 certificate of a daemon.
      protected java.io.File getLocalDaemonDir​(java.lang.String daemon)  
      protected java.io.File getLocalUserDir​(java.lang.String username)  
      void init​(InitCAParameters params)
      Initialize the gridengine ca.
      void renewCaCertificate​(int days)
      Renew the certificate of the certificate authority
      java.security.cert.X509Certificate renewCertificate​(java.lang.String username, int days)
      Renew the certificate of a user.
      java.security.cert.X509Certificate renewDaemonCertificate​(java.lang.String daemon, int days)
      Renew the certificate of a daemon.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • createProcess

        protected Expect createProcess()
      • getLocalUserDir

        protected java.io.File getLocalUserDir​(java.lang.String username)
      • getCertFileForUser

        protected java.io.File getCertFileForUser​(java.lang.String username)
      • getLocalDaemonDir

        protected java.io.File getLocalDaemonDir​(java.lang.String daemon)
      • getCertFileForDaemon

        protected java.io.File getCertFileForDaemon​(java.lang.String daemon)
      • createUser

        public void createUser​(java.lang.String username,
                               java.lang.String gecos,
                               java.lang.String email)
                        throws GridCAException
        Deprecated.
        the gecos field is no longer used, use @{link #createUser(String,String)} instead
        Create private key and certificate for a user.
        Specified by:
        createUser in interface GridCA
        Parameters:
        username - name of the user
        gecos - gecos field of the user
        email - email address of the user
        Throws:
        GridCAException - if the creation of the private key or the certificate fails
      • createUser

        public void createUser​(java.lang.String username,
                               java.lang.String email)
                        throws GridCAException
        Create private key and certificate for a user.
        Specified by:
        createUser in interface GridCA
        Parameters:
        username - name of the user
        email - email address of the user
        Throws:
        GridCAException - if the creation of the private key or the certificate fails
      • createDaemon

        public void createDaemon​(java.lang.String daemon,
                                 java.lang.String user,
                                 java.lang.String email)
                          throws GridCAException
        Create private key and certificate for a sdm daemon.
        Specified by:
        createDaemon in interface GridCA
        Parameters:
        daemon - name of the daemon
        user - username of the daemon (owner of the process)
        email - email address of the process owner
        Throws:
        GridCAException - if the create of the daemon failed
      • getCertificate

        public java.security.cert.X509Certificate getCertificate​(java.lang.String username)
                                                          throws GridCAException
        Get the X.509 certificate of a user.
        Specified by:
        getCertificate in interface GridCA
        Parameters:
        username - name of the user
        Returns:
        X.509 certificate
        Throws:
        GridCAException - if the certificate does not exist
      • getDaemonCertificate

        public java.security.cert.X509Certificate getDaemonCertificate​(java.lang.String daemon)
                                                                throws GridCAException
        Get the X.509 certificate of a daemon.
        Specified by:
        getDaemonCertificate in interface GridCA
        Parameters:
        daemon - name of the daemon
        Returns:
        X.509 certificate
        Throws:
        GridCAException - if the certificate does not exist
      • renewCertificate

        public java.security.cert.X509Certificate renewCertificate​(java.lang.String username,
                                                                   int days)
                                                            throws GridCAException
        Renew the certificate of a user.
        Specified by:
        renewCertificate in interface GridCA
        Parameters:
        username - name of the user
        days - validity of the new certificate in days
        Returns:
        the renewed certificate
        Throws:
        GridCAException - if the certificate can not be renewed
      • renewDaemonCertificate

        public java.security.cert.X509Certificate renewDaemonCertificate​(java.lang.String daemon,
                                                                         int days)
                                                                  throws GridCAException
        Renew the certificate of a daemon.
        Specified by:
        renewDaemonCertificate in interface GridCA
        Parameters:
        daemon - name of the daemon
        days - validity of the new certificate in days
        Returns:
        the renewed certificate
        Throws:
        GridCAException - if the certificate can not be renewed
      • renewCaCertificate

        public void renewCaCertificate​(int days)
                                throws GridCAException
        Description copied from interface: GridCA
        Renew the certificate of the certificate authority
        Specified by:
        renewCaCertificate in interface GridCA
        Parameters:
        days - validity of the new certificate in days
        Throws:
        GridCAException - if the certificate can not be renewed
      • createKeyStore

        public java.security.KeyStore createKeyStore​(java.lang.String username,
                                                     char[] keystorePassword,
                                                     char[] privateKeyPassword)
                                              throws GridCAException
        Create a keystore which contains the private key and certificate of an user.
        Specified by:
        createKeyStore in interface GridCA
        Parameters:
        username - name of the user
        keystorePassword - password used for encrypt the keystore
        privateKeyPassword - password for the private key
        Returns:
        the keystore
        Throws:
        GridCAException - if the keystore could not be created
      • createDaemonKeyStore

        public java.security.KeyStore createDaemonKeyStore​(java.lang.String daemon)
                                                    throws GridCAException
        Get the keystore for a daemon. This method can be used be the installation to create keystore for the daemon of a sdm system.
        Specified by:
        createDaemonKeyStore in interface GridCA
        Parameters:
        daemon - name of the daemon
        Returns:
        the keystore of the daemon
        Throws:
        GridCAException
      • createSGEDaemonKeyStore

        public java.security.KeyStore createSGEDaemonKeyStore​(java.lang.String daemon,
                                                              char[] keystorePassword,
                                                              char[] privateKeyPassword)
                                                       throws GridCAException
        Get the keystore for a SGE daemon. This method can be used be the installation to create keystore for the daemon of a sdm system.
        Specified by:
        createSGEDaemonKeyStore in interface GridCA
        Parameters:
        daemon - name of the daemon
        keystorePassword - password used to encrypt the keystore
        privateKeyPassword - password used to encrypt the key
        Returns:
        the keystore of the daemon
        Throws:
        GridCAException