forked from jan-leila/nix-config
		
	moved fail2ban configs into service configs
This commit is contained in:
		
							parent
							
								
									76d68cf146
								
							
						
					
					
						commit
						c7938c3fe7
					
				
					 4 changed files with 73 additions and 44 deletions
				
			
		|  | @ -53,6 +53,31 @@ in { | |||
|           pkgs.jellyfin-ffmpeg | ||||
|         ]; | ||||
|       } | ||||
|       (lib.mkIf config.services.fail2ban.enable { | ||||
|         environment.etc = { | ||||
|           "fail2ban/filter.d/jellyfin.local".text = lib.mkIf config.services.jellyfin.enable ( | ||||
|             pkgs.lib.mkDefault (pkgs.lib.mkAfter '' | ||||
|               [Definition] | ||||
|               failregex = "^.*Authentication request for .* has been denied \\\(IP: \"<ADDR>\"\\\)\\\." | ||||
|             '') | ||||
|           ); | ||||
|         }; | ||||
| 
 | ||||
|         services.fail2ban = { | ||||
|           jails = { | ||||
|             jellyfin-iptables.settings = lib.mkIf config.services.jellyfin.enable { | ||||
|               enabled = true; | ||||
|               filter = "jellyfin"; | ||||
|               action = ''iptables-multiport[name=HTTP, port="http,https"]''; | ||||
|               logpath = "${config.services.jellyfin.dataDir}/log/*.log"; | ||||
|               backend = "auto"; | ||||
|               findtime = 600; | ||||
|               bantime = 600; | ||||
|               maxretry = 5; | ||||
|             }; | ||||
|           }; | ||||
|         }; | ||||
|       }) | ||||
|       (lib.mkIf config.host.impermanence.enable { | ||||
|         fileSystems."/persist/system/jellyfin".neededForBoot = true; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue