safepost / aiobastion

Framework for Cyberark API
MIT License
19 stars 5 forks source link

v0.1.6 and v0.1.4 breaks Radius authentication, 0.0.30 is OK #26

Open BKFlister opened 1 month ago

BKFlister commented 1 month ago

Hi, after upgrading aiobastion to v0.1.6 the radius authentication fails when sending the passcode

I suspect that the cookie CA22222 is not sent with the post for the passcode.

v0.0.30 works fine.

BR Bjorn-Kare

from aiobastion import EPV, ChallengeResponseException
import asyncio

pvwa_host = 'pvwa-server'
authtype = 'Radius'
username = 'JohnDoe'
password = 'SecretPassword'

config = {'api_host': pvwa_host}

async def main():
  vault = EPV(serialized=config) 
  try:
    await vault.login(username, password, authtype)

  except ChallengeResponseException:
    print("--- ChallengeResponseException")
    passcode = input("Enter passcode: ")
    await vault.login(username, passcode, authtype)

  async with vault as epv:
      safes = await epv.safe.list(details=True)
      print(safes)

if __name__ == '__main__':
    asyncio.run(main())
BKFlister commented 1 month ago

Hi, It seems that the finally statement in v.0.1.6 cyberArk.py, line 494, is the reason for the radius issue. It closes the current session, and when the passcode is sent, it becomes a new session with a new authentication. For now I can comment out the finally statement, and get Radius with passcode working.

cyberArk.py line 494

        finally:
            # update or clean the session
            await self.close_session()

BR Bjørn-Kåre