15 lines
		
	
	
		
			428 B
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			428 B
		
	
	
	
		
			YAML
		
	
	
	
	
	
| ---
 | |
| # tasks file for verify
 | |
| 
 | |
| - name: Gather facts on listening ports
 | |
|   community.general.listen_ports_facts:
 | |
| 
 | |
| - name: TCP denylist violation
 | |
|   ansible.builtin.debug:
 | |
|     msg: TCP port {{ item.port }} by pid {{ item.pid }} violates the denylist
 | |
|   vars:
 | |
|     tcp_listen_violations: "{{ ansible_facts.tcp_listen | selectattr('port', 'in', tcp_denylist) | list }}"
 | |
|     tcp_denylist:
 | |
|       - 111
 | |
|   loop: "{{ tcp_listen_violations }}"
 |