<commit_before>import os
import util
from sarge import run, Capture, Feeder
from ebclient.eb_utils import EBUtils
from datetime import datetime
import time
import sys
import types
import subprocess
import shutil
import re


__author__ = 'dusanklinec'


class Ejbca(object):
    """
    EJBCA configuration & builder
    """

    # Default home dirs
    EJBCA_HOME = '/opt/ejbca_ce_6_3_1_1'
    JBOSS_HOME = '/opt/jboss-eap-6.4.0'
    JBOSS_USER = 'jboss'
    USER_HOME = '/home/ec2-user'
    SSH_USER = 'ec2-user'

    INSTALL_PROPERTIES_FILE = 'conf/install.properties'
    WEB_PROPERTIES_FILE = 'conf/web.properties'
    P12_FILE = 'p12/superadmin.p12'

    PASSWORDS_FILE = '/root/ejbca.passwords'
    DB_BACKUPS = '/root/ejbcadb'

    JBOSS_CLI = 'bin/jboss-cli.sh'

    # Default installation settings
    INSTALL_PROPERTIES = {
        'ca.name': 'ManagementCA',
        'ca.dn': 'CN=ManagementCA,O=EJBCA EnigmaBridge,C=GB',
        'ca.tokentype': 'soft',
        'ca.keytype': 'RSA',
        'ca.keyspec': '2048',
        'ca.signaturealgorithm': 'SHA256WithRSA',
        'ca.validity': '3650',
        'ca.policy': 'null'
    }

    WEB_PROPERTIES = {
        'cryptotoken.p11.lib.255.name': 'SoftHSMv1',
        'cryptotoken.p11.lib.255.file': '/usr/lib64/softhsm/libsofthsm.so',

        'httpsserver.hostname': 'localhost',
        'httpsserver.dn': 'CN=localhost,O=EJBCA EnigmaBridge,C=GB',

        'superadmin.cn': 'SuperAdmin',
        'superadmin.dn': 'CN=SuperAdmin',
        'superadmin.batch': 'true',

        # Credentials, generated at random, stored into password file
        #'httpsserver.password': '<PASSWORD>',
        #'java.trustpassword': '<PASSWORD>',
        #'superadmin.password': '<PASSWORD>',
    }

    def __init__(self, install_props=None, web_props=None, print_output=False, *args, **kwargs):
        self.install_props = install_props if install_props is not None else {}
        self.web_props = web_props if web_props is not None else {}

        self.http_pass = util.random_password(16)
        self.java_pass = util.random_password(16)
        self.superadmin_pass = util.random_password(16)

        self.print_output = print_output
<commit_msg>truststore has to be changeit - hardcoded somewhere<commit_after>import os
import util
from sarge import run, Capture, Feeder
from ebclient.eb_utils import EBUtils
from datetime import datetime
import time
import sys
import types
import subprocess
import shutil
import re


__author__ = 'dusanklinec'


class Ejbca(object):
    """
    EJBCA configuration & builder
    """

    # Default home dirs
    EJBCA_HOME = '/opt/ejbca_ce_6_3_1_1'
    JBOSS_HOME = '/opt/jboss-eap-6.4.0'
    JBOSS_USER = 'jboss'
    USER_HOME = '/home/ec2-user'
    SSH_USER = 'ec2-user'

    INSTALL_PROPERTIES_FILE = 'conf/install.properties'
    WEB_PROPERTIES_FILE = 'conf/web.properties'
    P12_FILE = 'p12/superadmin.p12'

    PASSWORDS_FILE = '/root/ejbca.passwords'
    DB_BACKUPS = '/root/ejbcadb'

    JBOSS_CLI = 'bin/jboss-cli.sh'

    # Default installation settings
    INSTALL_PROPERTIES = {
        'ca.name': 'ManagementCA',
        'ca.dn': 'CN=ManagementCA,O=EJBCA EnigmaBridge,C=GB',
        'ca.tokentype': 'soft',
        'ca.keytype': 'RSA',
        'ca.keyspec': '2048',
        'ca.signaturealgorithm': 'SHA256WithRSA',
        'ca.validity': '3650',
        'ca.policy': 'null'
    }

    WEB_PROPERTIES = {
        'cryptotoken.p11.lib.255.name': 'SoftHSMv1',
        'cryptotoken.p11.lib.255.file': '/usr/lib64/softhsm/libsofthsm.so',

        'httpsserver.hostname': 'localhost',
        'httpsserver.dn': 'CN=localhost,O=EJBCA EnigmaBridge,C=GB',

        'superadmin.cn': 'SuperAdmin',
        'superadmin.dn': 'CN=SuperAdmin',
        'superadmin.batch': 'true',

        # Credentials, generated at random, stored into password file
        #'httpsserver.password': '<PASSWORD>',
        #'java.trustpassword': '<PASSWORD>',
        #'superadmin.password': '<PASSWORD>',
    }

    def __init__(self, install_props=None, web_props=None, print_output=False, *args, **kwargs):
        self.install_props = install_props if install_props is not None else {}
        self.web_props = web_props if web_props is not None else {}

        self.http_pass = util.random_password(16)
        self.java_pass = '<PASSWORD>' # EJBCA & JBoss bug here
        self.superadmin_pass = util.random_password(16)

        self.print_output = print_output

{'fraction_non_alphanumeric': 0.12885785086731247, 'fraction_numerical': 0.0198242847488173, 'mean_word_length': 3.051094890510949, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1722571', 'n_tokens_mistral': 1639, 'n_tokens_neox': 1531, 'n_words': 298}