[Fix] flake & .pems
This commit is contained in:
parent
3e6c6396b1
commit
fa0af21af5
2 changed files with 9 additions and 23 deletions
28
flake.nix
28
flake.nix
|
|
@ -110,24 +110,14 @@
|
||||||
description = "Directory where Omega stores its data and reads certificates from.";
|
description = "Directory where Omega stores its data and reads certificates from.";
|
||||||
};
|
};
|
||||||
|
|
||||||
apiCertFile = lib.mkOption {
|
certFile = lib.mkOption {
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
description = "Path to the SSL certificate file for the web/API server (e.g. ACME fullchain.pem). Copied to server_cert.pem at runtime.";
|
description = "Path to the SSL certificate file (e.g. ACME fullchain.pem). Copied to cert.pem at runtime.";
|
||||||
};
|
};
|
||||||
|
|
||||||
apiKeyFile = lib.mkOption {
|
keyFile = lib.mkOption {
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
description = "Path to the SSL private key file for the web/API server (e.g. ACME key.pem). Converted to PKCS#8 and copied to server_key.pem at runtime.";
|
description = "Path to the SSL private key file (e.g. ACME key.pem). Converted to PKCS#8 and copied to key.pem at runtime.";
|
||||||
};
|
|
||||||
|
|
||||||
transportCertFile = lib.mkOption {
|
|
||||||
type = lib.types.path;
|
|
||||||
description = "Path to the SSL certificate file for the MTP/QUIC transport (e.g. ACME fullchain.pem). Copied to transport_cert.pem at runtime.";
|
|
||||||
};
|
|
||||||
|
|
||||||
transportKeyFile = lib.mkOption {
|
|
||||||
type = lib.types.path;
|
|
||||||
description = "Path to the SSL private key file for the MTP/QUIC transport (e.g. ACME key.pem). Converted to PKCS#8 and copied to transport_key.pem at runtime.";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
environmentFiles = lib.mkOption {
|
environmentFiles = lib.mkOption {
|
||||||
|
|
@ -211,14 +201,10 @@
|
||||||
"+"
|
"+"
|
||||||
+ pkgs.writeShellScript "omega-setup-certs" ''
|
+ pkgs.writeShellScript "omega-setup-certs" ''
|
||||||
mkdir -p ${cfg.dataDir}/certs
|
mkdir -p ${cfg.dataDir}/certs
|
||||||
cp ${cfg.apiCertFile} ${cfg.dataDir}/certs/server_cert.pem
|
cp ${cfg.certFile} ${cfg.dataDir}/certs/cert.pem
|
||||||
${pkgs.openssl}/bin/openssl pkcs8 -topk8 -nocrypt \
|
${pkgs.openssl}/bin/openssl pkcs8 -topk8 -nocrypt \
|
||||||
-in ${cfg.apiKeyFile} \
|
-in ${cfg.keyFile} \
|
||||||
-out ${cfg.dataDir}/certs/server_key.pem
|
-out ${cfg.dataDir}/certs/key.pem
|
||||||
cp ${cfg.transportCertFile} ${cfg.dataDir}/certs/transport_cert.pem
|
|
||||||
${pkgs.openssl}/bin/openssl pkcs8 -topk8 -nocrypt \
|
|
||||||
-in ${cfg.transportKeyFile} \
|
|
||||||
-out ${cfg.dataDir}/certs/transport_key.pem
|
|
||||||
chown -R omega:omega ${cfg.dataDir}
|
chown -R omega:omega ${cfg.dataDir}
|
||||||
''
|
''
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -257,8 +257,8 @@ pub async fn complete_register(_: PublicKeyBundle, _: Option<String>) -> u64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn start(port: u16) -> Result<(), Box<dyn std::error::Error>> {
|
pub async fn start(port: u16) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let cert_pem = load_file_vec("certs", "transport_cert.pem")?;
|
let cert_pem = load_file_vec("certs", "cert.pem")?;
|
||||||
let key_pem = load_file_vec("certs", "transport_key.pem")?;
|
let key_pem = load_file_vec("certs", "key.pem")?;
|
||||||
let web_config = server::server::build_web_config()?;
|
let web_config = server::server::build_web_config()?;
|
||||||
let host_config = HostConfig::new(
|
let host_config = HostConfig::new(
|
||||||
IpAddr::from(Ipv4Addr::new(0, 0, 0, 0)),
|
IpAddr::from(Ipv4Addr::new(0, 0, 0, 0)),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue