/* getenv(MASTER_DOVECOT_VERSION_ENV) provides master's version number */
#define MASTER_DOVECOT_VERSION_ENV "DOVECOT_VERSION"
+/* getenv(MASTER_SSL_KEY_PASSWORD_ENV) returns manually typed SSL key password,
+ if dovecot was started with -p parameter. */
+#define MASTER_SSL_KEY_PASSWORD_ENV "SSL_KEY_PASSWORD"
+
/* Write pipe to anvil. Currently available only for auth destination
services, for others it's /dev/null. */
#define MASTER_ANVIL_FD 3
#include "safe-memset.h"
#include "llist.h"
#include "master-service.h"
+#include "master-interface.h"
#include "ssl-proxy.h"
#include <fcntl.h>
i_fatal("BIO_new_mem_buf() failed");
password = *set->ssl_key_password != '\0' ? set->ssl_key_password :
- getenv("SSL_KEY_PASSWORD");
+ getenv(MASTER_SSL_KEY_PASSWORD_ENV);
dup_password = t_strdup_noconst(password);
pkey = PEM_read_bio_PrivateKey(bio, NULL, pem_password_callback,
dup_password);
fd_close_on_exec(null_fd, TRUE);
} while (null_fd <= STDERR_FILENO);
- if (dup2(null_fd, STDIN_FILENO) < 0 ||
- dup2(null_fd, STDOUT_FILENO) < 0)
- i_fatal("dup2(null_fd) failed: %m");
-
if (master_service_settings_read_simple(master_service, set_roots,
&error) < 0)
i_fatal("Error reading configuration: %s", error);
sets = master_service_settings_get_others(master_service);
set = sets[0];
+ if (ask_key_pass) {
+ askpass("Give the password for SSL keys: ",
+ ssl_manual_key_password,
+ sizeof(ssl_manual_key_password));
+ }
+
+ if (dup2(null_fd, STDIN_FILENO) < 0 ||
+ dup2(null_fd, STDOUT_FILENO) < 0)
+ i_fatal("dup2(null_fd) failed: %m");
+
pidfile_path =
i_strconcat(set->base_dir, "/"MASTER_PID_FILE_NAME, NULL);
if (send_signal != 0)
auth_warning_print(set);
}
- if (ask_key_pass) {
- askpass("Give the password for SSL keys",
- ssl_manual_key_password,
- sizeof(ssl_manual_key_password));
- }
-
/* save TZ environment. AIX depends on it to get the timezone
correctly. */
env_tz = getenv("TZ");
if (!service->set->master_set->version_ignore)
env_put(MASTER_DOVECOT_VERSION_ENV"="PACKAGE_VERSION);
+
+ if (*ssl_manual_key_password != '\0' && service->have_inet_listeners) {
+ /* manually given SSL password. give it only to services
+ that have inet listeners. */
+ env_put(t_strconcat(MASTER_SSL_KEY_PASSWORD_ENV"=",
+ ssl_manual_key_password, NULL));
+ }
}
static void service_process_status_timeout(struct service_process *process)
env_put(t_strconcat("LOCAL_IP=", net_ip2addr(&request->local_ip), NULL));
env_put(t_strconcat("IP=", net_ip2addr(&request->remote_ip), NULL));
- if (*ssl_manual_key_password != '\0' &&
- request->process->process.service->have_inet_listeners) {
- /* manually given SSL password. give it only to services
- that have inet listeners. */
- env_put(t_strconcat("SSL_KEY_PASSWORD=",
- ssl_manual_key_password, NULL));
- }
}
struct service_process *