|
ssh## On the Windows DC
|
|
|
|
# enable the AD DS role on the server create the forest and domain. name what you want - include valid top level domain (.com, .local) and netbiosname
|
|
|
|
Install-WindowsFeature AD-Domain-Services -IncludeManagementTools
|
|
|
|
|
|
Install-ADDSForest -DomainName "sustaining.org" -DomainNetBiosName "sustaining" -InstallDns
|
|
|
|
# server will reboot, your local login will not work anymore, but your same uname/pwd will work on the domain you'll connnect to `[email protected]`
|
|
|
|
|
|
# set the DC up to be the NTP authority. (time has to be in sync for kerb to be happy)
|
|
# https://be-virtual.net/domain-controller-ntp-server-configuration/
|
|
|
|
|
|
# configure your network adapter for "static" IP (change to your local IP and gateway)
|
|
|
|
netsh int ip set address "Ethernet 2" static 10.12.0.4 255.255.255.0 10.12.0.1
|
|
netsh int ip set dns "Ethernet 2" static 10.12.0.4 primary
|
|
|
|
|
|
## on a windows machine (not the DC)
|
|
|
|
# point DNS to the Domain Controller and reboot. join the domain after reboot
|
|
# make sure NTP is using the DC as the time authority
|
|
|
|
# I used a servercore instance for the DC - if you want the graphical controls for active directory and dns, you install them on this machine and point them to the DC
|
|
# you'll need AD admin tools and DNS - this powershell will install the whole suite but takes a few minutes.
|
|
|
|
# Install Active Directory Domain Services and Lightweight Directory Tools
|
|
Add-WindowsCapability -Online -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0
|
|
|
|
# Install DNS Server Tools
|
|
Add-WindowsCapability -Online -Name Rsat.Dns.Tools~~~~0.0.1.0
|
|
|
|
|
|
# optional (create a dedicated user for the PROXY to use) or use an admin user.
|
|
# Ensure the following is true when creating the account.
|
|
# User must change password at next logon Un-ticked
|
|
# User cannot change password Ticked
|
|
# Password never expires Ticked
|
|
# Account is disabled Un-ticked
|
|
# By default the squid account will not be able to query the "memberOf" attribute in AD. Select the top level of your active directory domain in Active Directory Users and Computers, Right click on it and choose properties, Security Tab, Add the squid user and give it read permissions
|
|
# (should happen by default) and allow it to read "This Object and all child objects" by going into Advanced options.
|
|
|
|
|
|
# dns configuration using DNS tools
|
|
# create DNS forward lookup zone for the domain
|
|
# create reverse DNS and PTR records for the DC and the PROXY machines with their FQDN and local IP
|
|
# must be able to ping between by name
|
|
|
|
|
|
|
|
## Linux machine for squid server
|
|
|
|
#install the things and stuff
|
|
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove && sudo apt-get autoclean
|
|
apt install ntp squid krb5_user libkrb5-dev
|
|
|
|
# setup NTP to use windows DC as authority
|
|
# https://www.tekopolis.com/configuring-ntp-linux-client/
|
|
|
|
sudo nano /etc/ntp.conf
|
|
|
|
sudo systemd-resolve --interface eth0 --set-dns 10.12.0.4 --set-domain sustaining.org
|
|
|
|
curl --negotiate -u : https://localhost:3128/_security/_authenticate --verbose
|
|
|
|
sudo systemd-resolve --interface wlp2s0 --set-dns 192.168.88.22 --set-domain yourdomain.local
|
|
|
|
|
|
# update linux box and install packages
|
|
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove && sudo apt-get autoclean
|
|
|
|
apt install ntp squid krb5_user libkrb5-dev ldap-utils msktutil
|
|
|
|
|
|
# set DNS to use the windows DC and the domain for the search. must be "sticky" and not reset to default after every reboot
|
|
sudo nano /etc/resolv.conf
|
|
|
|
# test the connection
|
|
ping kerbdc.sustaining.org -c 4 && ping google.com -c 4
|
|
|
|
dig -x ip of server
|
|
dig -x ip of windows
|
|
|
|
#configure NTP and point to the dc
|
|
https://www.tekopolis.com/configuring-ntp-linux-client/
|
|
|
|
sudo nano /etc/ntp.conf
|
|
|
|
# restart ntp and test
|
|
invoke-rc.d ntp restart
|
|
ntpq -p
|
|
|
|
# configure kerb
|
|
# need to add link to gist example
|
|
nano /etc/krb5.conf
|
|
|
|
# squid
|
|
# need to add gist link
|
|
nano /etc/squid/squid.conf
|
|
|
|
# set path to default keytab
|
|
KRB5_KTNAME=/etc/squid/PROXY.keytab
|
|
export KRB5_KTNAME
|
|
|
|
# crontab to refresh kerb tickets
|
|
crontab -e
|
|
00 4 * * * msktutil --auto-update --verbose --computer-name squidkerb | logger -t msktutil
|
|
|
|
# init a kerb session to server
|
|
#kinit <ad user for proxy>
|
|
kinit proxyuser
|
|
|
|
# klist to verify that you received a ticket
|
|
|
|
# create keytab
|
|
|
|
msktutil -c -b "CN=COMPUTERS" -s HTTP/kerbproxy.sustaining.org -k /etc/squid/PROXY.keytab --computer-name kerbproxy --upn HTTP/kerbproxy.sustaining.org --server kerbdc.sustaining.org --verbose --enctypes 28
|
|
# msktutil -c -b "CN=COMPUTERS" -s HTTP/<fqdn> -h <fqdn> -k /etc/squid/PROXY.keytab --computer-name squid-http --upn HTTP/<fqdn> --server <domain controller> --verbose --enctypes 28
|
|
msktutil -c -b "CN=COMPUTERS" -s HTTP -k /etc/squid/PROXY.keytab --computer-name SQUIDKERB --upn HTTP/squidkerb.sustaining.org --server kerbdc.sustaining.org --verbose
|
|
|
|
# Set the permissions on the keytab so squid can read it.
|
|
chgrp proxy /etc/squid/PROXY.keytab
|
|
chmod g+r /etc/squid/PROXY.keytab
|
|
|
|
chgrp squid /etc/squid/PROXY.keytab; chmod g+r /etc/squid/PROXY.keytab
|
|
nano /etc/default/squid
|
|
KRB5_KTNAME=/etc/squid/PROXY.keytab
|
|
export KRB5_KTNAME
|
|
|
|
# verify that you can read the tab and that it can update
|
|
# go to active directory on windows machine. right click and reset the computer account for the proxy machine. you can also double check that the correct DNS PTR record was updated
|
|
|
|
msktutil --auto-update --verbose
|
|
|
|
|
|
# test the squid connection to kerb
|
|
|
|
/usr/lib/squid/negotiate_kerberos_auth_test -k /etc/squid/PROXY.keytab -s HTTP/[email protected]
|
|
|
|
# test the proxy with some internets
|
|
curl -O -L https://www.redhat.com/index.html --proxy-negotiate -u : -x squidkerb:3128
|
|
|
|
|
|
|
|
#squid logs
|
|
|
|
/var/log/squid/access.log and cache.log
|