Remove references of the shared key, which isn't required anymore.
This commit is contained in:
		
							parent
							
								
									fd2d5d8962
								
							
						
					
					
						commit
						225d606807
					
				
					 1 changed files with 3 additions and 19 deletions
				
			
		
							
								
								
									
										22
									
								
								src/main.cr
									
										
									
									
									
								
							
							
						
						
									
										22
									
								
								src/main.cr
									
										
									
									
									
								
							| 
						 | 
					@ -31,16 +31,15 @@ class DNSManager::Service < IPC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	property authd            : AuthD::Client
 | 
						property authd            : AuthD::Client
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	def initialize(@configuration, @authd_key : String)
 | 
						def initialize(@configuration)
 | 
				
			||||||
		super()
 | 
							super()
 | 
				
			||||||
		@storage = DNSManager::Storage.new @configuration.storage_directory, @configuration.recreate_indexes
 | 
							@storage = DNSManager::Storage.new @configuration.storage_directory, @configuration.recreate_indexes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		@logged_users       = Hash(Int32, AuthD::User::Public).new
 | 
							@logged_users = Hash(Int32, AuthD::User::Public).new
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# TODO: auth service isn't in the FDs pool.
 | 
							# TODO: auth service isn't in the FDs pool.
 | 
				
			||||||
		# If the service crashes, dnsmanagerd won't know it.
 | 
							# If the service crashes, dnsmanagerd won't know it.
 | 
				
			||||||
		@authd = AuthD::Client.new
 | 
							@authd = AuthD::Client.new
 | 
				
			||||||
		authd.key = @authd_key
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		self.timer @configuration.ipc_timer
 | 
							self.timer @configuration.ipc_timer
 | 
				
			||||||
		self.service_init @configuration.service_name
 | 
							self.service_init @configuration.service_name
 | 
				
			||||||
| 
						 | 
					@ -156,9 +155,6 @@ def main
 | 
				
			||||||
		# Configuration file is for dnsmanagerd.
 | 
							# Configuration file is for dnsmanagerd.
 | 
				
			||||||
		Baguette::Configuration::Auth.get || Baguette::Configuration::Auth.new
 | 
							Baguette::Configuration::Auth.get || Baguette::Configuration::Auth.new
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
	if key_file = authd_configuration.shared_key_file
 | 
					 | 
				
			||||||
		authd_configuration.shared_key = File.read(key_file).chomp
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# DNSManagerd configuration.
 | 
						# DNSManagerd configuration.
 | 
				
			||||||
	configuration = if no_configuration
 | 
						configuration = if no_configuration
 | 
				
			||||||
| 
						 | 
					@ -177,11 +173,6 @@ def main
 | 
				
			||||||
			configuration.verbosity = opt.to_i
 | 
								configuration.verbosity = opt.to_i
 | 
				
			||||||
		end
 | 
							end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		parser.on "-k key-file", "--key-file file", "Key file." do |opt|
 | 
					 | 
				
			||||||
			authd_configuration.shared_key = File.read(opt).chomp
 | 
					 | 
				
			||||||
			Baguette::Log.debug "Authd key: #{authd_configuration.shared_key.not_nil!}"
 | 
					 | 
				
			||||||
		end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		# IPC Service options
 | 
							# IPC Service options
 | 
				
			||||||
		parser.on "-s service_name", "--service_name service_name", "Service name (IPC)." do |service_name|
 | 
							parser.on "-s service_name", "--service_name service_name", "Service name (IPC)." do |service_name|
 | 
				
			||||||
			Baguette::Log.info "Service name: #{service_name}"
 | 
								Baguette::Log.info "Service name: #{service_name}"
 | 
				
			||||||
| 
						 | 
					@ -200,19 +191,12 @@ def main
 | 
				
			||||||
		end
 | 
							end
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if authd_configuration.shared_key.nil?
 | 
					 | 
				
			||||||
		Baguette::Log.error "No authd key file: cannot continue"
 | 
					 | 
				
			||||||
		exit 1
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if simulation
 | 
						if simulation
 | 
				
			||||||
		pp! authd_configuration, configuration
 | 
							pp! authd_configuration, configuration
 | 
				
			||||||
		exit 0
 | 
							exit 0
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	authd_key = authd_configuration.shared_key.not_nil!
 | 
						service = DNSManager::Service.new configuration
 | 
				
			||||||
 | 
					 | 
				
			||||||
	service = DNSManager::Service.new configuration, authd_key
 | 
					 | 
				
			||||||
	service.run
 | 
						service.run
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue