I had this issue on Ubuntu 16.04
This guide was quite useful, but not complete
https://help.ubuntu.com/lts/serverguide/sssd-ad.html
But basically, the approach is, use kerberos authentication with samba to connect to the windows network,
get your network guys to give you an entry in DNS.
Then modify PAM to use krb5
As I recall, for debian, libheimdal was a weird missing piece
I also have a few AD search functions to test that I could see the ldap server properly
The following should work even if you don't have the above configured:
get_user <- function(user) {
# this will need some architecture assistance
parse_ldif(
system2(
"ldapsearch",
args =
c(
'-x','-LLL',
# Bind string here, can grab this from your rstudio connect/shiny server pro config file if you've done this before
'-D "DC=example,DC=net"',
'-W',
'-H ldap://XXX.XXX.XXX.XXX',
'-b "DC=example,DC=net"',
sprintf('-s sub "uid=%s"',user)
# Input here is the bind password
),input = "XXXXXXXXXX",stdout = TRUE,stderr = TRUE
)
)
}
# A simple parser (may not work with all LDIF, I've barely tested this elsewhere)
# If it doesn't work, just remove it from the above function
parse_ldif <- function(y) {
x <- grepl('^\\s',y)
y[which(x) - 1] <- paste0(y[which(x) - 1], trimws(y[which(x)]))
out <- y[-which(x)]
others <- out[grepl('^#',out)]
out <- out[!grepl('^#',out)]
out <- out[!grepl('^\\s', out)]
x <- read.dcf(textConnection(out),all = TRUE)
c(as.list(x),
list(otherfields = others))
}