Skip to content

Commit

Permalink
Merge pull request #8 from holmesb/master
Browse files Browse the repository at this point in the history
Fixes issue #7 - allow NTLM authn
  • Loading branch information
robertdebock authored Jun 13, 2022
2 parents 143aa7a + 14c1d59 commit a057b86
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ cntlm_listen: 3128
# When you've got a password hash, you may fill it in here.
# cntlm_passntlmv2: 1234567890abcdef
# When using NTLM authentication (not NTLMv2), set to true:
cntlm_auth_ntlm: false
# What hosts to omit in the proxy.
cntlm_noproxy: localhost
Expand All @@ -81,6 +84,9 @@ cntlm_denies:
# If yes, access to CNTLM is possible from outside of the local host, subject to cntlm_allows and cntlm_denies:
gateway_enabled: "no"
# If "yes", include the default ansible_default_ipv4 IP in cntlm_allows ([inventory_hostname]['ansible_default_ipv4'])
cntlm_allows_include_local_ipv4: "no"
```

## [Requirements](#requirements)
Expand Down
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cntlm_listen: 3128

# When you've got a password hash, you may fill it in here.
# cntlm_passntlmv2: 1234567890abcdef
cntlm_auth_ntlm: false

# What hosts to omit in the proxy.
cntlm_noproxy: localhost
Expand All @@ -33,6 +34,9 @@ cntlm_tmp: /root
cntlm_allows:
- "127.0.0.1"

# If "yes", include the default ansible_default_ipv4 IP in cntlm_allows ([inventory_hostname]['ansible_default_ipv4'])
cntlm_allows_include_local_ipv4: "no"

# By default ("0/0"), CNTLM is inaccessible from all other IP addresses.
cntlm_denies:
- "0/0"
Expand Down
5 changes: 5 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
name: "{{ cntlm_requirements }}"
state: present

- name: include local IP in cntlm_allows
set_fact:
cntlm_allows: "{{ cntlm_allows + [ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] + '/32'] }}"
when: cntlm_allows_include_local_ipv4 == "yes"

- name: unpack cntlm software
ansible.builtin.unarchive:
src: "{{ cntlm_sourceforge_mirror }}/{{ cntlm_archive }}"
Expand Down
3 changes: 3 additions & 0 deletions templates/cntlm.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Proxy {{ cntlm_proxy }}
Listen {{ cntlm_listen }}
{% if cntlm_passntlmv2 is defined %}
PassNTLMv2 {{ cntlm_passntlmv2 }}
{% elif cntlm_auth_ntlm %}
Auth NTLM
{{ cntlm_generate_hash.stdout_lines[2] }}
{% else %}
{{ cntlm_generate_hash.stdout_lines[3] }}
{% endif %}
Expand Down

0 comments on commit a057b86

Please sign in to comment.