pull/23/head
Terrtia 2019-01-17 15:34:11 +01:00
commit 8b30947dd1
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
3 changed files with 10 additions and 4 deletions

View File

@ -80,14 +80,14 @@ void d4_update_uuid(d4_t* d4)
int d4_check_config(d4_t* d4)
{
// TODO implement other sources, file, fifo, unix_socket ...
if (strlen(d4->conf[SOURCE]) > strlen(STDIN)) {
if (strlen(d4->conf[SOURCE]) >= strlen(STDIN)) {
if (!strncmp(d4->conf[SOURCE],STDIN, strlen(STDIN))) {
d4->source.fd = STDIN_FILENO;
}
}
//TODO implement other destinations file, fifo unix_socket ...
if (strlen(d4->conf[DESTINATION]) > strlen(STDOUT)) {
if (strlen(d4->conf[DESTINATION]) >= strlen(STDOUT)) {
if (!strncmp(d4->conf[DESTINATION],STDOUT, strlen(STDOUT))) {
d4->destination.fd = STDOUT_FILENO;
}
@ -121,6 +121,7 @@ int d4_load_config(d4_t* d4)
if (fd > 0) {
//FIXME error handling
read(fd, d4->conf[i], SZCONFVALUE);
close(fd);
} else {
d4->errno_copy = errno;
INSERT_ERROR("Failed to load %s", d4params[i]);
@ -190,7 +191,7 @@ void d4_transfert(d4_t* d4)
hmac = calloc(1,SZHMAC);
hmaczero = calloc(1,SZHMAC);
//TODO error handling -> insert error message
if ((buf == NULL) && (hmac == NULL))
if ((buf == NULL) && (hmac == NULL) && (hmaczero == NULL))
return;
d4_prepare_header(d4);

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash
openssl genrsa -out server.key 2048
openssl genrsa -out server.key 4096
openssl req -sha256 -new -key server.key -out server.csr -subj '/CN=localhost'
openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt
openssl x509 -req -in server.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out server.crt -days 500 -sha256
cat server.crt server.key > server.pem

3
server/gen_root.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
openssl genrsa -out rootCA.key 4096
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.crt