Files
risuai/server/node/ssl/Generate Certificate.sh
shirosaki-hana f4d3f40ce5 Add HTTPS support for RisuAI Node.js hosting version
The Node.js hosting version of RisuAI previously used simple app.listen for server execution, which didn't support native HTTPS. This caused several functionality issues due to browser security restrictions when accessing RisuAI externally, such as realm loading failures and inability to insert prompt presets.

The updated code now checks for certificate files named server.key and server.crt in the /server/node/ssl/certificate directory. If found, the server will start using HTTPS.

The /ssl directory includes a script to generate a self-signed SSL certificate using OpenSSL. To use it, add the server's public IP to the [ alt_names ] section in server.conf before generating the certificate. The CA certificate should be installed on the operating system or browser of devices remotely accessing RisuAI.

For production use with a domain, it's recommended to use a certificate from an official Certificate Authority.
2025-03-20 15:40:11 +09:00

8 lines
590 B
Bash

#!/bin/bash
mkdir -p certificate
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout certificate/ca.key -out certificate/ca.crt -config ca.conf
openssl req -new -nodes -newkey rsa:2048 -keyout certificate/server.key -out certificate/server.csr -config server.conf
openssl x509 -req -in certificate/server.csr -CA certificate/ca.crt -CAkey certificate/ca.key -CAcreateserial -out certificate/server.crt -days 3650 -extensions req_ext -extfile server.conf
chmod 600 certificate/ca.key certificate/server.key
chmod 644 certificate/ca.crt certificate/server.crt certificate/server.csr