diegogslomp / samba-ad-dc

🐳 Docker image of Samba domain controller compiled from source
https://hub.docker.com/r/diegogslomp/samba-ad-dc
GNU General Public License v3.0
46 stars 18 forks source link

Issue installing #8

Closed killmasta93 closed 1 year ago

killmasta93 commented 1 year ago

Hi Currently have an issue with installing the docker container

this is my docker compose


version: "3.1"

services:
  dc1:
    image: samba:almalinux
    restart: unless-stopped
    network_mode: host
    build:
      context: .
      dockerfile: dockerfiles/almalinux
    container_name: dc1
    hostname: DC1
    privileged: true
    environment:
      REALM: FIX.LOCAL
      DOMAIN: FIX
      ADMIN_PASS: Passw0rd
      DNS_FORWARDER: 8.8.8.8
    volumes:
      - dc1-local-samba:/usr/local/samba

volumes:
  dc1-local-samba:
   driver: local-persist
   driver_opts:
     mountpoint: /samba

currently getting this error on the logs

dc1  | /usr/local/sbin/samba-domain-provision: line 22: samba-tool: command not found
dc1  | /usr/local/sbin/samba-domain-provision: line 22: samba-tool: command not found
dc1  | /usr/local/sbin/samba-domain-provision: line 22: samba-tool: command not found
dc1  | /usr/local/sbin/samba-domain-provision: line 22: samba-tool: command not found
dc1  | /usr/local/sbin/samba-domain-provision: line 22: samba-tool: command not found
dc1  | /usr/local/sbin/samba-domain-provision: line 22: samba-tool: command not found
dc1  | /usr/local/sbin/samba-domain-provision: line 22: samba-tool: command not found
dc1  | /usr/local/sbin/samba-domain-provision: line 22: samba-tool: command not found
dc1  | /usr/local/sbin/samba-domain-provision: line 22: samba-tool: command not found
dc1  | /usr/local/sbin/samba-domain-provision: line 22: samba-tool: command not found
dc1  | /usr/local/sbin/samba-domain-provision: line 22: samba-tool: command not found
dc1 exited with code 127

Thank you

diegogslomp commented 1 year ago

Hello!

This behaviour seems to be related to this, when bind mount on top of a filesystem the built files are hidden. Any trouble please let me know.

killmasta93 commented 1 year ago

Thanks for the reply, so from reading, it seems that i cant have the mind mount? or would i need permissions to give to the folder? /samba

Thank you

diegogslomp commented 1 year ago

Maybe for tests you can bind another location, copy the /usr/local/samba built files to that location and after that bind mount on top of /usr/local/samba. Please try this and if you have trouble let me know to run some tests.

killmasta93 commented 1 year ago

thank you so much for the reply, i changed it as the default docker compose and started working, and connected a windows 11 to the domain Out of curiosity when i run nslookup shouldn't the server respond correctly? instead of unknown? image

Thank you

diegogslomp commented 1 year ago

Did you set the preferred DNS from the windows client to the domain controller address?

killmasta93 commented 1 year ago

Thank you so much for the reply, correct, added the DNS on the windows, the 192.168.7.189 is the host which has samba container image

diegogslomp commented 1 year ago

When using linux as the samba server, we need add the domain controller manually to the /etc/hosts and change /etc/resolv.conf to "point" to the created domain, as described here here.

If your samba server is running on a windows machine, maybe the domain should be added to the windows server hosts file (c:\Windows\System32\Drivers\etc\hosts) in that case. Try add the info manually and see what happens, change the domain info:

192.168.7.189     DC1
192.168.7.189    DC1.your-domain.com"

Try this too:

nslookup dc1.your-domain.com
nslookup your-domain.com
killmasta93 commented 1 year ago

Thank you so much for the reply, So the Docker container is in a ubuntu 20 I created on the host ubuntu the

cat: /etc/hostt: No such file or directory
root@intranet:~# cat /etc/hosts
127.0.0.1   localhost
127.0.1.1   intranet.casa.local intranet
192.168.7.189   DC1
192.168.7.189   DC1.fix.local
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

also on the host changed the resolve to point to itself

nameserver 127.0.0.53
options edns0

on the ubuntu host working fine


root@intranet:~# nslookup
> dc1
Server:     127.0.0.53
Address:    127.0.0.53#53

Non-authoritative answer:
Name:   dc1
Address: 192.168.7.189
>

now the question is that on a windows machine that i recently connected to the domain do i also need to change the host? I thought normally once the windows domain is connected to the domain automatically finds the default DNS

Because on the windows it keeps showing unknown DNS but when i try to resolve the dc1 it works fine image

Thank you again

diegogslomp commented 1 year ago

This video shows how to configure reverse dns zone, maybe this is the next step that need to be done to resolve dns properly. The start talks about ipv6, but after that shows how to create a reverse zone, please try this connecting to the samba server from a windows client and let me know if the answer changes.

killmasta93 commented 1 year ago

wow thank you so much that did the trick thank you very much