IBM Support

Error when running /opt/qradar/support/clear_csr.py

Troubleshooting


Problem

When you execute the /opt/qradar/support/clear_csr.py script, the following stack trace is generated:
 
# /opt/qradar/support/clear_csr.py
Dry run has been enabled: False
Traceback (most recent call last):
  File "/opt/qradar/support/clear_csr.py", line 248, in <module>
    main()
  File "/opt/qradar/support/clear_csr.py", line 242, in main
    csr_cleaner.clean_csr(True)
  File "/opt/qradar/support/clear_csr.py", line 195, in clean_csr
    csr_path_list, csr_command_dict = self.get_csr_config_mapping()
  File "/opt/qradar/support/clear_csr.py", line 181, in get_csr_config_mapping
    json_data = self.parse_json(json_config_path)
  File "/opt/qradar/support/clear_csr.py", line 144, in parse_json
    data = json.load(json_file)
  File "/usr/lib64/python3.6/json/__init__.py", line 299, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.6/json/decoder.py", line 355, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 7 column 3 (char 177)
This stack trace indicates an error in the script due to a JSON decoding issue. The error occurs online 7, column 3 (character 177) where a comma delimiter was expected

Cause


The code in the /opt/qradar/ca/conf.d/httpd.json file contains a syntax error caused by an extraneous comma. To rectify this issue, the extraneous comma must be removed from the code in the httpd.json file.

Diagnosing The Problem

To review the contents of the httpd.json file and verify that there are no trailing commas, execute the following command:
 
cat /opt/qradar/ca/conf.d/httpd.json

 

Resolving The Problem

To edit the code that uses the VI text editor, follow these steps:
 
1. Open the VI editor and navigate to the file you want to edit by executing the command:
 
vi /opt/qradar/ca/conf.d/httpd.json
2. Inside the VI editor, locate the section of code that needs modification. The code looks as follows:
Default QRadar SSL certificate:
{
  "ServiceName": "httpd",
  "CertDir": "/etc/httpd/conf/certs",
  "CertName": "cert",
  "ServiceCommand": "/opt/qradar/bin/install-ssl-cert.sh --deploy",
  "CASkip": "false",
  "CertSkip": "true"
}
OR
Custom SSL certificate installed:
{
  "ServiceName": "httpd",
  "CertDir": "/etc/httpd/conf/certs",
  "CertName": "cert",
  "ServiceCommand": "/opt/qradar/bin/install-ssl-cert.sh --deploy",
  "CASkip": "true",
  "CertSkip": "true",
  "CertMonitorThreshold": 0 
}
3. Make the necessary changes to the code by using VI's editing commands. Ensure that each line ends with a comma except the last line.
4. Once you completed editing the code, save the changes and exit VI by pressing the following keys:
 
 :wq
This command writes the changes to the file and quits the VI editor.
By following these instructions, you can use the VI editor to modify the code in the specified file, ensuring that the code does not end with a comma.

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB24","label":"Security Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSV4BL","label":"IBM QRadar"},"ARM Category":[{"code":"a8m0z000000cwt3AAA","label":"QRadar Apps"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Document Information

Modified date:
13 December 2023

UID

ibm17009531