예제 #1
0
  /**
   * Initialize X509 certificate settings. Read settings from database, fallback reading from
   * property file if settings could not be read from database.
   */
  public void initializeX509() {

    this.X509_ROOT_SUBJECT = ConfigurationQueries.getValue(ConfigurationQueries.X509_ROOT_SUBJECT);
    this.X509_ROOT_VALID_FROM =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_ROOT_VALID_FROM);
    this.X509_ROOT_VALID_TO =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_ROOT_VALID_TO);
    this.X509_SERVER_SUBJECT =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_SERVER_SUBJECT);
    this.X509_SERVER_VALID_FOR =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_SERVER_VALID_FOR);
    this.X509_SERVER_VALID_FROM =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_SERVER_VALID_FROM);
    this.X509_CLIENT_SUBJECT =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_CLIENT_SUBJECT);
    this.X509_CLIENT_VALID_FOR =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_CLIENT_VALID_FOR);
    this.X509_CLIENT_VALID_FROM =
        ConfigurationQueries.getValue(ConfigurationQueries.X509_CLIENT_VALID_FROM);
    this.X509_KEY_STRENGTH = ConfigurationQueries.getValue(ConfigurationQueries.X509_KEY_STRENGTH);

    ResourceBundle rootCertBundle = null;
    ResourceBundle serverCertBundle = null;
    ResourceBundle clientCertBundle = null;
    try {
      rootCertBundle = ResourceBundle.getBundle(Constants.ROOT_BUNDLE_NAME);
      serverCertBundle = ResourceBundle.getBundle(Constants.SERVER_BUNDLE_NAME);
      clientCertBundle = ResourceBundle.getBundle(Constants.CLIENT_BUNDLE_NAME);

      if (this.X509_ROOT_SUBJECT == null || "".equals(this.X509_ROOT_SUBJECT))
        this.X509_ROOT_SUBJECT = rootCertBundle.getString("subject");
      if (this.X509_ROOT_VALID_FROM == null || "".equals(this.X509_ROOT_VALID_FROM))
        this.X509_ROOT_VALID_FROM = formatStartDate(rootCertBundle.getString("startDate"));
      if (this.X509_ROOT_VALID_TO == null || "".equals(this.X509_ROOT_VALID_TO))
        this.X509_ROOT_VALID_TO = formatEndDate(rootCertBundle.getString("endDate"));

      if (this.X509_SERVER_SUBJECT == null || "".equals(this.X509_SERVER_SUBJECT))
        this.X509_SERVER_SUBJECT = serverCertBundle.getString("subject");
      if (this.X509_SERVER_VALID_FROM == null || "".equals(this.X509_SERVER_VALID_FROM))
        this.X509_SERVER_VALID_FROM = formatStartDate(serverCertBundle.getString("startDate"));
      if (this.X509_SERVER_VALID_FOR == null || "".equals(this.X509_SERVER_VALID_FOR))
        this.X509_SERVER_VALID_FOR = Integer.toString(Constants.DEFAULT_SERVER_CERT_VALIDITY);

      if (this.X509_CLIENT_SUBJECT == null || "".equals(this.X509_CLIENT_SUBJECT))
        this.X509_CLIENT_SUBJECT = clientCertBundle.getString("subject");
      if (this.X509_CLIENT_VALID_FROM == null || "".equals(this.X509_CLIENT_VALID_FROM))
        this.X509_CLIENT_VALID_FROM = formatStartDate(clientCertBundle.getString("startDate"));
      if (this.X509_CLIENT_VALID_FOR == null || "".equals(this.X509_CLIENT_VALID_FOR))
        this.X509_CLIENT_VALID_FOR = Integer.toString(Constants.DEFAULT_CLIENT_CERT_VALIDITY);

      if (this.X509_KEY_STRENGTH == null || "".equals(this.X509_KEY_STRENGTH))
        this.X509_KEY_STRENGTH = rootCertBundle.getString("key_strength");

    } catch (MissingResourceException mre) {
      logger.log(Level.SEVERE, "Error: *_cert.properties could not be read", mre);
    }
  }
예제 #2
0
 /**
  * Sets the status, if the default database or an external database will be used
  *
  * @param defaultDB true, if the default database will be used
  */
 public void setUseDefaultDB(boolean defaultDB) {
   this.USE_DEFAULT_DB = defaultDB;
   ConfigurationQueries.setValue(
       ConfigurationQueries.USE_DEFAULT_DB,
       defaultDB + "",
       DBConnector.getInstance().getBaseConnection());
 }
예제 #3
0
  /**
   * Helper Function to initialize Window Positioning
   *
   * @param query the query for the db
   * @param fallback_pos fallback value for position
   * @param screen size of the screen
   * @return the position for the window
   */
  private int setWindowPosition(String query, int fallback_pos, int screen) {
    int pos;
    String get_pos = ConfigurationQueries.getValue(query);
    if (!StringUtils.isEmptyOrWhitespaces(get_pos)) pos = Integer.parseInt(get_pos);
    else pos = fallback_pos;

    if (pos > screen) {
      pos = fallback_pos;
    }

    return pos;
  }
예제 #4
0
 public void setGuiShowOpenVPNIpWarningDialog(boolean show) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.GUI_SHOW_OPENVPN_IP_WARNING_DIALOG, show + "");
   this.GUI_SHOW_OPENVPN_IP_WARNING = show;
 }
예제 #5
0
 public void setGuiShowExitDialog(boolean showExitDialog) {
   ConfigurationQueries.setValue(ConfigurationQueries.GUI_SHOW_EXIT_DIALOG, showExitDialog + "");
   this.GUI_SHOW_EXIT_DIALOG = showExitDialog;
 }
예제 #6
0
 public void setGuiShowCRL(boolean showCRL) {
   ConfigurationQueries.setValue(ConfigurationQueries.GUI_SHOW_CRL_TAB, showCRL + "");
   this.GUI_SHOW_CRL_TAB = showCRL;
 }
예제 #7
0
 public void setX509GuiLocationY(int locationY) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_GUI_LOCATION_Y, locationY + "");
   this.X509_GUI_LOCATION_Y = locationY;
 }
예제 #8
0
 public void setX509GuiWidth(int width) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_GUI_WIDTH, width + "");
   this.X509_GUI_WIDTH = width;
 }
예제 #9
0
 public void setUpdateProxyPassword(String proxyPassword) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_PROXY_PASSWORD, proxyPassword);
   UDPATE_PROXY_PASSWORD = proxyPassword;
 }
예제 #10
0
 public void setX509ClientSubject(String x509_client_subject) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_CLIENT_SUBJECT, x509_client_subject);
   this.X509_CLIENT_SUBJECT = x509_client_subject;
 }
예제 #11
0
 public void setX509ServerValidFor(String x509_server_valid_for) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.X509_SERVER_VALID_FOR, x509_server_valid_for);
   this.X509_SERVER_VALID_FOR = x509_server_valid_for;
 }
예제 #12
0
 public void setX509ServerValidFrom(String x509_server_valid_from) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.X509_SERVER_VALID_FROM, x509_server_valid_from);
   this.X509_SERVER_VALID_FROM = x509_server_valid_from;
 }
예제 #13
0
 public void setX509ServerSubject(String x509_server_subject) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_SERVER_SUBJECT, x509_server_subject);
   this.X509_SERVER_SUBJECT = x509_server_subject;
 }
예제 #14
0
 public void setX509RootValidTo(String x509_root_valid_to) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_ROOT_VALID_TO, x509_root_valid_to);
   this.X509_ROOT_VALID_TO = x509_root_valid_to;
 }
예제 #15
0
 public void setX509RootValidFrom(String x509_root_valid_from) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_ROOT_VALID_FROM, x509_root_valid_from);
   this.X509_ROOT_VALID_FROM = x509_root_valid_from;
 }
예제 #16
0
 public void setUpdateProxyPort(String proxyPort) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_PROXY_PORT, proxyPort);
   UPDATE_PROXY_PORT = proxyPort;
 }
예제 #17
0
 public void setUpdateProxyUsername(String proxyUsername) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_PROXY_USERNAME, proxyUsername);
   UPDATE_PROXY_USERNAME = proxyUsername;
 }
예제 #18
0
 public void setX509ClientValidFrom(String x509_client_valid_from) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.X509_CLIENT_VALID_FROM, x509_client_valid_from);
   this.X509_CLIENT_VALID_FROM = x509_client_valid_from;
 }
예제 #19
0
 public void setX509GuiHeight(int height) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_GUI_HEIGHT, height + "");
   this.X509_GUI_HEIGHT = height;
 }
예제 #20
0
 public void setX509ClientValidFor(String x509_client_valid_for) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.X509_CLIENT_VALID_FOR, x509_client_valid_for);
   this.X509_CLIENT_VALID_FOR = x509_client_valid_for;
 }
예제 #21
0
 public void setX509GuiLocationX(int locationX) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_GUI_LOCATION_X, locationX + "");
   this.X509_GUI_LOCATION_X = locationX;
 }
예제 #22
0
 public void setX509KeyStrength(String x509_key_strength) {
   ConfigurationQueries.setValue(ConfigurationQueries.X509_KEY_STRENGTH, x509_key_strength);
   this.X509_KEY_STRENGTH = x509_key_strength;
 }
예제 #23
0
 public void setServerUserTreeDividerLocation(int serverUserTreeDividerLocation) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.SERVER_USER_TREE_DIVIDER_LOCATION, serverUserTreeDividerLocation + "");
   this.SERVER_USER_TREE_DIVIDER_LOCATION = serverUserTreeDividerLocation;
 }
예제 #24
0
 public void setUpdateAutomatically(boolean autoUpdate) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_AUTOMATICALLY, autoUpdate + "");
   UPDATE_AUTOMATICALLY = autoUpdate;
 }
예제 #25
0
 public void setGuiShowCRX509(boolean crX509) {
   ConfigurationQueries.setValue(ConfigurationQueries.GUI_SHOW_CR_X509, crX509 + "");
   this.GUI_SHOW_CR_X509 = crX509;
 }
예제 #26
0
 public void setUpdateServerPath(String path) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_SERVER_PATH, path);
   UPDATE_SERVER = path;
 }
예제 #27
0
 public void setGuiShowExitDialogActiveThreads(boolean showExitDialogActiveThreads) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.GUI_SHOW_EXIT_DIALOG_ACTIVE_THREADS, showExitDialogActiveThreads + "");
   this.GUI_SHOW_EXIT_DIALOG_ACTIVE_THREADS = showExitDialogActiveThreads;
 }
예제 #28
0
 public void setUpdateRepository(String repo) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_REPOSITORY, repo);
   UPDATE_REPOSITORY = repo;
 }
예제 #29
0
 public void setCreateOpenVPNConfigFiles(boolean createOpenVPNConfigFiles) {
   ConfigurationQueries.setValue(
       ConfigurationQueries.CREATE_OPENVPN_CONFIG_FILES, createOpenVPNConfigFiles + "");
   this.CREATE_OPENVPN_CONFIG_FILES = createOpenVPNConfigFiles;
 }
예제 #30
0
 public void setUpdateProxy(String proxy) {
   ConfigurationQueries.setValue(ConfigurationQueries.UPDATE_PROXY, proxy);
   UPDATE_PROXY = proxy;
 }