def start_shell_out(): subprocess.call( 'runuser -l dynamite -c "{} {}/bin/elasticsearch ' '-p /var/run/dynamite/elasticsearch/elasticsearch.pid --quiet &>/dev/null &"' .format(utilities.get_environment_file_str(), self.config.es_home), shell=True)
def _install_logstash_plugins(self, stdout=False): if stdout: sys.stdout.write('[+] Installing Logstash plugins\n') sys.stdout.flush() subprocess.call( '{} {}/bin/logstash-plugin install logstash-codec-sflow'.format( utilities.get_environment_file_str(), self.install_directory), shell=True) subprocess.call( '{} {}/bin/logstash-plugin install logstash-codec-netflow'.format( utilities.get_environment_file_str(), self.install_directory), shell=True) subprocess.call( '{} {}/bin/logstash-plugin install logstash-filter-dns'.format( utilities.get_environment_file_str(), self.install_directory), shell=True) subprocess.call( '{} {}/bin/logstash-plugin install logstash-filter-geoip'.format( utilities.get_environment_file_str(), self.install_directory), shell=True) subprocess.call( '{} {}/bin/logstash-plugin install logstash-filter-translate'. format(utilities.get_environment_file_str(), self.install_directory), shell=True) subprocess.call( '{} {}/bin/logstash-plugin install logstash-input-beats'.format( utilities.get_environment_file_str(), self.install_directory), shell=True)
def start_shell_out(): # We use su instead of runuser here because of nodes' weird dependency on PAM # when calling from within a sub-shell subprocess.call('su -l dynamite -c "{} {}/bin/kibana ' '-c {} -l {} & > /dev/null &"'.format( utilities.get_environment_file_str(), self.config.kibana_home, os.path.join(self.config.kibana_path_conf, 'kibana.yml'), os.path.join(self.config.kibana_logs, 'kibana.log')), shell=True)
def optimize(self, stdout=False): if not os.path.exists('/var/run/dynamite/kibana/'): subprocess.call('mkdir -p {}'.format('/var/run/dynamite/kibana/'), shell=True) utilities.set_ownership_of_file('/var/run/dynamite') if stdout: sys.stdout.write('[+] Optimizing Kibana Libraries.\n') # Kibana initially has to be called as root due to a process forking issue when using runuser # builtin subprocess.call('{} {}/bin/kibana --optimize --allow-root'.format( utilities.get_environment_file_str(), self.config.kibana_home, ), shell=True) # Pass permissions back to dynamite user utilities.set_ownership_of_file('/var/log/dynamite')
def start_shell_out(): command = 'runuser -l dynamite -c "{} {}/bin/logstash ' \ '--path.settings={} &>/dev/null & echo \$! > /var/run/dynamite/logstash/logstash.pid"'.format( utilities.get_environment_file_str(), self.config.ls_home, self.config.ls_path_conf) subprocess.call(command, shell=True, cwd=self.config.ls_home)