mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-24 07:40:52 +00:00
dd7d42a1fa
During recent testing related to the IETF NFSv4 Bakeathon, it was discovered that Kerberized NFSv4.1/4.2 mounts to pNFS servers (sec=krb5[ip],pnfs mount options) was broken. The FreeBSD client was using the "service principal" for the MDS to try and establish a rpcsec_gss credential for a DS, which is incorrect. (A "service principal" looks like "nfs@<fqdn-of-server>" and the <fqdn-of-server> for the DS is not the same as the MDS for most pNFS servers.) To fix this, the rpcsec_gss code needs to be able to do a reverse DNS lookup of the DS's IP address. A new kgssapi upcall to the gssd(8) daemon is added by this patch to do the reverse DNS along with a new rpcsec_gss function to generate the "service principal". A separate patch to the gssd(8) will be committed, so that this patch will fix the problem. Without the gssd(8) patch, the new upcall fails and current/incorrect behaviour remains. This bug only affects the rare case of a Kerberized (sec=krb5[ip],pnfs) mount using pNFS. This patch changes the internal KAPI between the kgssapi and nfscl modules, but since I did a version bump a few days ago, I will not do one this time. MFC after: 1 month
279 lines
6.3 KiB
Plaintext
279 lines
6.3 KiB
Plaintext
/*-
|
|
* Copyright (c) 2008 Isilon Inc http://www.isilon.com/
|
|
* Authors: Doug Rabson <dfr@rabson.org>
|
|
* Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*/
|
|
|
|
|
|
#ifdef RPC_HDR
|
|
|
|
%#ifdef _KERNEL
|
|
%#include <kgssapi/gssapi.h>
|
|
%#else
|
|
%#include <gssapi/gssapi.h>
|
|
%#include <netdb.h>
|
|
%#endif
|
|
|
|
%extern bool_t xdr_gss_buffer_desc(XDR *xdrs, gss_buffer_desc *buf);
|
|
%extern bool_t xdr_gss_OID_desc(XDR *xdrs, gss_OID_desc *oid);
|
|
%extern bool_t xdr_gss_OID(XDR *xdrs, gss_OID *oidp);
|
|
%extern bool_t xdr_gss_OID_set_desc(XDR *xdrs, gss_OID_set_desc *set);
|
|
%extern bool_t xdr_gss_OID_set(XDR *xdrs, gss_OID_set *setp);
|
|
%extern bool_t xdr_gss_channel_bindings_t(XDR *xdrs, gss_channel_bindings_t *chp);
|
|
|
|
#endif
|
|
|
|
typedef uint64_t gssd_ctx_id_t;
|
|
typedef uint64_t gssd_cred_id_t;
|
|
typedef uint64_t gssd_name_t;
|
|
|
|
struct init_sec_context_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
gssd_ctx_id_t ctx;
|
|
gss_OID actual_mech_type;
|
|
gss_buffer_desc output_token;
|
|
uint32_t ret_flags;
|
|
uint32_t time_rec;
|
|
};
|
|
|
|
struct init_sec_context_args {
|
|
uint32_t uid;
|
|
gssd_cred_id_t cred;
|
|
gssd_ctx_id_t ctx;
|
|
gssd_name_t name;
|
|
gss_OID mech_type;
|
|
uint32_t req_flags;
|
|
uint32_t time_req;
|
|
gss_channel_bindings_t input_chan_bindings;
|
|
gss_buffer_desc input_token;
|
|
};
|
|
|
|
struct accept_sec_context_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
gssd_ctx_id_t ctx;
|
|
gssd_name_t src_name;
|
|
gss_OID mech_type;
|
|
gss_buffer_desc output_token;
|
|
uint32_t ret_flags;
|
|
uint32_t time_rec;
|
|
gssd_cred_id_t delegated_cred_handle;
|
|
};
|
|
|
|
struct accept_sec_context_args {
|
|
gssd_ctx_id_t ctx;
|
|
gssd_cred_id_t cred;
|
|
gss_buffer_desc input_token;
|
|
gss_channel_bindings_t input_chan_bindings;
|
|
};
|
|
|
|
struct delete_sec_context_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
gss_buffer_desc output_token;
|
|
};
|
|
|
|
struct delete_sec_context_args {
|
|
gssd_ctx_id_t ctx;
|
|
};
|
|
|
|
enum sec_context_format {
|
|
KGSS_HEIMDAL_0_6,
|
|
KGSS_HEIMDAL_1_1
|
|
};
|
|
|
|
struct export_sec_context_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
enum sec_context_format format;
|
|
gss_buffer_desc interprocess_token;
|
|
};
|
|
|
|
struct export_sec_context_args {
|
|
gssd_ctx_id_t ctx;
|
|
};
|
|
|
|
struct import_name_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
gssd_name_t output_name;
|
|
};
|
|
|
|
struct import_name_args {
|
|
gss_buffer_desc input_name_buffer;
|
|
gss_OID input_name_type;
|
|
};
|
|
|
|
struct canonicalize_name_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
gssd_name_t output_name;
|
|
};
|
|
|
|
struct canonicalize_name_args {
|
|
gssd_name_t input_name;
|
|
gss_OID mech_type;
|
|
};
|
|
|
|
struct export_name_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
gss_buffer_desc exported_name;
|
|
};
|
|
|
|
struct export_name_args {
|
|
gssd_name_t input_name;
|
|
};
|
|
|
|
struct release_name_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
};
|
|
|
|
struct release_name_args {
|
|
gssd_name_t input_name;
|
|
};
|
|
|
|
struct pname_to_uid_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
uint32_t uid;
|
|
uint32_t gid;
|
|
uint32_t gidlist<>;
|
|
};
|
|
|
|
struct pname_to_uid_args {
|
|
gssd_name_t pname;
|
|
gss_OID mech;
|
|
};
|
|
|
|
struct acquire_cred_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
gssd_cred_id_t output_cred;
|
|
gss_OID_set actual_mechs;
|
|
uint32_t time_rec;
|
|
};
|
|
|
|
struct acquire_cred_args {
|
|
uint32_t uid;
|
|
gssd_name_t desired_name;
|
|
uint32_t time_req;
|
|
gss_OID_set desired_mechs;
|
|
int cred_usage;
|
|
};
|
|
|
|
struct set_cred_option_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
};
|
|
|
|
struct set_cred_option_args {
|
|
gssd_cred_id_t cred;
|
|
gss_OID option_name;
|
|
gss_buffer_desc option_value;
|
|
};
|
|
|
|
struct release_cred_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
};
|
|
|
|
struct release_cred_args {
|
|
gssd_cred_id_t cred;
|
|
};
|
|
|
|
struct display_status_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
uint32_t message_context;
|
|
gss_buffer_desc status_string;
|
|
};
|
|
|
|
struct display_status_args {
|
|
uint32_t status_value;
|
|
int status_type;
|
|
gss_OID mech_type;
|
|
uint32_t message_context;
|
|
};
|
|
|
|
struct ip_to_dns_res {
|
|
uint32_t major_status;
|
|
uint32_t minor_status;
|
|
char dns_name<NI_MAXHOST>;
|
|
};
|
|
|
|
struct ip_to_dns_args {
|
|
char ip_addr<NI_MAXHOST>;
|
|
};
|
|
|
|
program GSSD {
|
|
version GSSDVERS {
|
|
void GSSD_NULL(void) = 0;
|
|
|
|
init_sec_context_res
|
|
GSSD_INIT_SEC_CONTEXT(init_sec_context_args) = 1;
|
|
|
|
accept_sec_context_res
|
|
GSSD_ACCEPT_SEC_CONTEXT(accept_sec_context_args) = 2;
|
|
|
|
delete_sec_context_res
|
|
GSSD_DELETE_SEC_CONTEXT(delete_sec_context_args) = 3;
|
|
|
|
export_sec_context_res
|
|
GSSD_EXPORT_SEC_CONTEXT(export_sec_context_args) = 4;
|
|
|
|
import_name_res
|
|
GSSD_IMPORT_NAME(import_name_args) = 5;
|
|
|
|
canonicalize_name_res
|
|
GSSD_CANONICALIZE_NAME(canonicalize_name_args) = 6;
|
|
|
|
export_name_res
|
|
GSSD_EXPORT_NAME(export_name_args) = 7;
|
|
|
|
release_name_res
|
|
GSSD_RELEASE_NAME(release_name_args) = 8;
|
|
|
|
pname_to_uid_res
|
|
GSSD_PNAME_TO_UID(pname_to_uid_args) = 9;
|
|
|
|
acquire_cred_res
|
|
GSSD_ACQUIRE_CRED(acquire_cred_args) = 10;
|
|
|
|
set_cred_option_res
|
|
GSSD_SET_CRED_OPTION(set_cred_option_args) = 11;
|
|
|
|
release_cred_res
|
|
GSSD_RELEASE_CRED(release_cred_args) = 12;
|
|
|
|
display_status_res
|
|
GSSD_DISPLAY_STATUS(display_status_args) = 13;
|
|
|
|
ip_to_dns_res
|
|
GSSD_IP_TO_DNS(ip_to_dns_args) = 14;
|
|
} = 1;
|
|
} = 0x40677373;
|