PaloAltoNetworks / pcs_sqs_to_syslog

Prisma Cloud SQS poller to syslog
ISC License
1 stars 2 forks source link

invalid syntax for logging_server #2

Open ShripadNighojkar opened 2 years ago

ShripadNighojkar commented 2 years ago

Hello,

configured pre-req as per document, but getting invalid syntax error for logging_server.

OUTPUT: root@BLE01:/tmp/pcs_sqs_to_syslog-master# python poll_n_write.py File "poll_n_write.py", line 19 logging_server = config.rl_syslog_host ^ SyntaxError: invalid syntax root@BLE01:/tmp/pcs_sqs_to_syslog-master#

welcome-to-palo-alto-networks[bot] commented 2 years ago

:tada: Thanks for opening your first issue here! Welcome to the community!

ebeuerle commented 2 years ago

Can you provide what you put in the config file?

On Apr 27, 2022, at 7:55 AM, welcome-to-palo-alto-networks[bot] @.***> wrote:

 🎉 Thanks for opening your first issue here! Welcome to the community!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

ShripadNighojkar commented 2 years ago

Pre-requ output:

root@BLE01:/tmp/pcs_sqs_to_syslog-master# python3 --version Python 3.6.9 root@BLE01:/tmp/pcs_sqs_to_syslog-master# sudo pip install requests Requirement already satisfied: requests in /usr/lib/python2.7/dist-packages root@BLE01:/tmp/pcs_sqs_to_syslog-master# sudo pip install pyyaml Requirement already satisfied: pyyaml in /usr/lib/python2.7/dist-packages root@BLE01:/tmp/pcs_sqs_to_syslog-master#

Configs.yml root@BLE01:/tmp/pcs_sqs_to_syslog-master# cat config/configs.yml prisma_cloud: aws_region: ap-south-1 aws_sqs_queue: https://sqs.ap-south-1.amazonaws.com/75********4/B*********prisma syslog_host: 10.128.24.81

ebeuerle commented 2 years ago

Make sure you don't have a space after the IP address. The config file is a yaml file so it needs proper indenting to be processed correct. Please confirm no trailing spaces on the lines and that there is indention for the 3 lines below prisma_cloud:

ShripadNighojkar commented 2 years ago

Hi, no additinal spaces & indention is correct. same error. I think ' logging_server' veriable is not avilable in included import.

root@BLE01:/tmp/pcs_sqs_to_syslog-master# python poll_n_write.py File "poll_n_write.py", line 19 logging_server = config.rl_syslog_host ^ SyntaxError: invalid syntax root@BLE01:/tmp/pcs_sqs_to_syslog-master#

ebeuerle commented 2 years ago

I tested this last night with no issues. Are you using an older version of the script? Line 19 is not the logging_server variable definition:

12 #Config setup for AWS and syslog 13 config = lib.ConfigHelper() 14 logging_server = config.rl_syslog_host 15 REGION_NAME = config.rl_aws_region 16 qname = config.rl_aws_queue 17 poll_interval = 5 18 poll_duration = 10 19 MaxNumberOfMessages = 10 20 VisibilityTimeout = 3600

ShripadNighojkar commented 2 years ago

Hello,

I have redeploy from git, but now having diffrent error while running python3 poll_n_write.py & python poll_n_write.py.

root@BLE01:/tmp/pcs_sqs_to_syslog-master30# python3 poll_n_write.py /usr/local/lib/python3.6/dist-packages/boto3/compat.py:88: PythonDeprecationWarning: Boto3 will no longer support Python 3.6 starting May 30, 2022. To continue receiving service updates, bug fixes, and security updates please upgrade to Python 3.7 or later. More information can be found here: https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/ warnings.warn(warning, PythonDeprecationWarning) Error: Unrecognized error root@BFLINFANSIBLE01:/tmp/pcs_sqs_to_syslog-master30# python poll_n_write.py Traceback (most recent call last): File "poll_n_write.py", line 7, in import boto3 ImportError: No module named boto3 root@BLE01:/tmp/pcs_sqs_to_syslog-master30#

Error even for:

root@BFLINFANSIBLE01:/tmp/pcs_sqs_to_syslog-master30# python3.7 poll_n_write.py Traceback (most recent call last): File "poll_n_write.py", line 7, in import boto3 ModuleNotFoundError: No module named 'boto3' root@BFLINFANSIBLE01:/tmp/pcs_sqs_to_syslog-master30#

Available python: root@BFLINFANSIBLE01:/tmp/pcs_sqs_to_syslog-master30# python python python3.6 python3-config python2 python3.6-config python3m python2.7 python3.6m python3m-config python2.7-config python3.6m-config python-argcomplete-check-easy-install-script python2-config python3.7 python-argcomplete-tcsh python3 python3.7m python-config

ebeuerle commented 2 years ago

It requires boto3 to be installed. You can use pip to install it like requests and pyyaml.

On May 3, 2022, at 1:03 AM, ShripadNighojkar @.***> wrote:

 Hello,

I have redeploy from git, but now having diffrent error while running python3 poll_n_write.py & python poll_n_write.py.

@.:/tmp/pcs_sqs_to_syslog-master30# python3 poll_n_write.py /usr/local/lib/python3.6/dist-packages/boto3/compat.py:88: PythonDeprecationWarning: Boto3 will no longer support Python 3.6 starting May 30, 2022. To continue receiving service updates, bug fixes, and security updates please upgrade to Python 3.7 or later. More information can be found here: https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/ warnings.warn(warning, PythonDeprecationWarning) Error: Unrecognized error @.:/tmp/pcs_sqs_to_syslog-master30# python poll_n_write.py Traceback (most recent call last): File "poll_n_write.py", line 7, in import boto3 ImportError: No module named boto3 @.***:/tmp/pcs_sqs_to_syslog-master30#

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

ShripadNighojkar commented 2 years ago

Hi, Done the boto3 & pyyaml installation.

I guess now stucked at Environment variables. Please help, Im new to configure.

root@BLE01:/tmp/pcs_sqs_to_syslog-master30# python3.7 poll_n_write.py Error: Unrecognized error root@BLE01:/tmp/pcs_sqs_to_syslog-master30#

ebeuerle commented 2 years ago

Refer to here for configuration options: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html

ShripadNighojkar commented 2 years ago

Hi,

I guess this last error. Is any specific access is required for SQS?

(my-project-env) root@BLE01:/tmp/pcs_sqs_to_syslog-master30# python3.7 poll_n_write.py Error: The specified queue does not exist (my-project-env) root@BLE01:/tmp/pcs_sqs_to_syslog-master30#

SQS access policy: { "Version": "2012-10-17", "Id": "arn:aws:sqs:ap-south-1:****0004:B-Marketing-*/SQSDefaultPolicy", "Statement": [ { "Sid": "Sid1586****", "Effect": "Allow", "Principal": "", "Action": "SQS:", "Resource": "arn:aws:sqs:ap-south-1:****0004:B*-Marketing-" }, { "Sid": "topic-subscription-arn:aws:sns:ap-south-1:****0004:P**-config-alerts", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": "SQS:SendMessage", "Resource": "arn:aws:sqs:ap-south-1:****0004:B**-Marketing-***", "Condition": { "ArnLike": { "aws:SourceArn": "arn:aws:sns:ap-south-1:****0004:P****-config-alerts" } } } ] }

ebeuerle commented 2 years ago

Yes, you need:

-

sqs:ListQueues

-

sqs:SendMessage

-

sqs:GetQueueUrl

On Sat, May 7, 2022 at 6:24 AM ShripadNighojkar @.***> wrote:

Hi,

I guess this last error. Is any specific access is required for SQS?

(my-project-env) @.:/tmp/pcs_sqs_to_syslog-master30# python3.7 poll_n_write.py Error: The specified queue does not exist (my-project-env) @.:/tmp/pcs_sqs_to_syslog-master30#

SQS access policy: { "Version": "2012-10-17", "Id": "arn:aws:sqs:ap-south-1:***0004:B*-Marketing-

*/SQSDefaultPolicy", "Statement": [ { "Sid": "Sid1586*", "Effect": "Allow", "Principal": " ", "Action": "SQS:*", "Resource": "arn:aws:sqs:ap-south-1:*****0004:B*-Marketing-

*" }, { "Sid": "topic-subscription-arn:aws:sns:ap-south-1:0004:P-config-alerts", "Effect": "Allow", "Principal": { "AWS": "" }, "Action": "SQS:SendMessage", "Resource": "arn:aws:sqs:ap-south-1:****0004:B-Marketing-**", "Condition": { "ArnLike": { "aws:SourceArn": "arn:aws:sns:ap-south-1:****0004:P-config-alerts" } } } ] }

— Reply to this email directly, view it on GitHub https://github.com/PaloAltoNetworks/pcs_sqs_to_syslog/issues/2#issuecomment-1120182493, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADYOAKOQCDCOQVNXM5YO4PDVIZAEFANCNFSM5UO4K7OQ . You are receiving this because you commented.Message ID: @.***>