hVGp d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z m
Z
ddlmZ ddl
mZmZ ddlmZ dd lmZmZ dd
lmZmZ ddlmZ ddlmZ dd
lmZmZmZm Z ddl!m"Z"m#Z# ddl$m%Z& ej' e( Z) G d de Z*dS )u
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Copyright © 2019 Cloud Linux Software Inc.
This software is also available under ImunifyAV commercial license,
see
N)randint)TimeoutExpired)ANTIVIRUS_MODE
CustomBilling) HookEvent)
AV_DEFAULT_ID
LicenseCLN)
MessageSource)CLNCLNError)APIErrorIndependentAgentIDAPI)
hosting_panel)PanelException) await_forrecurring_checkretry_onsafe_cancel_task)DAYHOUR)Licensec e Zd ZeZeZeZdez Zd Z d Z
d Zd Zde
egfdZdede
egfd Zdefd
Z ee ee eez
d
Zd Z ee d ZdS )CheckLicense c h d | _ d | _ d | _ d | _ d | _ d| _ d| _ d S )NF)loopsinkcheck_hooks_taskcheck_license_taskcheck_iaid_token_taskexpiring_calledexpired_calledselfs O/opt/imunify360/venv/lib/python3.11/site-packages/imav/plugins/check_license.py__init__zCheckLicense.__init__6 s> $"&%)"$# c K || _ || _ | j | | _ | j | | _ d S N)r r create_taskcheck_hooksr _recurring_checkr )r$ r r s r%
create_sourcezCheckLicense.create_source? sg $ 5 5d6F6F6H6H I I"&)"7"7!!###
#
r' c K t | j d {V t | j d {V | j rt | j d {V d S d S r) )r r r r r# s r% shutdownzCheckLicense.shutdownG s t4555555555t6777777777% ?"4#=>>>>>>>>>>> ? ?r' c K t j | d {V d {V n# t j $ r Y d S t $ r< t
d t j | j d {V Y nHt $ r< t
d t j | j d {V Y nw xY w)NTz-Token signatures verification timeout expiredz*An exception occurred during license check)
asynciosleep_checkCancelledErrorr loggererror
RETRY_TIMEOUT Exception exceptionr# s r% r, zCheckLicense._recurring_checkM s
8
8m$++--$7$7$7$7$7$78888888888)
!
8
8
8LMMMmD$677777777777
8
8
8 !MNNNmD$677777777777
8
8s 28 C
ACACCreturnc K t r-t j s!t j st j r d| j fS | d d {V S )NFIPL)key)r r
IP_LICENSEUPGRADE_URLUPGRADE_URL_360TOKEN_UPDATE_PERIOD_register_by_keyr# s r% _register_by_ipzCheckLicense._register_by_ipZ sd 7-": 7(
7M,I
7d666**u*555555555r' r= c K t j | d{V d| j t d| j dz z fS # t $ r.}t
d| d| j fcY d}~S d}~wt j $ r t $ r.}t
d| d| j fcY d}~S d}~ww xY w)z
Try to register imunify key in CLN.
:param str key: key to register
:return: tuple of (bool, float): (success, timeout)
NTr zFailed to register: %sF)r registerrA r r r5 warningr1 r4 r8 r6 r7 )r$ r= es r% rB zCheckLicense._register_by_key` s -,s#########1G4+q05 5
3 3 3NN3Q777$22222222% - - -LL11555$,,,,,,,, -s/ ;A
B=
#A3-B=3B=#B82B=8B=c K | d{V \ }}|sLt j r9t j d{V x}r| | d{V \ }}|S )z
Try to register any available license for the current customer.
IPL license has the highest priority.
Returns the timeout value.
N)rC PatchmanLicense is_activeget_imunify_keyrB )r$
registeredtimeoutr= _s r% _register_linked_licensez%CheckLicense._register_linked_licenset s %)$8$8$:$:::::::
G >o799 >+;=========s
>#'#8#8#=#=======
7r' )seconds)on_errorrN c <