|
87 | 87 | ['curl', '--silent', '--show-error', '--fail', '--max-time', '15', |
88 | 88 | '--write-out', '\n%{http_code}'] |
89 | 89 | + (['--insecure'] if megaproxy_services.https.certificate == 'self-signed' else []) |
90 | | - + ['https://' ~ item.hostname ~ ':' ~ (item.port | string) ~ '/'] |
| 90 | + + ['https://' ~ item.hostname ~ ':' ~ (megaproxy_services.https.port | string) ~ '/'] |
91 | 91 | }} |
92 | 92 | register: decoy_response |
93 | 93 | changed_when: false |
94 | 94 | delegate_to: localhost |
95 | 95 | become: false |
96 | | - loop: "{{ megaproxy_https_public_routes | default([]) }}" |
| 96 | + loop: "{{ megaproxy_https_public_routes | default([]) | selectattr('probe_resistance_enabled') | list }}" |
97 | 97 | when: |
98 | 98 | - megaproxy_services.https is defined |
99 | 99 | - megaproxy_services.https.enabled | bool |
100 | | - - megaproxy_services.https.probe_resistance.enabled | bool |
101 | 100 |
|
102 | 101 | - name: Ensure decoy does not disclose proxy software |
103 | 102 | ansible.builtin.assert: |
|
107 | 106 | - "'proxy-authenticate' not in (item.stdout | lower)" |
108 | 107 | - "'gost' not in (item.stdout | lower)" |
109 | 108 | - "'megaproxy' not in (item.stdout | lower)" |
| 109 | + - "'content=\"noindex,nofollow\"' in item.stdout" |
110 | 110 | loop: "{{ decoy_response.results | default([]) }}" |
111 | 111 | when: megaproxy_services.https is defined and megaproxy_services.https.enabled | bool |
112 | 112 |
|
| 113 | + - name: Read robots.txt from masked routes |
| 114 | + ansible.builtin.command: |
| 115 | + argv: >- |
| 116 | + {{ |
| 117 | + ['curl', '--silent', '--show-error', '--fail', '--max-time', '15'] |
| 118 | + + (['--insecure'] if megaproxy_services.https.certificate == 'self-signed' else []) |
| 119 | + + ['https://' ~ item.hostname ~ ':' ~ (megaproxy_services.https.port | string) ~ '/robots.txt'] |
| 120 | + }} |
| 121 | + loop: "{{ megaproxy_https_public_routes | default([]) | selectattr('probe_resistance_enabled') | list }}" |
| 122 | + register: robots_responses |
| 123 | + changed_when: false |
| 124 | + delegate_to: localhost |
| 125 | + become: false |
| 126 | + when: megaproxy_services.https is defined and megaproxy_services.https.enabled | bool |
| 127 | + |
| 128 | + - name: Require robots.txt to disallow crawling |
| 129 | + ansible.builtin.assert: |
| 130 | + that: |
| 131 | + - >- |
| 132 | + item.stdout == 'User-agent: *\nDisallow: /' |
| 133 | + loop: "{{ robots_responses.results | default([]) }}" |
| 134 | + when: item is not skipped |
| 135 | + |
113 | 136 | - name: Probe CONNECT without credentials |
114 | 137 | ansible.builtin.command: |
115 | 138 | argv: |
|
0 commit comments