MCPcopy Index your code
hub / github.com/saltstack/salt / authenticate

Method authenticate

salt/crypt.py:1829–1891  ·  view source on GitHub ↗

Authenticate with the master, this method breaks the functional paradigm, it will update the master information from a fresh sign in, signing in can occur as often as needed to keep up with the revolving master AES key. :rtype: Crypticle :returns: A

(self, _=None)

Source from the content-addressed store, hash-verified

1827 return self._crypticle
1828
1829 def authenticate(self, _=None): # TODO: remove unused var
1830 """
1831 Authenticate with the master, this method breaks the functional
1832 paradigm, it will update the master information from a fresh sign
1833 in, signing in can occur as often as needed to keep up with the
1834 revolving master AES key.
1835
1836 :rtype: Crypticle
1837 :returns: A crypticle used for encryption operations
1838 """
1839 acceptance_wait_time = self.opts["acceptance_wait_time"]
1840 acceptance_wait_time_max = self.opts["acceptance_wait_time_max"]
1841 if not acceptance_wait_time_max:
1842 acceptance_wait_time_max = acceptance_wait_time
1843 with salt.channel.client.ReqChannel.factory(
1844 self.opts, crypt="clear"
1845 ) as channel:
1846 while True:
1847 creds = self.sign_in(channel=channel)
1848 if creds == "retry":
1849 if self.opts.get("caller"):
1850 # We have a list of masters, so we should break
1851 # and try the next one in the list.
1852 if self.opts.get("local_masters", None):
1853 error = SaltClientError(
1854 "Minion failed to authenticate"
1855 " with the master, has the "
1856 "minion key been accepted?"
1857 )
1858 break
1859 else:
1860 print(
1861 "Minion failed to authenticate with the master, "
1862 "has the minion key been accepted?"
1863 )
1864 sys.exit(2)
1865 if acceptance_wait_time:
1866 log.info(
1867 "Waiting %s seconds before retry.", acceptance_wait_time
1868 )
1869 time.sleep(acceptance_wait_time)
1870 if acceptance_wait_time < acceptance_wait_time_max:
1871 acceptance_wait_time += acceptance_wait_time
1872 log.debug(
1873 "Authentication wait time is %s", acceptance_wait_time
1874 )
1875 continue
1876 break
1877 new_aes, changed_aes, changed_session = False, False, False
1878 if self._creds is None:
1879 new_aes = True
1880 log.error("%s Got new master aes key.", self)
1881 else:
1882 if self._creds["aes"] != creds["aes"]:
1883 changed_aes = True
1884 log.debug("%s The master's aes key has changed.", self)
1885 if self._creds["session"] != creds["session"]:
1886 changed_session = True

Callers 11

credsMethod · 0.95
crypticleMethod · 0.95
_old_initMethod · 0.45
_crypted_transferMethod · 0.45
connectMethod · 0.45
send_idMethod · 0.45
_decode_payloadMethod · 0.45

Calls 10

sign_inMethod · 0.95
SaltClientErrorClass · 0.90
CrypticleClass · 0.85
exitMethod · 0.80
debugMethod · 0.80
factoryMethod · 0.45
getMethod · 0.45
infoMethod · 0.45
sleepMethod · 0.45
errorMethod · 0.45