> For the complete documentation index, see [llms.txt](https://docs.lightbeam.ai/lxqobxw6ak7CTnsQjikH/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lightbeam.ai/lxqobxw6ak7CTnsQjikH/getting-started/installer-guides/integration-and-setup/generate-csr-for-lightbeam.md).

# Generate CSR for LightBeam

### Step-by-Step Guide

Here is a script that combines the generation of the private key and CSR using the configuration file:

```
#!/bin/bash
# Define filenames
PRIVATE_KEY="private.key"
CSR="request.csr"
CONFIG_FILE="openssl.cnf"
# Create OpenSSL configuration file
cat > $CONFIG_FILE <<EOL
[ req ]
default_bits = 2048
default_md = sha256
prompt = no
default_keyfile = $PRIVATE_KEY
distinguished_name = req_distinguished_name
req_extensions = req_ext
[ req_distinguished_name ]
C = US
ST = California
L = San Francisco
O = My Organization
OU = My Organizational Unit
CN = abc@def.com
emailAddress = abc@def.com
[ req_ext ]
subjectAltName = @alt_names
[ alt_names ]
email.1 = abc@def.com
EOL
# Generate private key
echo "Generating private key..."
openssl genpkey -algorithm RSA -out $PRIVATE_KEY -aes256
# Generate CSR
echo "Generating CSR..."
openssl req -new -key $PRIVATE_KEY -out $CSR -config $CONFIG_FILE
echo "Private key and CSR have been generated."
```

#### Usage

1\. Save the script to a file, for example, \``generate_key_and_csr_with_san.sh`\`.<br>

2\. Make the script executable:

`chmod +x generate_key_and_csr_with_san.sh`

\
3\. Run the script:

`./generate_key_and_csr_with_san.sh`

This script will generate a private key and a CSR with the \`subjectAltName\` set to \`<abc@def.com>\`. Adjust the values in the configuration file section of the script as needed for your specific requirements.<br>

#### Configuration File Sections:

* `[ req ]:` Main settings for the request.
  * `default_bits:` Key size.
  * `default_md:` Message digest algorithm.
  * `prompt:` Whether to prompt for details.
  * `default_keyfile:` Default private key file.
  * `distinguished_name:` Section for distinguished name.
  * `req_extensions:` Section for request extensions.<br>
* `[ req_distinguished_name ]:` Details for the distinguished name.<br>
* `[ req_ext ]:` Extensions to add to the request.<br>
* `[ alt_names ]:` Subject alternative names.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lightbeam.ai/lxqobxw6ak7CTnsQjikH/getting-started/installer-guides/integration-and-setup/generate-csr-for-lightbeam.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
