mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-10-27 19:37:21 +00:00
Create GPO to configure proxy for clients
This commit is contained in:
1 parent
404a25bdf7
commit
e1557aede7
3 files changed
+36
No files matched your search
@@ -120,3 +120,23 @@
|
|||||||
win_shell: powershell C:\eidf\{{ server_hardening_script }}
|
win_shell: powershell C:\eidf\{{ server_hardening_script }}
|
||||||
tags: apply_hardening_scripts
|
tags: apply_hardening_scripts
|
||||||
when: inventory_hostname in groups['meta-name_dc01']
|
when: inventory_hostname in groups['meta-name_dc01']
|
||||||
|
|
||||||
|
- name: Squid Proxy GPO Script
|
||||||
|
tags: proxy_script
|
||||||
|
block:
|
||||||
|
- name: Copy Squid GPO Script
|
||||||
|
vars:
|
||||||
|
proxy_vm: "{{ os_project }}-{{ win_project }}-proxy"
|
||||||
|
proxy_address: "{{ hostvars[proxy_vm].ansible_host }}:3128"
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: "{{ squid_proxy_script_tmpl }}"
|
||||||
|
dest: "{{ script_dir }}\\{{ squid_proxy_script }}"
|
||||||
|
force: true
|
||||||
|
tags: copy_proxy_script
|
||||||
|
|
||||||
|
- name: Apply Squid GPO Script
|
||||||
|
win_shell: "powershell {{ script_dir }}\\{{ squid_proxy_script }}"
|
||||||
|
tags: create_proxy_gpo
|
||||||
|
when: |
|
||||||
|
inventory_hostname in groups['meta-name_dc01'] and
|
||||||
|
project_zone == 'protected'
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
New-GPO -Name "Squid Proxy" -comment "Configure Client VMs to use Squid HTTP proxy"
|
||||||
|
Set-GPRegistryValue -Name "Squid Proxy" -ValueName "ProxyEnable" -key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Value 1 -Type DWord
|
||||||
|
Set-GPRegistryValue -Name "Squid Proxy" -ValueName "ProxyServer" -key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Value "{{ proxy_address }}" -Type String
|
||||||
|
Set-GPRegistryValue -Name "Squid Proxy" -ValueName "ProxyOverride" -key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Value "<local>" -Type String
|
||||||
|
Set-GPRegistryValue -Name "Squid Proxy" -ValueName "Proxy" -key "HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel" -Value 1 -Type DWord
|
||||||
|
|
||||||
|
$DomainInfo = Get-ADDomain
|
||||||
|
$DomainOU = $DomainInfo.DistinguishedName
|
||||||
|
$workbenchOU = (Get-ADOrganizationalUnit -Identity "OU=Workbench,$DomainOU").DistinguishedName
|
||||||
|
|
||||||
|
New-GPLink -Name "Squid Proxy" -Target $workbenchOU
|
||||||
|
|
||||||
|
Write-Output "THIS SCRIPT ACTUALLY RAN" | Out-File -FilePath 'C:\eidf\ProxyScript.txt'
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
group_policy_script: OpenStackADBuild.ps1
|
group_policy_script: OpenStackADBuild.ps1
|
||||||
server_hardening_script: serverhardening.ps1
|
server_hardening_script: serverhardening.ps1
|
||||||
|
squid_proxy_script: proxy_gpo.ps1
|
||||||
|
squid_proxy_script_tmpl: proxy_gpo.ps1.j2
|
||||||
|
script_dir: C:\eidf
|
||||||
|
|
||||||
OUs:
|
OUs:
|
||||||
- Project Users
|
- Project Users
|
||||||
|
|||||||
Reference in new issue
Block a user