|
|
ab00cd |
From 721de88621100f6ed33f1602415bc249f3ed3219 Mon Sep 17 00:00:00 2001
|
|
|
ab00cd |
From: Martin Sehnoutka <msehnout@redhat.com>
|
|
|
ab00cd |
Date: Thu, 17 Nov 2016 10:22:32 +0100
|
|
|
ab00cd |
Subject: [PATCH 19/59] Introduce reverse_lookup_enable option.
|
|
|
ab00cd |
|
|
|
ab00cd |
vsftpd can transform IP address into hostname before
|
|
|
ab00cd |
PAM authentication. You can disable it to prevent
|
|
|
ab00cd |
performance issues.
|
|
|
ab00cd |
---
|
|
|
ab00cd |
parseconf.c | 1 +
|
|
|
ab00cd |
sysdeputil.c | 14 +++++++++-----
|
|
|
ab00cd |
tunables.c | 2 ++
|
|
|
ab00cd |
tunables.h | 1 +
|
|
|
ab00cd |
vsftpd.conf.5 | 9 +++++++++
|
|
|
ab00cd |
5 files changed, 22 insertions(+), 5 deletions(-)
|
|
|
ab00cd |
|
|
|
ab00cd |
diff --git a/parseconf.c b/parseconf.c
|
|
|
ab00cd |
index 30df598..3e0dba4 100644
|
|
|
ab00cd |
--- a/parseconf.c
|
|
|
ab00cd |
+++ b/parseconf.c
|
|
|
ab00cd |
@@ -91,6 +91,7 @@ parseconf_bool_array[] =
|
|
|
ab00cd |
{ "mdtm_write", &tunable_mdtm_write },
|
|
|
ab00cd |
{ "lock_upload_files", &tunable_lock_upload_files },
|
|
|
ab00cd |
{ "pasv_addr_resolve", &tunable_pasv_addr_resolve },
|
|
|
ab00cd |
+ { "reverse_lookup_enable", &tunable_reverse_lookup_enable },
|
|
|
ab00cd |
{ "userlist_log", &tunable_userlist_log },
|
|
|
ab00cd |
{ "debug_ssl", &tunable_debug_ssl },
|
|
|
ab00cd |
{ "require_cert", &tunable_require_cert },
|
|
|
ab00cd |
diff --git a/sysdeputil.c b/sysdeputil.c
|
|
|
ab00cd |
index 3bbabaa..2063c87 100644
|
|
|
ab00cd |
--- a/sysdeputil.c
|
|
|
ab00cd |
+++ b/sysdeputil.c
|
|
|
ab00cd |
@@ -354,12 +354,16 @@ vsf_sysdep_check_auth(struct mystr* p_user_str,
|
|
|
ab00cd |
return 0;
|
|
|
ab00cd |
}
|
|
|
ab00cd |
#ifdef PAM_RHOST
|
|
|
ab00cd |
- sin.sin_addr.s_addr = inet_addr(str_getbuf(p_remote_host));
|
|
|
ab00cd |
- host = gethostbyaddr((char*)&sin.sin_addr.s_addr,sizeof(struct in_addr),AF_INET);
|
|
|
ab00cd |
- if (host != (struct hostent*)0)
|
|
|
ab00cd |
- retval = pam_set_item(s_pamh, PAM_RHOST, host->h_name);
|
|
|
ab00cd |
- else
|
|
|
ab00cd |
+ if (tunable_reverse_lookup_enable) {
|
|
|
ab00cd |
+ sin.sin_addr.s_addr = inet_addr(str_getbuf(p_remote_host));
|
|
|
ab00cd |
+ host = gethostbyaddr((char*)&sin.sin_addr.s_addr,sizeof(struct in_addr),AF_INET);
|
|
|
ab00cd |
+ if (host != (struct hostent*)0)
|
|
|
ab00cd |
+ retval = pam_set_item(s_pamh, PAM_RHOST, host->h_name);
|
|
|
ab00cd |
+ else
|
|
|
ab00cd |
+ retval = pam_set_item(s_pamh, PAM_RHOST, str_getbuf(p_remote_host));
|
|
|
ab00cd |
+ } else {
|
|
|
ab00cd |
retval = pam_set_item(s_pamh, PAM_RHOST, str_getbuf(p_remote_host));
|
|
|
ab00cd |
+ }
|
|
|
ab00cd |
if (retval != PAM_SUCCESS)
|
|
|
ab00cd |
{
|
|
|
ab00cd |
(void) pam_end(s_pamh, retval);
|
|
|
ab00cd |
diff --git a/tunables.c b/tunables.c
|
|
|
ab00cd |
index b30fca1..c737465 100644
|
|
|
ab00cd |
--- a/tunables.c
|
|
|
ab00cd |
+++ b/tunables.c
|
|
|
ab00cd |
@@ -72,6 +72,7 @@ int tunable_force_anon_data_ssl;
|
|
|
ab00cd |
int tunable_mdtm_write;
|
|
|
ab00cd |
int tunable_lock_upload_files;
|
|
|
ab00cd |
int tunable_pasv_addr_resolve;
|
|
|
ab00cd |
+int tunable_reverse_lookup_enable;
|
|
|
ab00cd |
int tunable_userlist_log;
|
|
|
ab00cd |
int tunable_debug_ssl;
|
|
|
ab00cd |
int tunable_require_cert;
|
|
|
ab00cd |
@@ -213,6 +214,7 @@ tunables_load_defaults()
|
|
|
ab00cd |
tunable_mdtm_write = 1;
|
|
|
ab00cd |
tunable_lock_upload_files = 1;
|
|
|
ab00cd |
tunable_pasv_addr_resolve = 0;
|
|
|
ab00cd |
+ tunable_reverse_lookup_enable = 1;
|
|
|
ab00cd |
tunable_userlist_log = 0;
|
|
|
ab00cd |
tunable_debug_ssl = 0;
|
|
|
ab00cd |
tunable_require_cert = 0;
|
|
|
ab00cd |
diff --git a/tunables.h b/tunables.h
|
|
|
ab00cd |
index e44d64c..9553038 100644
|
|
|
ab00cd |
--- a/tunables.h
|
|
|
ab00cd |
+++ b/tunables.h
|
|
|
ab00cd |
@@ -73,6 +73,7 @@ extern int tunable_force_anon_data_ssl; /* Require anon data uses SSL */
|
|
|
ab00cd |
extern int tunable_mdtm_write; /* Allow MDTM to set timestamps */
|
|
|
ab00cd |
extern int tunable_lock_upload_files; /* Lock uploading files */
|
|
|
ab00cd |
extern int tunable_pasv_addr_resolve; /* DNS resolve pasv_addr */
|
|
|
ab00cd |
+extern int tunable_reverse_lookup_enable; /* Get hostname before pam auth */
|
|
|
ab00cd |
extern int tunable_userlist_log; /* Log every failed login attempt */
|
|
|
ab00cd |
extern int tunable_debug_ssl; /* Verbose SSL logging */
|
|
|
ab00cd |
extern int tunable_require_cert; /* SSL client cert required */
|
|
|
ab00cd |
diff --git a/vsftpd.conf.5 b/vsftpd.conf.5
|
|
|
ab00cd |
index 72bb86f..fb6324e 100644
|
|
|
ab00cd |
--- a/vsftpd.conf.5
|
|
|
ab00cd |
+++ b/vsftpd.conf.5
|
|
|
ab00cd |
@@ -423,6 +423,15 @@ so you may want to disable it. For a discussion of the consequences, see
|
|
|
ab00cd |
http://scarybeastsecurity.blogspot.com/2009/02/vsftpd-210-released.html
|
|
|
ab00cd |
(Added in v2.1.0).
|
|
|
ab00cd |
|
|
|
ab00cd |
+Default: YES
|
|
|
ab00cd |
+.TP
|
|
|
ab00cd |
+.B reverse_lookup_enable
|
|
|
ab00cd |
+Set to YES if you want vsftpd to transform the ip address into the hostname,
|
|
|
ab00cd |
+before pam authentication. This is useful if you use pam_access including the
|
|
|
ab00cd |
+hostname. If you want vsftpd to run on the environment where the reverse lookup
|
|
|
ab00cd |
+for some hostname is available and the name server doesn't respond for a while,
|
|
|
ab00cd |
+you should set this to NO to avoid a performance issue.
|
|
|
ab00cd |
+
|
|
|
ab00cd |
Default: YES
|
|
|
ab00cd |
.TP
|
|
|
ab00cd |
.B run_as_launching_user
|
|
|
ab00cd |
--
|
|
|
ab00cd |
2.14.4
|
|
|
ab00cd |
|