Client: authd authentication.
This commit is contained in:
parent
f5f7a9297b
commit
301d8f7a7c
1
Makefile
1
Makefile
@ -35,6 +35,7 @@ TTL ?= 3600
|
||||
TARGET ?=
|
||||
run-client-rr-add-a:
|
||||
@$(LD_P) ./bin/dnsmanager-client user rr add A $(DOMAIN) $(NAME) $(TTL) $(TARGET) $(LOGIN_OPT)
|
||||
|
||||
run-client-rr-update-a:
|
||||
@$(LD_P) ./bin/dnsmanager-client user rr update A $(DOMAIN) $(RRID) $(NAME) $(TTL) $(TARGET) $(LOGIN_OPT)
|
||||
|
||||
|
@ -25,8 +25,6 @@ end
|
||||
class Actions
|
||||
property the_call = {} of String => Proc(Nil)
|
||||
property dnsmanagerd : DNSManager::Client
|
||||
property authd : AuthD::Client
|
||||
#property authd_config : Baguette::Configuration::Auth
|
||||
property config : Baguette::Configuration::DNSManager
|
||||
|
||||
def initialize(@dnsmanagerd, @config)
|
||||
@ -48,8 +46,6 @@ class Actions
|
||||
@the_call["user-rr-del"] = ->user_rr_del
|
||||
|
||||
@the_call["user-domain-list"] = ->user_domain_list
|
||||
|
||||
@authd = AuthD::Client.new
|
||||
end
|
||||
|
||||
def admin_maintenance
|
||||
@ -177,7 +173,7 @@ def main
|
||||
Baguette::Configuration::Auth.get || Baguette::Configuration::Auth.new
|
||||
end
|
||||
|
||||
# Authd configuration.
|
||||
# DNSmanager configuration.
|
||||
config = if no_configuration
|
||||
Baguette::Log.info "do not load a configuration file (dnsmanagerd)."
|
||||
Baguette::Configuration::DNSManager.new
|
||||
@ -201,15 +197,15 @@ def main
|
||||
exit 0
|
||||
end
|
||||
|
||||
# Authd authentication, get the token and quit right away.
|
||||
# If login == pass == "undef": do not even try.
|
||||
if authd_config.login.nil? || authd_config.pass.nil?
|
||||
Baguette::Log.info "no authd login."
|
||||
else
|
||||
Baguette::Log.info "authd login..."
|
||||
login = authd_config.login.not_nil!
|
||||
pass = authd_config.pass.not_nil!
|
||||
# Authd authentication, get the token and quit right away.
|
||||
token = authd_get_token login: login, pass: pass
|
||||
# Then push the token to the dnsmanager daemon.
|
||||
dnsmanagerd.login token
|
||||
Baguette::Log.info "logged."
|
||||
end
|
||||
@ -221,6 +217,8 @@ def main
|
||||
actions.the_call[Context.command].call
|
||||
rescue e
|
||||
Baguette::Log.info "The command is not recognized (or implemented)."
|
||||
Baguette::Log.info "Exception: #{e}."
|
||||
pp! e
|
||||
end
|
||||
|
||||
# dnsmanagerd disconnection
|
||||
|
Loading…
Reference in New Issue
Block a user