9Vj rddlZddlmZmZejrddlmZddlmZm Z eGddZ dS)N) dataclassfield)IsolatedRootConfig) MountEntry MountTypec eZdZUdZeed<eed<eedZee ed<e de e dffd Z e de e dffd Zd e fd ed e de de e fdZde fdZddZddZde de fdZdS) MountConfigz Builds mount configuration for jail.c implementation. Accumulates MountEntry objects, then renders everything at the end. uidgidF)default_factoryrepr_mountsreturn.c,d|jd|jdfS)Nzuid=zgid=z mode=0750)r r selfs Xopt/cloudlinux/venv/lib/python3.11/site-packages/clcagefslib/webisolation/jail_config.py _default_optszMountConfig._default_optss$ dh  "3"3"3[@@c*t|jS)z.Read-only access to accumulated mount entries.)tuplerrs rmountszMountConfig.mounts!sT\"""rtype_sourcetargetoptionsc\|jt||||dS)zAdd a single mount entry.)typerrrN)rappendr)rrrrrs raddzMountConfig.add&sD           rtextcj|jttj|dS)z$Add a comment line for organization.N)rr!rrCOMMENT)rr#s rcommentzMountConfig.comment1s+ Jy'8$??@@@@@roverlayrc &|jsC|jttjd|jd|jzdS|jttj|j|jd|jzdS)z} Add mount operations for a directory overlay. Args: overlay: The overlay configuration tmpfs)mkdirN) persistentrr!rrBIND root_pathrrr's r add_overlayzMountConfig.add_overlay5s!  L  NGW-> TM_@_      L  N%%!33      rc|j|j|jt t j|j|jddS)z+Add the final mount that closes an overlay.) recursiveN) rextendrr!rrr,r-rr.s r close_overlayzMountConfig.close_overlayNsV GN+++  y~w'8'.. Y Y     rdocrootcd|dg}|d|jDd|S)z/Render complete configuration to jail.c syntax.[]c3>K|]}|VdS)N)render).0ms r z%MountConfig.render..Ys*66AQXXZZ666666r )r2rjoin)rr4liness rr9zMountConfig.renderVsGW  66666666yyrN)r'r)__name__ __module__ __qualname____doc__int__annotations__rlistrrpropertyrstrrrrr"r&r/r3r9rrr r sq HHH HHH %d G G GGT* GGG AuS#XAAAXA#j#o.###X#@BY^Y^Y`Y`     C    ERUJ     ACAAAA2     c c      rr ) typing dataclassesrr TYPE_CHECKING mount_configr mount_typesrrr rIrrrOs (((((((( 1000000........ I I I I I I I  I I I r