47 lines
		
	
	
		
			870 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			870 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
#
 | 
						|
# Cookbook Name:: kosmos-ipfs
 | 
						|
# Recipe:: default
 | 
						|
#
 | 
						|
 | 
						|
include_recipe "ipfs"
 | 
						|
include_recipe 'firewall'
 | 
						|
include_recipe "kosmos-ipfs::kredits_pinner"
 | 
						|
 | 
						|
node['kosmos-ipfs']['ipfs']['config'].each do |k, v|
 | 
						|
  ipfs_config k do
 | 
						|
    value v
 | 
						|
  end
 | 
						|
end
 | 
						|
 | 
						|
unless node.chef_environment == "development"
 | 
						|
  include_recipe "kosmos-ipfs::firewall_swarm"
 | 
						|
end
 | 
						|
 | 
						|
firewall_rule 'ipfs api' do
 | 
						|
  port     node['kosmos-ipfs']['api_port']
 | 
						|
  source   "10.1.1.0/24"
 | 
						|
  protocol :tcp
 | 
						|
  command  :allow
 | 
						|
end
 | 
						|
 | 
						|
firewall_rule 'ipfs gateway' do
 | 
						|
  port     node['kosmos-ipfs']['gateway_port']
 | 
						|
  source   "10.1.1.0/24"
 | 
						|
  protocol :tcp
 | 
						|
  command  :allow
 | 
						|
end
 | 
						|
 | 
						|
firewall_rule 'ipfs local p2p' do
 | 
						|
  destination "10.1.1.0/24"
 | 
						|
  direction   :out
 | 
						|
  protocol    :none
 | 
						|
  command     :allow
 | 
						|
end
 | 
						|
 | 
						|
firewall_rule 'ipfs local p2p' do
 | 
						|
  destination "10.0.0.0/8"
 | 
						|
  direction   :out
 | 
						|
  protocol    :none
 | 
						|
  command     :deny
 | 
						|
end
 |