samba.git
7 years agolib: Add pam_wrapper 1.0.3
Andreas Schneider [Wed, 29 Mar 2017 13:55:53 +0000 (15:55 +0200)]
lib: Add pam_wrapper 1.0.3

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agouid_wrapper: use conf.blddir to construct libnss_wrapper_so_path
Stefan Metzmacher [Fri, 7 Apr 2017 07:27:39 +0000 (09:27 +0200)]
uid_wrapper: use conf.blddir to construct libnss_wrapper_so_path

conf.blddir might not the the same as conf.srcdir + '/bin'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoresolv_wrapper: use conf.blddir to construct libnss_wrapper_so_path
Stefan Metzmacher [Fri, 7 Apr 2017 07:27:39 +0000 (09:27 +0200)]
resolv_wrapper: use conf.blddir to construct libnss_wrapper_so_path

conf.blddir might not the the same as conf.srcdir + '/bin'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agonss_wrapper: use conf.blddir to construct libnss_wrapper_so_path
Stefan Metzmacher [Fri, 7 Apr 2017 07:27:39 +0000 (09:27 +0200)]
nss_wrapper: use conf.blddir to construct libnss_wrapper_so_path

conf.blddir might not the the same as conf.srcdir + '/bin'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoscript/compare_cc_results.py: ignore all LIB*_WRAPPER_SO_PATH values
Stefan Metzmacher [Fri, 7 Apr 2017 07:26:53 +0000 (09:26 +0200)]
script/compare_cc_results.py: ignore all LIB*_WRAPPER_SO_PATH values

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoselftest: tests idmap mapping with idmap_rid
Ralph Boehme [Wed, 5 Apr 2017 11:27:51 +0000 (13:27 +0200)]
selftest: tests idmap mapping with idmap_rid

This adds two blackbox tests that run wbinfo --sids-to-unix-ids:

o a non-existing SID from the primary domain should return a mapping

o a SID with a bogus (and therefor unknown) domain must not return a mapping

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11961

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Apr  7 00:05:02 CEST 2017 on sn-devel-144

7 years agoselftest: new environment "ad_member_idmap_rid"
Ralph Boehme [Wed, 5 Apr 2017 11:27:14 +0000 (13:27 +0200)]
selftest: new environment "ad_member_idmap_rid"

This uses idmap_rid for the primary domain.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11961

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agowinbindd: remove unused single_domains array
Ralph Boehme [Tue, 4 Apr 2017 12:23:03 +0000 (14:23 +0200)]
winbindd: remove unused single_domains array

This was added as part of 9be918116e356c358ef77cc2933e471090088293, but
is not needed anymore as the previous commit changed the logic.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11961

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 years agowinbindd: use correct domain name for failed lookupsids
Ralph Boehme [Tue, 4 Apr 2017 12:21:25 +0000 (14:21 +0200)]
winbindd: use correct domain name for failed lookupsids

What we want here is, for failed lookupsids, pass the domain name of the
SID we were trying to lookup to the idmap backend.

But as a domain member, using

  state->single_domains[state->single_sids_done]

for this purpose will always be use our primary domain name (for S-1-5-21
SIDs that are not in our local SAM).

So for now use find_domain_from_sid_noinit() to find the domain from the
domain list. This can be removed when we switch idmap backend
determination to be based on domain SIDs, not names.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11961

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
7 years agoselftest: fix for wbinfo -s tests for wellknown SIDs
Ralph Boehme [Fri, 31 Mar 2017 14:06:18 +0000 (16:06 +0200)]
selftest: fix for wbinfo -s tests for wellknown SIDs

Rework while loop to not use a pipe as that uses a subshell for the loop
which means assigning to the variable failed is not visible in the
main script.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12727

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agowinbindd: explicit check for well-known SIDs in wb_lookupsids_bulk()
Ralph Boehme [Sun, 2 Apr 2017 11:42:45 +0000 (13:42 +0200)]
winbindd: explicit check for well-known SIDs in wb_lookupsids_bulk()

Those are implicitly already catched by the

  if (sid->num_auths != 5)

check, but I'd like to make the desired behaviour more obvious.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12727

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
7 years agoidmap_ldap: Fix CID 1404836 Dereference before null check
Volker Lendecke [Thu, 6 Apr 2017 09:35:23 +0000 (11:35 +0200)]
idmap_ldap: Fix CID 1404836 Dereference before null check

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Thu Apr  6 19:31:25 CEST 2017 on sn-devel-144

7 years agoctdb-docs: Fix documentation of -n option to ctdb tool
Amitay Isaacs [Thu, 6 Apr 2017 02:20:21 +0000 (12:20 +1000)]
ctdb-docs: Fix documentation of -n option to ctdb tool

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12733

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
7 years agowinbindd: let WBFLAG_PAM_GET_PWD_POLICY only fake the password policy
Stefan Metzmacher [Tue, 4 Apr 2017 07:24:11 +0000 (09:24 +0200)]
winbindd: let WBFLAG_PAM_GET_PWD_POLICY only fake the password policy

As WBFLAG_PAM_GET_PWD_POLICY is only kept for legacy external callers
of libwbclient, we should avoid having the complexity to do additional
network roundtrips to our domain, while we still can't garantee that
the returned password policy actually represents the reality for
the current authentication.

Instead we're calculating r->data.auth.policy.expire and
r->data.auth.policy.min_passwordage based on the effective
{last,allow,force}_password_change values.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Apr  6 14:03:09 CEST 2017 on sn-devel-144

7 years agopam_winbind: no longer use wbcUserPasswordPolicyInfo when authenticating
Stefan Metzmacher [Sun, 2 Apr 2017 22:19:25 +0000 (00:19 +0200)]
pam_winbind: no longer use wbcUserPasswordPolicyInfo when authenticating

The expiry time for the specific user comes from
info->pass_must_change_time and nothing else.

The authenticating DC knows which password policy applies
to the user, that's nothing the client can do, as
domain trusts and fine-grained password policies makes
this a very complex task.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12725

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
7 years agotests dsdb: load paramaters from test environment
Gary Lockyer [Mon, 3 Apr 2017 20:56:47 +0000 (08:56 +1200)]
tests dsdb: load paramaters from test environment

Load the test environment specific parameters

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Apr  6 10:06:05 CEST 2017 on sn-devel-144

7 years agopassword_hash: refactor setup_supplemental_field
Gary Lockyer [Thu, 30 Mar 2017 20:17:07 +0000 (09:17 +1300)]
password_hash: refactor setup_supplemental_field

refactored to make it easier to add extra password hashes.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agopassword_hash: Add tests to allow refactoring
Gary Lockyer [Fri, 31 Mar 2017 02:50:31 +0000 (15:50 +1300)]
password_hash: Add tests to allow refactoring

Add tests for password_hash.c to allow refactoring of setup_supplemental_field

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
7 years agoselftest: fix SID composition in a test script
Ralph Boehme [Wed, 5 Apr 2017 09:13:43 +0000 (11:13 +0200)]
selftest: fix SID composition in a test script

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Apr  5 17:59:32 CEST 2017 on sn-devel-144

7 years agorpcclient: allow -U'OTHERDOMAIN\user' again
Stefan Metzmacher [Sun, 2 Apr 2017 22:19:40 +0000 (00:19 +0200)]
rpcclient: allow -U'OTHERDOMAIN\user' again

I guess the primary reason for forcing lp_workgroup()
was the usage of -U% together with schannel,
see source3/script/tests/test_rpcclient_samlogon.sh

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12731

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Apr  5 14:09:23 CEST 2017 on sn-devel-144

7 years agoctdb-daemon: Add tracking of migration records
Amitay Isaacs [Tue, 21 Mar 2017 05:48:45 +0000 (16:48 +1100)]
ctdb-daemon: Add tracking of migration records

Instead of using hopcount as a metric for hot records, use the number
of migrations per second as a metric.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Apr  5 08:35:45 CEST 2017 on sn-devel-144

7 years agoctdb-daemon: For hot records, use count instead of hopcount
Amitay Isaacs [Mon, 3 Apr 2017 07:32:32 +0000 (17:32 +1000)]
ctdb-daemon: For hot records, use count instead of hopcount

This avoids tying hopcounts to hot records.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agoctdb-common: Add hash_count abstraction
Amitay Isaacs [Fri, 17 Mar 2017 07:00:40 +0000 (18:00 +1100)]
ctdb-common: Add hash_count abstraction

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agoctdb-common: Add traverse_update function to db_hash abstraction
Amitay Isaacs [Fri, 17 Mar 2017 07:00:16 +0000 (18:00 +1100)]
ctdb-common: Add traverse_update function to db_hash abstraction

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
7 years agoTestBase: restore setting FEATURE_SEAL in insta_creds
Gary Lockyer [Thu, 30 Mar 2017 18:03:30 +0000 (07:03 +1300)]
TestBase: restore setting FEATURE_SEAL in insta_creds

The setting of FEATURE_SEAL by default in insta_creds got removed when
the code was moved from password_lockout.py.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Wed Apr  5 04:46:29 CEST 2017 on sn-devel-144

7 years agowafsamba: move -L/some/path from LINKFLAGS_PYEMBED to LIBPATH_PYEMBED
Stefan Metzmacher [Tue, 28 Mar 2017 13:28:21 +0000 (15:28 +0200)]
wafsamba: move -L/some/path from LINKFLAGS_PYEMBED to LIBPATH_PYEMBED

LINKFLAGS should not have path components.

This fixes the build on systems like FreeBSD where python
is located in /usr/local/lib.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12724

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Apr  4 16:10:18 CEST 2017 on sn-devel-144

7 years agos4: server: Fix crash in NTVFS server caused by ordering of destructor calls.
Jeremy Allison [Sat, 1 Apr 2017 15:34:48 +0000 (15:34 +0000)]
s4: server: Fix crash in NTVFS server caused by ordering of destructor calls.

In the NTVFS server we have the following talloc heirarchy:

                                   event_ctx
                                     |
        ---------------------------------------------------- .. other children
        |                       |                      |
     msg_dgm_ref              srv_conn            msg_dgm_ref
        ^                       |
        |                    NTVFS structures
        |                       |
        |                    XXXXXX
        |                       |
        |                       |
        --------------------- pointer to msg_dgm_ref

Some of the structures under NTVFS (marked XXXXX) can have
pointers to imessaging contexts which internally have pointers
to msg_dgm_ref structurs allocated off event_ctx.

The original code calls:

        model_ops->terminate(event_ctx, srv_conn->lp_ctx, reason);
        talloc_free(srv_conn);

But model_ops->terminate() calls talloc_free(event_ctx) and
then calls exit(). In this case srv_conn is never explicitly
freed, but only freed as a talloc child of the event_ctx.

Depending on the ordering of the linked list of talloc children
under event_ctx(which can be reordered via talloc_free/reinit
of msg_dgm_ref) a pointer to msg_dgm_ref under srv_conn can
be left pointing to memory that was already freed. This pointer
is then used in the destructor for a file object called when
srv_conn is freed.

Re-ordering this to explicitly call TALLOC_FREE(srv_conn) first
and then model_ops->terminate() fixes this problem.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Apr  2 05:18:39 CEST 2017 on sn-devel-144

7 years agowinbindd: trigger possible passdb_dsdb initialisation
Ralph Boehme [Wed, 29 Mar 2017 09:13:46 +0000 (11:13 +0200)]
winbindd: trigger possible passdb_dsdb initialisation

If the passdb backend is passdb_dsdb the domain SID comes from dsdb, not
from secrets.tdb. As we use the domain SID in various places, we must
ensure the domain SID is migrated from dsdb to secrets.tdb before
get_global_sam_sid() is called the first time.

The migration is done as part of the passdb_dsdb initialisation, calling
pdb_get_domain_info() triggers it.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12729

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr  1 21:18:59 CEST 2017 on sn-devel-144

7 years agoselftest: wbinfo --sids-to-unix-ids tests for wellknown SIDs
Ralph Boehme [Fri, 31 Mar 2017 14:24:05 +0000 (16:24 +0200)]
selftest: wbinfo --sids-to-unix-ids tests for wellknown SIDs

This test passes even without the fix, as in sids2xids we use the
lookupnames just to determine the mapping domain, using the default
idmap domain as fallback if that fails.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12727

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agoselftest: wbinfo -s tests for wellknown SIDs
Ralph Boehme [Fri, 31 Mar 2017 14:06:18 +0000 (16:06 +0200)]
selftest: wbinfo -s tests for wellknown SIDs

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12727

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agowinbindd: use passdb backend for well-known SIDs
Ralph Boehme [Thu, 30 Mar 2017 21:41:59 +0000 (23:41 +0200)]
winbindd: use passdb backend for well-known SIDs

On a DC well-known SIDs like S-1-1-0 (everyone) *must* be handled by the
local domain, otherwise something simple like this fails with
WBC_ERR_DOMAIN_NOT_FOUND:

$ make testenv SELFTEST_TESTENV=nt4_dc SCREEN=1

localnt4dc2$ ./bin/wbinfo --sid-to-name S-1-1-0
failed to call wbcLookupSid: WBC_ERR_DOMAIN_NOT_FOUND
Could not lookup sid S-1-1-0

On a member server asking our DC works and is what we're currently
doing, but changing it to ask passdb avoids the overhead.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12727

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agos4: messaging. Add imessaging_reinit_all() function.
Jeremy Allison [Wed, 29 Mar 2017 18:11:37 +0000 (11:11 -0700)]
s4: messaging. Add imessaging_reinit_all() function.

Ensure it is called from process_standard.c after
every fork().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Mar 31 14:48:17 CEST 2017 on sn-devel-144

7 years agoselftest: Define template homedir for 'ad_member' env
Andreas Schneider [Fri, 17 Mar 2017 09:04:19 +0000 (10:04 +0100)]
selftest: Define template homedir for 'ad_member' env

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12699

With this set, the samba3.local.nss test for ad_member will ensure that
we correctly substitute those smb.conf options.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 30 04:26:18 CEST 2017 on sn-devel-144

7 years agos3:tests: Add a subsitution test for %D %u %g
Andreas Schneider [Wed, 15 Mar 2017 11:37:08 +0000 (12:37 +0100)]
s3:tests: Add a subsitution test for %D %u %g

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12699

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
7 years agowinbindd: Fix password policy for pam authentication
Christof Schmitt [Mon, 27 Mar 2017 22:11:08 +0000 (15:11 -0700)]
winbindd: Fix password policy for pam authentication

Authenticating users from trusted domains would return the password
policy of the joined domain. Fix the code so that the password policy of
the joined domain is only returned for users from that domain.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12725

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Christof Schmitt <cs@samba.org>
Autobuild-Date(master): Wed Mar 29 22:54:47 CEST 2017 on sn-devel-144

7 years agoctdb-tools: Avoid deferencing argv[0] if argc == 0
Amitay Isaacs [Tue, 7 Mar 2017 03:13:10 +0000 (14:13 +1100)]
ctdb-tools: Avoid deferencing argv[0] if argc == 0

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12723

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Mar 29 11:07:18 CEST 2017 on sn-devel-144

7 years agoWHATSNEW: Add entry for auth audit
Andrew Bartlett [Mon, 27 Mar 2017 00:17:35 +0000 (13:17 +1300)]
WHATSNEW: Add entry for auth audit

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Mar 29 06:35:12 CEST 2017 on sn-devel-144

7 years agowhitespace: auth_log_pass_change.py python conventions
Garming Sam [Fri, 24 Mar 2017 00:52:58 +0000 (13:52 +1300)]
whitespace: auth_log_pass_change.py python conventions

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
7 years agoldap_server: Move a variable into a smaller scope
Garming Sam [Thu, 23 Mar 2017 23:20:19 +0000 (12:20 +1300)]
ldap_server: Move a variable into a smaller scope

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
7 years agowhitespace: auth_log.c C code conventions
Garming Sam [Thu, 23 Mar 2017 22:33:51 +0000 (11:33 +1300)]
whitespace: auth_log.c C code conventions

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
7 years agowhitespace: auth_log.py python conventions
Garming Sam [Thu, 23 Mar 2017 21:51:05 +0000 (10:51 +1300)]
whitespace: auth_log.py python conventions

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
7 years agoauth log: Add tests for anonymous bind and SamLogon
Gary Lockyer [Thu, 23 Mar 2017 22:02:36 +0000 (11:02 +1300)]
auth log: Add tests for anonymous bind and SamLogon

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agopython: Add bindings for NTLMSSP
Andrew Bartlett [Thu, 23 Mar 2017 03:30:05 +0000 (16:30 +1300)]
python: Add bindings for NTLMSSP

This is helpful for building NTLMv2 packets in python for testing against the SamLogon server

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agopycredentials: Add bindings for get_ntlm_response()
Andrew Bartlett [Wed, 22 Mar 2017 03:40:40 +0000 (16:40 +1300)]
pycredentials: Add bindings for get_ntlm_response()

This should make testing of SamLogon from python practical

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agorpc_server: Re-order and rename remote and local address in np_open()
Gary Lockyer [Thu, 23 Mar 2017 01:05:56 +0000 (14:05 +1300)]
rpc_server: Re-order and rename remote and local address in np_open()

We use this order and name consistently eleswhere.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agoldap_server: Log failures to find a valid user in the simple bind
Gary Lockyer [Wed, 22 Mar 2017 23:39:25 +0000 (12:39 +1300)]
ldap_server: Log failures to find a valid user in the simple bind

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agodsdb: Add authentication audit logging for LDAP password change
Andrew Bartlett [Fri, 17 Mar 2017 02:58:17 +0000 (15:58 +1300)]
dsdb: Add authentication audit logging for LDAP password change

This ensures this particular vector is not forgotten

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agosamr: Add logging of password change success and failure
Andrew Bartlett [Fri, 17 Mar 2017 00:26:13 +0000 (13:26 +1300)]
samr: Add logging of password change success and failure

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agoauth log tests: password change tests
Gary Lockyer [Mon, 20 Mar 2017 20:59:45 +0000 (09:59 +1300)]
auth log tests: password change tests

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoheimdal: Pass extra information to hdb_auth_status() to log success and failures
Andrew Bartlett [Tue, 21 Feb 2017 01:07:54 +0000 (14:07 +1300)]
heimdal: Pass extra information to hdb_auth_status() to log success and failures

We now pass on the original client name and the client address to allow
consistent audit logging in Samba across multiple protocols.

We use config->db[0] to find the first database to record incorrect
users.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agos3-rpc_server: Provide hooks required for JSON message logging for the no-auth case
Andrew Bartlett [Mon, 13 Mar 2017 22:01:54 +0000 (11:01 +1300)]
s3-rpc_server: Provide hooks required for JSON message logging for the no-auth case

This is triggered in the ncacn_np pass-though case in particular

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agos3-rpc_server: Re-order and rename remote and local address in make_external_rpc_pipe...
Andrew Bartlett [Thu, 16 Mar 2017 21:29:02 +0000 (10:29 +1300)]
s3-rpc_server: Re-order and rename remote and local address in make_external_rpc_pipe{,_p}()

We use this order and name consistently eleswhere.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agos3-rpc_server: pass remote and local address to rpc_pipe_open_external
Andrew Bartlett [Thu, 16 Mar 2017 21:26:03 +0000 (10:26 +1300)]
s3-rpc_server: pass remote and local address to rpc_pipe_open_external

We want the real client address here for audit purposes, if possible.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agos4-ntvfs: Correct mixup between local/remote addresses
Gary Lockyer [Thu, 9 Mar 2017 23:43:42 +0000 (12:43 +1300)]
s4-ntvfs: Correct mixup between local/remote addresses

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos3-rpc_server: Rename client -> remote_client and server -> local_server
Gary Lockyer [Thu, 9 Mar 2017 23:13:24 +0000 (12:13 +1300)]
s3-rpc_server: Rename client -> remote_client and server -> local_server

This changes struct dcerpc_ncacn_conn

While these names may have been clear, much of Samba uses
remote_address and local_address, and this difference has hidden bugs.

By using both names we avoid a little of this.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos3-rpc_server: Re-order local and remote address in make_server_pipes_struct()
Gary Lockyer [Thu, 9 Mar 2017 23:38:33 +0000 (12:38 +1300)]
s3-rpc_server: Re-order local and remote address in make_server_pipes_struct()

The rest of the code uses remote before local, and this
often causes bugs

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos3-named_pipe_auth: Rename client -> remote_client and server -> local_server
Gary Lockyer [Thu, 9 Mar 2017 23:33:06 +0000 (12:33 +1300)]
s3-named_pipe_auth: Rename client -> remote_client and server -> local_server

This brings the callers of named_pipe_auth in line with that subsystem.

Much of Samba uses remote_address and local_address, and this difference
has hidden bugs

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos4-named_pipe_auth: Rename client -> remote_client and server -> local_server
Gary Lockyer [Thu, 9 Mar 2017 22:38:56 +0000 (11:38 +1300)]
s4-named_pipe_auth: Rename client -> remote_client and server -> local_server

This brings the callers of named_pipe_auth in line with that subsystem.

While these names may be better, the rest of Samba consistently uses
remote_address and local_address, and this difference has hidden bugs

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agonamed_pipe_auth: Rename client -> remote_client and server -> local_server
Gary Lockyer [Thu, 9 Mar 2017 22:37:56 +0000 (11:37 +1300)]
named_pipe_auth: Rename client -> remote_client and server -> local_server

While these names may have been clear, much of Samba uses
remote_address and local_address, and this difference has hidden bugs.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoselftest: Turn on auth event notification and so allow tests to pass
Andrew Bartlett [Fri, 24 Mar 2017 02:19:32 +0000 (15:19 +1300)]
selftest: Turn on auth event notification and so allow tests to pass

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agoauth: Add hooks for notification of authentication events over the message bus
Andrew Bartlett [Fri, 24 Mar 2017 02:18:46 +0000 (15:18 +1300)]
auth: Add hooks for notification of authentication events over the message bus

This will allow tests to be written to confirm the correct events are triggered.

We pass in a messaging context from the callers

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agoauth_log: Improve comment
Andrew Bartlett [Fri, 24 Mar 2017 02:16:34 +0000 (15:16 +1300)]
auth_log: Improve comment

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agoauth_log: Prepared to allow logging JSON events to a server over the message bus
Andrew Bartlett [Tue, 7 Mar 2017 03:50:38 +0000 (16:50 +1300)]
auth_log: Prepared to allow logging JSON events to a server over the message bus

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos4-messaging: split up messaging into a smaller library for send only
Andrew Bartlett [Fri, 24 Mar 2017 02:11:35 +0000 (15:11 +1300)]
s4-messaging: split up messaging into a smaller library for send only

This will help avoid a dep loop when the low-level auth code relies on the message
code to deliver authentication messages

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agoauth_log: Add JSON logging of Authorisation and Authentications
Gary Lockyer [Mon, 6 Mar 2017 03:16:51 +0000 (16:16 +1300)]
auth_log: Add JSON logging of Authorisation and Authentications

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Pair-Programmed: Andrew Bartlett <abartlet@samba.org>

7 years agoauth: Log the transport connection for the authorization
Andrew Bartlett [Mon, 6 Mar 2017 01:10:17 +0000 (14:10 +1300)]
auth: Log the transport connection for the authorization

We also log if a simple bind was over TLS, as this particular case matters to a lot of folks

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agoldap_server: Log access without a bind
Andrew Bartlett [Thu, 2 Mar 2017 23:53:06 +0000 (12:53 +1300)]
ldap_server: Log access without a bind

This can be over the privileged ldapi socket, or just as the implicit anonymous access

However, do not log for setting up StartTLS, or a rootDSE search.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoauth_log: Split up auth/authz logging levels and handle anonymous better
Andrew Bartlett [Thu, 2 Mar 2017 23:40:04 +0000 (12:40 +1300)]
auth_log: Split up auth/authz logging levels and handle anonymous better

We typically do not want a lot of logging of anonymous access, as this is often
simple a preperation for authenticated access, so we make that level 5.

Bad passwords remain at level 2, successful password authentication is level 3
and successful authorization (eg kerberos login to SMB) is level 4.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos3-rpc_server: Log authorization to DCE/RPC for anonymous and ncacn_np pass-though
Andrew Bartlett [Thu, 2 Mar 2017 23:03:04 +0000 (12:03 +1300)]
s3-rpc_server: Log authorization to DCE/RPC for anonymous and ncacn_np pass-though

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos4-rpc_server: Log authorization to DCE/RPC for anonymous and ncacn_np pass-though
Andrew Bartlett [Thu, 2 Mar 2017 22:49:43 +0000 (11:49 +1300)]
s4-rpc_server: Log authorization to DCE/RPC for anonymous and ncacn_np pass-though

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoldap_server: Log authorization for simple binds
Andrew Bartlett [Wed, 1 Mar 2017 03:49:01 +0000 (16:49 +1300)]
ldap_server: Log authorization for simple binds

Existing comment is no longer relevant.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos4-auth: Log SMB authorization for bare NTLM (NTLMSSP/krb5 already done)
Andrew Bartlett [Wed, 1 Mar 2017 03:28:06 +0000 (16:28 +1300)]
s4-auth: Log SMB authorization for bare NTLM (NTLMSSP/krb5 already done)

gensec_session_info() is not called for bare NTLM, so we have to log manually

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos3-auth: Log SMB authorization for bare NTLM (NTLMSSP/krb5 already done)
Andrew Bartlett [Wed, 1 Mar 2017 03:27:51 +0000 (16:27 +1300)]
s3-auth: Log SMB authorization for bare NTLM (NTLMSSP/krb5 already done)

gensec_session_info() is not called for bare NTLM, so we have to log manually

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoauth_log: Also log the final type of authentication (ntlmssp,krb5)
Andrew Bartlett [Wed, 1 Mar 2017 03:00:03 +0000 (16:00 +1300)]
auth_log: Also log the final type of authentication (ntlmssp,krb5)

Administrators really care about how their users were authenticated, so make
this clear.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoauth_log: Expand to include the type of password used (eg ntlmv2)
Andrew Bartlett [Wed, 1 Mar 2017 02:06:25 +0000 (15:06 +1300)]
auth_log: Expand to include the type of password used (eg ntlmv2)

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agodns: Provide local and remote socket address to GENSEC
Andrew Bartlett [Wed, 1 Mar 2017 01:19:50 +0000 (14:19 +1300)]
dns: Provide local and remote socket address to GENSEC

This can be used for logging and for Kerberos channel bindings

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoauth: Add logging of service authorization
Andrew Bartlett [Tue, 28 Feb 2017 23:18:49 +0000 (12:18 +1300)]
auth: Add logging of service authorization

In ntlm_auth.c and authdata.c, the session info will be incomplete

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agorpc: Always supply both the remote and local address to the auth subsystem
Gary Lockyer [Fri, 24 Feb 2017 00:29:12 +0000 (13:29 +1300)]
rpc: Always supply both the remote and local address to the auth subsystem

This ensures that gensec, and then the NTLM auth subsystem under it, always gets the
remote and local address pointers for potential logging.

The local address allows us to know which interface an authentication is on

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoauth: Always supply both the remote and local address to the auth subsystem
Andrew Bartlett [Thu, 23 Feb 2017 01:31:52 +0000 (14:31 +1300)]
auth: Always supply both the remote and local address to the auth subsystem

This ensures that gensec, and then the NTLM auth subsystem under it, always gets the
remote and local address pointers for potential logging.

The local address allows us to know which interface an authentication is on

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos3-auth: Clarify the role and purpose of the auth_serversupplied_info->security_token
Andrew Bartlett [Tue, 28 Feb 2017 22:23:28 +0000 (11:23 +1300)]
s3-auth: Clarify the role and purpose of the auth_serversupplied_info->security_token

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoauth: Generate a human readable Authentication log message.
Gary Lockyer [Thu, 23 Feb 2017 00:50:14 +0000 (13:50 +1300)]
auth: Generate a human readable Authentication log message.

Add a human readable authentication log line, to allow
verification that all required details are being passed.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agodebug: Add debug class for auth_audit
Andrew Bartlett [Sun, 19 Feb 2017 22:39:17 +0000 (11:39 +1300)]
debug: Add debug class for auth_audit

This will be an audit stream of authentication and connection-level authorization

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos3-auth: Split out get_user_sid_info3_and_extra() from create_local_nt_token_from_info3()
Andrew Bartlett [Tue, 28 Feb 2017 22:22:43 +0000 (11:22 +1300)]
s3-auth: Split out get_user_sid_info3_and_extra() from create_local_nt_token_from_info3()

This will allow us to get the SID in another location for logging

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agolib/util: Add functions to escape log lines but not break all non-ascii
Gary Lockyer [Tue, 28 Feb 2017 22:10:29 +0000 (11:10 +1300)]
lib/util: Add functions to escape log lines but not break all non-ascii

We do not want to turn every non-ascii username into a pile of hex, so we instead focus
on avoding newline insertion attacks and other low control chars

Pair-programmed-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
7 years agos4-rpc_server: Correct comment about where the current iface can be found
Andrew Bartlett [Tue, 21 Feb 2017 03:22:07 +0000 (16:22 +1300)]
s4-rpc_server: Correct comment about where the current iface can be found

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agowinbindd: Clarify that we do not pre-hash the password for rpccli_netlogon_password_l...
Andrew Bartlett [Mon, 20 Feb 2017 23:14:12 +0000 (12:14 +1300)]
winbindd: Clarify that we do not pre-hash the password for rpccli_netlogon_password_logon()

rpccli_netlogon_password_logon() is called in winbind_samlogon_retry_loop() if interactive
is set, and does not use the hashed passwords.

This is only needed for winbindd_dual_auth_passdb(), and by moving the call we both
avoid the extra work and allow it to also be removed in this code path

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoauth: Add "auth_description" to allow logs to distinguish simple bind (etc)
Andrew Bartlett [Mon, 20 Feb 2017 22:57:57 +0000 (11:57 +1300)]
auth: Add "auth_description" to allow logs to distinguish simple bind (etc)

This will allow the authentication log to indicate clearly how the password was
supplied to the server.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoldap_server: Move code into authenticate_ldap_simple_bind()
Andrew Bartlett [Mon, 20 Feb 2017 02:57:03 +0000 (15:57 +1300)]
ldap_server: Move code into authenticate_ldap_simple_bind()

This function is only called for simple binds, and by moving the mapping into
the function call we allow the unmapped values to be included in the
user_info and so logged.

We also include the local address and the remote address of the client
for future logging

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoauth: Add a reminder about the strings currently used for auditing
Andrew Bartlett [Mon, 20 Feb 2017 02:55:34 +0000 (15:55 +1300)]
auth: Add a reminder about the strings currently used for auditing

We will soon have a much better replacement, but a note here may help some in the transition

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos4-ldap_server: Do not set conn->session_info to NULL, keep valid at all times
Andrew Bartlett [Thu, 9 Mar 2017 02:10:14 +0000 (15:10 +1300)]
s4-ldap_server: Do not set conn->session_info to NULL, keep valid at all times

We need this to be valid, right up until a new session_info is created and
it is replaced.

We need this to have a valid value at all times, and we are still anonymous
until the new bind completes

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos4-ldap_server: Set remote and local address values into GENSEC
Andrew Bartlett [Tue, 21 Feb 2017 01:15:05 +0000 (14:15 +1300)]
s4-ldap_server: Set remote and local address values into GENSEC

This will allow channel bindings and logging of the address values used during
authentication

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos4-ldap_server: Split gensec setup into a helper function
Andrew Bartlett [Mon, 20 Feb 2017 02:54:47 +0000 (15:54 +1300)]
s4-ldap_server: Split gensec setup into a helper function

This makes the error handling simpler when we set more
details onto the gensec context.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoauth: Fill in user_info->service_description from all callers
Andrew Bartlett [Mon, 20 Feb 2017 01:52:07 +0000 (14:52 +1300)]
auth: Fill in user_info->service_description from all callers

This will allow the logging code to make clear which protocol an authentication was for.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agontlm_auth: Set ntlm_auth as the service_description into gensec
Andrew Bartlett [Mon, 20 Feb 2017 01:18:57 +0000 (14:18 +1300)]
ntlm_auth: Set ntlm_auth as the service_description into gensec

This allows this use case to be clearly found when logged.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos3-auth: Pass service_description into gensec via auth_generic_prepare()
Andrew Bartlett [Mon, 20 Feb 2017 01:17:34 +0000 (14:17 +1300)]
s3-auth: Pass service_description into gensec via auth_generic_prepare()

This allows the GENSEC service description to be set from the various callers
that go via this function.

The RPC service description is the name of the interface from the IDL.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agogensec: Pass service_description into auth_usersuppliedinfo during NTLMSSP
Andrew Bartlett [Mon, 20 Feb 2017 01:15:46 +0000 (14:15 +1300)]
gensec: Pass service_description into auth_usersuppliedinfo during NTLMSSP

This allows the GENSEC service description to be read at authentication time
for logging, eg that the user authenticated to the SAMR server

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agogensec: Add gensec_{get,set}_target_service_description()
Andrew Bartlett [Mon, 20 Feb 2017 00:32:47 +0000 (13:32 +1300)]
gensec: Add gensec_{get,set}_target_service_description()

This allows a free text description of what the server-side service is for logging
purposes where the various services may be using the same Kerberos service or not
use Kerberos.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos4-netlogon: Remember many more details in the auth_usersupplied info for future...
Andrew Bartlett [Sun, 19 Feb 2017 23:04:52 +0000 (12:04 +1300)]
s4-netlogon: Remember many more details in the auth_usersupplied info for future logs

This will allow a very verbose JSON line to be logged that others can audit from in the future

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agos4-smbd: Remember the original client and server IPs from the SMB connection
Andrew Bartlett [Sun, 19 Feb 2017 23:01:37 +0000 (12:01 +1300)]
s4-smbd: Remember the original client and server IPs from the SMB connection

We need to know in the RPC server the original address the client came from
so that we can log this with the authentication audit information

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
7 years agoauth_log: Add tests by listening for JSON messages over the message bus
Andrew Bartlett [Tue, 14 Mar 2017 03:43:06 +0000 (16:43 +1300)]
auth_log: Add tests by listening for JSON messages over the message bus

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Pair-programmed-by: Gary Lockyer <gary@catalyst.net.nz>