Email sending error in elastalert. SMTPSenderRefused: (530, '5.5.1 Authentication Required) - elasticsearch

i got gmail authentication error. my config and error message as below
I already allowed less secure apps in gmail.
Config.yaml file email section as below
name: frequency_rule
type: frequency
index: security
num_events: 50
timeframe:
days: 1
filter:
- term:
host.keyword : "azure-2"
alert:
- email
email:
"to_address#gmail.com"
smtp_host: "smtp.gmail.com"
smtp_port: "465"
smtp_ssl: true
from_addr: "from_address#gmail.com"
user: "from_address#gmail.com"
password: "password"
Error message as below
PS C:\Users\smiforce-2ndPC\Downloads\Compressed\elastalert-master\elastalert-master> python -m elastalert.elastalert --verbose --config ./config.yaml --rule ./alert_rules/frequency4.yaml
INFO:elastalert:Starting up
INFO:elastalert:Queried rule frequency_rule4 from 2017-11-20 09:48 Central Standard Time to 2017-11-21 09:48 Central Standard Time: 24 / 24 hits
ERROR:root:Traceback (most recent call last):
File "C:\Users\smiforce-2ndPC\Downloads\Compressed\elastalert-master\elastalert-master\elastalert\elastalert.py", line 1246, in alert
return self.send_alert(matches, rule, alert_time=alert_time, retried=retried)
File "C:\Users\smiforce-2ndPC\Downloads\Compressed\elastalert-master\elastalert-master\elastalert\elastalert.py", line 1326, in send_alert
alert.alert(matches)
File "elastalert\alerts.py", line 451, in alert
self.smtp.sendmail(self.from_addr, to_addr, email_msg.as_string())
File "C:\Python27\lib\smtplib.py", line 737, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
SMTPSenderRefused: (530, '5.5.1 Authentication Required. Learn more at\n5.5.1 https://support.google.com/mail/?p=WantAuthError l4sm636961ioc.69 - gsmtp', 'from_address#gmail.com')
ERROR:root:Uncaught exception running rule frequency_rule4: (530, '5.5.1 Authentication Required. Learn more at\n5.5.1 https://support.google.com/mail/?p=WantAuthError l4sm636961ioc.69 - gsmt

The user and password fields should not be stored in the same config.yaml file but in another file which is referenced in config.yaml.
For instance, create another file named auth.yaml and add the user and password configuration into it:
user: "from_address#gmail.com"
password: "password"
Then in config.yaml you can reference that file using this setting:
smtp_auth_file: "/path/to/auth.yaml"

Related

Openstack Image create fails "ConflictException: 409: Client Error for url: https://x.x.x.x:9292/v2/images/8f78f59e-0b60-477e-aec6-810af4646c69/file

I just upgraded from OSA-Rocky to OSA-Stein and everything seems to work fine except when I try and upload an image via the python-openstackclient CLI. We are running ceph nautilus as our storage. Running the --debug option on the command gives the following:
###Cut majority of debug messages###
Starting new HTTPS connection (2): xxx.xxx.xxx.xxx:9292
[> ] 1%https://xxx.xxx.xxx.xxx:9292 "PUT /v2/images/395b1140-c0e3-48a9-872e-8b535cb237e5/file HTTP/1.1" 409 79
RESP: [409] Connection: close Content-Length: 79 Content-Type: text/plain; charset=UTF-8 x-openstack-request-id: req-bf01af04-aa24-4ba6-bf93-7f909f442f37
RESP BODY: Omitted, Content-Type is set to text/plain; charset=UTF-8. Only application/json responses have their bodies logged.
PUT call to image for https://xxx.xxx.xxx.xxx:9292/v2/images/395b1140-c0e3-48a9-872e-8b535cb237e5/file used request id req-bf01af04-aa24-4ba6-bf93-7f909f442f37
Deleting failed upload of image ubuntu-server-20.04-focal
REQ: curl -g -i --insecure -X DELETE https://xxx.xxx.xxx.xxx:9292/v2/images/395b1140-c0e3-48a9-872e-8b535cb237e5 -H "User-Agent: openstacksdk/0.59.0 keystoneauth1/4.4.0 python-requests/2.26.0 CPython/3.6.8" -H "X-Auth-Token: {SHA256}7413f5abcbdc45993c0b64c560665f198387e1d3a4fa58549b55ba12dc25d03a"
Resetting dropped connection: xxx.xxx.xxx.xxx
https://xxx.xxx.xxx.xxx:9292 "DELETE /v2/images/395b1140-c0e3-48a9-872e-8b535cb237e5 HTTP/1.1" 204 0
RESP: [204] Connection: close Content-Length: 0 Content-Type: text/html; charset=UTF-8 x-openstack-request-id: req-631ee055-77ce-4b6a-8374-d53e3ab0e984
RESP BODY: Omitted, Content-Type is set to text/html; charset=UTF-8. Only application/json responses have their bodies logged.
DELETE call to image for https://xxx.xxx.xxx.xxx:9292/v2/images/395b1140-c0e3-48a9-872e-8b535cb237e5 used request id req-631ee055-77ce-4b6a-8374-d53e3ab0e984
Image creation failed
Traceback (most recent call last):
File "/home/rkruck/.local/lib/python3.6/site-packages/openstack/image/v2/_proxy.py", line 235, in _upload_image
**kwargs)
File "/home/rkruck/.local/lib/python3.6/site-packages/openstack/image/v2/_proxy.py", line 293, in _upload_image_put
exceptions.raise_from_response(response)
File "/home/rkruck/.local/lib/python3.6/site-packages/openstack/exceptions.py", line 238, in raise_from_response
http_status=http_status, request_id=request_id
openstack.exceptions.ConflictException: ConflictException: 409: Client Error for url: https://xxx.xxx.xxx.xxx:9292/v2/images/395b1140-c0e3-48a9-872e-8b535cb237e5/file, Conflict
ConflictException: 409: Client Error for url: https://xxx.xxx.xxx.xxx:9292/v2/images/395b1140-c0e3-48a9-872e-8b535cb237e5/file, Conflict
Traceback (most recent call last):
File "/home/rkruck/.local/lib/python3.6/site-packages/cliff/app.py", line 407, in run_subcommand
result = cmd.run(parsed_args)
File "/home/rkruck/.local/lib/python3.6/site-packages/osc_lib/command/command.py", line 39, in run
return super(Command, self).run(parsed_args)
File "/home/rkruck/.local/lib/python3.6/site-packages/cliff/display.py", line 115, in run
column_names, data = self.take_action(parsed_args)
File "/home/rkruck/.local/lib/python3.6/site-packages/openstackclient/image/v2/image.py", line 502, in take_action
image = image_client.create_image(**kwargs)
File "/home/rkruck/.local/lib/python3.6/site-packages/openstack/image/_base_proxy.py", line 213, in create_image
**image_kwargs)
File "/home/rkruck/.local/lib/python3.6/site-packages/openstack/image/v2/_proxy.py", line 235, in _upload_image
**kwargs)
File "/home/rkruck/.local/lib/python3.6/site-packages/openstack/image/v2/_proxy.py", line 293, in _upload_image_put
exceptions.raise_from_response(response)
File "/home/rkruck/.local/lib/python3.6/site-packages/openstack/exceptions.py", line 238, in raise_from_response
http_status=http_status, request_id=request_id
openstack.exceptions.ConflictException: ConflictException: 409: Client Error for url: https://xxx.xxx.xxx.xxx:9292/v2/images/395b1140-c0e3-48a9-872e-8b535cb237e5/file, Conflict
clean_up CreateImage: ConflictException: 409: Client Error for url: https://xxx.xxx.xxx.xxx:9292/v2/images/395b1140-c0e3-48a9-872e-8b535cb237e5/file, Conflict
END return value: 1
Happy to provide anything else as I am stuck trying to get past this. If I log into Horizon I do see an attempt to save the image, so I don't feel it is an authentication/access issue.

JMeterLibException: 'Value returned by JMeter: 1'

when i try to pass current testcase (-Jtestname=${TEST_NAME}
) name along with run jmeter robot keyword getting below error,
JMeterLibException: 'Value returned by JMeter: 1'
Run Jmeter ${jmeter} ${jmxPath} ${logPath} -Jpath=${mdmpath} -Jtestname=${TEST_NAME}
My test case name is "AREA MDM"
As per below log info testcase name is getting assigned against -Jtestname but still getting this exception error,
19:27:46.574 INFO Starting JMeter with following parameters:
- JMeter path: /home/sadha/Documents/apache-jmeter-5.4.1/bin/jmeter.sh
- Test plan path: /home/sadha/Documents/apache-jmeter-5.4.1/bin/BizomWebMDM.jmx
- Log file path: /home/sadha/Documents/apache-jmeter-5.4.1/Output/log.jtl
- Other parameters: -Jpath=../BizomWeb/venv/resources/Excel/MDM/areas.xls -Jtestname=AREA MDM .
subprocess.call input list: ['/home/sadha/Documents/apache-jmeter-5.4.1/bin/jmeter.sh', '-n', '-t', '/home/sadha/Documents/apache-jmeter-5.4.1/bin/BizomWebMDM.jmx', '-l', '/home/sadha/Documents/apache-jmeter-5.4.1/Output/log.jtl', '-Jpath=../BizomWeb/venv/resources/Excel/MDM/areas.xls', '-Jtestname=AREA', 'MDM']
19:27:46.575 FAIL JMeterLibException: 'Value returned by JMeter: 1'
19:27:46.575 DEBUG Traceback (most recent call last):
File "/home/sadha/.local/lib/python3.8/site-packages/JMeterClasses.py", line 41, in runJmeter
JMeterRunner(jmeterPath, testPlanPath, logFilePath, otherParams)
File "/home/sadha/.local/lib/python3.8/site-packages/JMeterClasses.py", line 200, in __init__
jmeterOutput = self.runAndPrintResult()
File "/home/sadha/.local/lib/python3.8/site-packages/JMeterClasses.py", line 234, in runAndPrintResult
raise JMeterLibException("%s %s" % (msg, retValue))
If i pass any dummy string it will work but facing issue ony when i pass current testcase name.
You need to surround your AREA MDM stanza with quotation marks like:
-Jtestname="${TEST_NAME}"
or escape each character which needs to be escaped using backslash like change AREA MDM to AREA\ MDM
More information:
Which characters need to be escaped when using Bash?
How Do I Run JMeter in Non-GUI Mode?

AWS SAM running local won't resolve FindInMap Intrinsic

I can't make a template.yaml with Mappings work when testing locally, although they will deploy and work as expected.
As an example, one can follow:
sam init --runtime python3.8
Insert Mappings such as the following in template.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
sam-app
Sample SAM Template for sam-app
Parameters:
Environment:
Description: 'Required. Environment'
Type: String
AllowedValues:
- test
- prod
Default: test
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 3
MemorySize: !FindInMap [Environments, !Ref Environment, MemorySize]
Mappings:
Environments:
test:
MemorySize: 512
prod:
MemorySize: 2048
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: hello_world/
Handler: app.lambda_handler
Runtime: python3.8
Events:
HelloWorld:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /hello
Method: get
Outputs:
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
HelloWorldApi:
Description: "API Gateway endpoint URL for Prod stage for Hello World function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
HelloWorldFunction:
Description: "Hello World Lambda Function ARN"
Value: !GetAtt HelloWorldFunction.Arn
HelloWorldFunctionIamRole:
Description: "Implicit IAM Role created for Hello World function"
Value: !GetAtt HelloWorldFunctionRole.Arn
sam build --parameter-overrides ParamaterKey=Environment,ParameterValue=test --use-container
sam local start-api --debug, and it will show unresolved references.
2021-03-06 00:30:42,394 | local start-api command is called
2021-03-06 00:30:42,399 | Collected default values for parameters: {'Environment': 'test'}
2021-03-06 00:30:42,417 | Unable to resolve property MemorySize: OrderedDict([('Fn::FindInMap', ['Environments', OrderedDict([('Ref', 'Environment')]), 'MemorySize'])]). Leaving as is.
2021-03-06 00:30:42,417 | 2 resources found in the stack
2021-03-06 00:30:42,417 | Collected default values for parameters: {'Environment': 'test'}
2021-03-06 00:30:42,433 | Unable to resolve property MemorySize: OrderedDict([('Fn::FindInMap', ['Environments', OrderedDict([('Ref', 'Environment')]), 'MemorySize'])]). Leaving as is.
2021-03-06 00:30:42,434 | Collected default values for parameters: {'Environment': 'test'}
2021-03-06 00:30:42,449 | Unable to resolve property MemorySize: OrderedDict([('Fn::FindInMap', ['Environments', OrderedDict([('Ref', 'Environment')]), 'MemorySize'])]). Leaving as is.
2021-03-06 00:30:42,449 | Found Serverless function with name='HelloWorldFunction' and CodeUri='HelloWorldFunction'
2021-03-06 00:30:42,452 | Collected default values for parameters: {'Environment': 'test'}
2021-03-06 00:30:42,467 | Unable to resolve property MemorySize: OrderedDict([('Fn::FindInMap', ['Environments', OrderedDict([('Ref', 'Environment')]), 'MemorySize'])]). Leaving as is.
2021-03-06 00:30:42,467 | 2 resources found in the template
2021-03-06 00:30:42,468 | Found '1' API Events in Serverless function with name 'HelloWorldFunction'
2021-03-06 00:30:42,468 | Detected Inline Swagger definition
2021-03-06 00:30:42,468 | Lambda function integration not found in Swagger document at path='/hello' method='get'
2021-03-06 00:30:42,468 | Found '0' APIs in resource 'ServerlessRestApi'
2021-03-06 00:30:42,468 | Removed duplicates from '0' Explicit APIs and '1' Implicit APIs to produce '1' APIs
2021-03-06 00:30:42,468 | 1 APIs found in the template
2021-03-06 00:30:42,471 | Mounting HelloWorldFunction at http://127.0.0.1:3000/hello [GET]
2021-03-06 00:30:42,471 | You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions, changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2021-03-06 00:30:42,471 | Localhost server is starting up. Multi-threading = True
2021-03-06 00:30:42 * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
Insist with curl http://127.0.0.1/hello and sam will show an error:
2021-03-06 00:33:25,099 | Found one Lambda function with name 'HelloWorldFunction'
2021-03-06 00:33:25,099 | Invoking app.lambda_handler (python3.8)
2021-03-06 00:33:25,099 | No environment variables found for function 'HelloWorldFunction'
2021-03-06 00:33:25,099 | Environment variables overrides data is standard format
2021-03-06 00:33:25,099 | Loading AWS credentials from session with profile 'None'
2021-03-06 00:33:25,113 | Resolving code path. Cwd=/home/ricardo/Sandbox/learning/aws/sam-app/.aws-sam/build, CodeUri=/home/ricardo/Sandbox/learning/aws/sam-app/.aws-sam/build/HelloWorldFunction
2021-03-06 00:33:25,113 | Resolved absolute path to code is /home/ricardo/Sandbox/learning/aws/sam-app/.aws-sam/build/HelloWorldFunction
2021-03-06 00:33:25,113 | Code /home/ricardo/Sandbox/learning/aws/sam-app/.aws-sam/build/HelloWorldFunction is not a zip/jar file
2021-03-06 00:33:25,127 | Skip pulling image and use local one: amazon/aws-sam-cli-emulation-image-python3.8:rapid-1.19.1.
2021-03-06 00:33:25,127 | Mounting /home/ricardo/Sandbox/learning/aws/sam-app/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated inside runtime container
2021-03-06 00:33:25,127 | Cleaning all decompressed code dirs
2021-03-06 00:33:25,128 | Exception on /hello [GET]
Traceback (most recent call last):
File "/home/ricardo/.local/lib/python3.8/site-packages/docker/utils/utils.py", line 415, in parse_bytes
digits = int(digits_part)
ValueError: invalid literal for int() with base 10: "OrderedDict([('Fn::FindInMap', ['Environments', OrderedDict([('Ref', 'Environment')]), 'MemorySize'])])"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ricardo/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/home/ricardo/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/ricardo/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/ricardo/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/ricardo/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/ricardo/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/ricardo/.local/lib/python3.8/site-packages/samcli/local/apigw/local_apigw_service.py", line 297, in _request_handler
self.lambda_runner.invoke(route.function_name, event, stdout=stdout_stream_writer, stderr=self.stderr)
File "/home/ricardo/.local/lib/python3.8/site-packages/samcli/commands/local/lib/local_lambda.py", line 111, in invoke
self.local_runtime.invoke(config, event, debug_context=self.debug_context, stdout=stdout, stderr=stderr)
File "/home/ricardo/.local/lib/python3.8/site-packages/samcli/lib/telemetry/metric.py", line 216, in wrapped_func
return_value = func(*args, **kwargs)
File "/home/ricardo/.local/lib/python3.8/site-packages/samcli/local/lambdafn/runtime.py", line 148, in invoke
container = self.create(function_config, debug_context)
File "/home/ricardo/.local/lib/python3.8/site-packages/samcli/local/lambdafn/runtime.py", line 82, in create
self._container_manager.create(container)
File "/home/ricardo/.local/lib/python3.8/site-packages/samcli/local/docker/manager.py", line 95, in create
container.create()
File "/home/ricardo/.local/lib/python3.8/site-packages/samcli/local/docker/container.py", line 167, in create
real_container = self.docker_client.containers.create(self._image, **kwargs)
File "/home/ricardo/.local/lib/python3.8/site-packages/docker/models/containers.py", line 860, in create
create_kwargs = _create_container_args(kwargs)
File "/home/ricardo/.local/lib/python3.8/site-packages/docker/models/containers.py", line 1077, in _create_container_args
create_kwargs['host_config'] = HostConfig(**host_config_kwargs)
File "/home/ricardo/.local/lib/python3.8/site-packages/docker/types/containers.py", line 182, in __init__
self['Memory'] = parse_bytes(mem_limit)
File "/home/ricardo/.local/lib/python3.8/site-packages/docker/utils/utils.py", line 417, in parse_bytes
raise errors.DockerException(
docker.errors.DockerException: Failed converting the string value for memory (OrderedDict([('Fn::FindInMap', ['Environments', OrderedDict([('Ref', 'Environment')]), 'MemorySize'])])) to an integer.
sam --version gives SAM CLI, version 1.19.1.
Isn't FindInMap intrinsic still not implemented? What am I doing wrong?

How to run ansible from linux to deploy on windows machines

Here is what I have after setting kerberos according to ansible:
http://docs.ansible.com/ansible/intro_windows.html
[libdefaults]
default_realm = MY.DOMAIN.COM
…
[realms]
MY.DOMAIN.COM = {
default_domain = my.domain.com
kdc = <domain-controller-server>.my.domain.com
kpasswd_server = <domain-controller-server>.my.domain.com
}
…
[domain_realm]
.my.domain.com = MY.DOMAIN.COM
…
I was able to create a kerberos ticket, here is my output:
root#alex-VirtualBox:/etc/ansible# klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: <user_name>#MY.DOMAIN.COM
Valid starting Expires Service principal
04/07/2016 13:58:52 04/07/2016 23:58:52 krbtgt/MY.DOMAIN.COM#MY.DOMAIN.COM
renew until 04/08/2016 13:58:48
04/07/2016 14:02:20 04/07/2016 23:58:52 HTTP/<windows-target-server>.my.domain.com#MY.DOMAIN.COM
renew until 04/08/2016 13:58:48
So what I am trying to do is run ansible playbook or even a simple command on . But I am getting this error which I am pretty sure have nothing to do with ansible:
root#alex-VirtualBox:/etc/ansible# ansible windows -m win_ping --ask-vault-pass
Vault password:
<windows-target-server>.my.domain.com | FAILED! => {
"failed": true,
"msg": "kerberos: (('Unspecified GSS failure. Minor code may provide more information', 851968), ('Server not found in Kerberos database', -1765328377)), plaintext: 401 Unauthorized."
}
I even went ahead and created the keytab file:
> ktutil
ktutil: addent -password -p <user_name>#MY.DOMAIN.COM -k 1 -e rc4-hmac
provide password
ktutil: wkt <user_name>.keytab
ktutil: quit
But then I get different error:
root#alex-VirtualBox:/etc/ansible# ansible windows -m win_ping --ask-vault-pass
n2-2wbp-wbsvr01.na.msds.rhi.com | FAILED! => {
"failed": true,
"msg": "kerberos: (('An invalid name was supplied', 131072), ('Success', 100001)), plaintext: 401 Unauthorized."
}
Try to put the IP and Hostname of your Windows Host entry in /etc/hosts file and then try: https://github.com/diyan/pywinrm/issues/21#issuecomment-58958732 , https://github.com/diyan/pywinrm/issues/21#issuecomment-59084178
PS:
'Server not found in Kerberos database' - That usually means that the Linux host where you're running kinit is not joined to the domain (ie, it doesn't have a properly configured computer account in the domain). The existing docs unhelpfully omit that requirement...

FatalErrorException in PropelBundle.php line 29: Compile Error: Propel\PropelBundle\PropelBundle::boot(): Failed opening required

Im trying to use propel ORM with sympfony v-2.7
In my composer I've added this line
"propel/propel-bundle": "^1.4",
and installed this package successfully.
Then I load the Bundle into my karnel using this
$bundles = array(
new Propel\PropelBundle\PropelBundle(),
);
My config.yml settings
propel:
path: "%kernel.root_dir%/../vendor/propel"
phing_path: "%kernel.root_dir%/../vendor/phing"
logging: %kernel.debug%
dbal:
driver: %database_driver%
user: %database_user%
password: %database_password%
dsn: %database_driver%:host=%database_host%;dbname=%database_name%;charset=UTF8
options: {}
attributes: {}
But when I try to access- http://localhost/my-serp/web/
I got this Error
FatalErrorException in PropelBundle.php line 29:
Compile Error: Propel\PropelBundle\PropelBundle::boot(): Failed opening required 'D:\wamp\www\my-serp
\app/../vendor/propel/runtime/lib/Propel.php' (include_path='D:\wamp\www\my- serp\vendor/phing/phing/classes;D:\wamp
\www\my-serp\vendor/propel/propel1/runtime/lib;D:\wamp\www\my- serp\vendor/propel/propel1/generator/lib;.;C:\php\pear')
in PropelBundle.php line 29
at PropelBundle->boot() in bootstrap.php.cache line 2414
at Kernel->boot() in bootstrap.php.cache line 2442
at Kernel->handle() in app_dev.php line 28
at {main}() in app_dev.php line 0
I follow the documentation from github, can anybody say me what i've missed ??
Check/change your propel path to:
path: "%kernel.root_dir%/../vendor/propel/propel1"

Resources