Skip to content

Commit de1e9eb

Browse files
committed
TCR-815: Add section "Website Isolation (beta) -> CageFS per domain
1 parent 9cfe76a commit de1e9eb

File tree

3 files changed

+318
-0
lines changed

3 files changed

+318
-0
lines changed

docs/.vuepress/config-client/documents.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,10 @@ export default [
2828
title: "End-user Documents",
2929
description: "Documentation section for end-users on Cloudlinux OS.",
3030
link: "/user-docs/user-docs-shared-pro-cloudlinux/",
31+
},
32+
{
33+
title: "Website Isolation",
34+
description: "A security feature that provides domain-level isolation within CageFS.",
35+
link: "/cloudlinuxos/website_isolation/",
3136
}
3237
]

docs/.vuepress/config-client/sidebar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export default {
6060
"/cloudlinuxos/shared-pro/",
6161
"/cloudlinuxos/command-line_tools/",
6262
"/cloudlinuxos/max_webserver/",
63+
"/cloudlinuxos/website_isolation/",
6364
"/cloudlinuxos/alt-ea_packages/",
6465
"/cloudlinuxos/control_panel_integration/",
6566
"/cloudlinuxos/cloudlinux_os_kernel/",
Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
# Website Isolation (BETA)
2+
3+
## CageFS Per Domain
4+
5+
Website Isolation is a security feature that provides domain-level isolation within CageFS. It allows server administrators to isolate individual websites from each other, even when they belong to the same hosting account. This prevents cross-site attacks where a compromised website could access files or data from other websites on the same account.
6+
7+
### Overview
8+
9+
When Website Isolation is enabled for a domain:
10+
11+
* Each isolated website runs in its own isolated environment
12+
* PHP processes for isolated websites cannot access files from other websites
13+
* Crontab entries are automatically scoped to their respective document roots
14+
* Existing PHP processes are gracefully terminated and restarted in the isolated environment
15+
16+
### Prerequisites
17+
18+
#### Minimum Package Versions
19+
20+
| Package | Minimum Version |
21+
| ------------------ | --------------- |
22+
| cagefs | 7.6.29-1 |
23+
| lve (liblve) | 2.2-1 |
24+
| lve-wrappers | 0.7.13-1 |
25+
| alt-python27-cllib | 3.4.33-1 |
26+
27+
#### Compatible PHP Handlers
28+
29+
| Handler | Status |
30+
| ------- | ---------------------------- |
31+
| LSAPI | ✅ Supported (Recommended) |
32+
| CGI | ✅ Supported |
33+
| FPM | 🔜 Coming in future releases |
34+
| FCGI | 🔜 Coming in future releases |
35+
36+
:::tip Warning
37+
Website Isolation currently supports LSAPI and CGI handlers only. FPM and FCGI support is planned for future releases
38+
:::
39+
40+
***
41+
42+
### Quick Start
43+
44+
Follow these steps to enable Website Isolation for a domain:
45+
46+
**1. Enable the feature server-wide (administrator only, one-time setup):**
47+
48+
```
49+
cagefsctl --site-isolation-allow
50+
```
51+
52+
**2. Enable isolation for a specific domain:**
53+
54+
```
55+
cagefsctl --site-isolation-enable <example.com>
56+
```
57+
58+
**3. Verify isolation is active:**
59+
60+
```
61+
cagefsctl --site-isolation-list
62+
```
63+
64+
To disable isolation for a domain:
65+
66+
```
67+
cagefsctl --site-isolation-disable <example.com>
68+
```
69+
70+
***
71+
72+
### Command Reference
73+
74+
##### Enable Website Isolation Server-Wide
75+
76+
```
77+
cagefsctl --site-isolation-allow
78+
```
79+
80+
Enables the Website Isolation feature server-wide. This must be executed by the server administrator before individual domains can be isolated.
81+
82+
**Example:**
83+
84+
```
85+
# cagefsctl --site-isolation-allow
86+
Website isolation was enabled server-wide.
87+
```
88+
89+
**Notes:**
90+
91+
* Creates the feature flag at `/opt/cloudlinux/flags/enabled-flags.d/website-isolation.flag`
92+
* Triggers a CageFS remount to apply necessary mount configurations
93+
* Must be run with root privileges
94+
95+
***
96+
97+
##### Disable Website Isolation Server-Wide
98+
99+
```
100+
cagefsctl --site-isolation-deny
101+
```
102+
103+
Disables the Website Isolation feature server-wide and removes all domain isolation configurations.
104+
105+
**Example:**
106+
107+
```
108+
# cagefsctl --site-isolation-deny
109+
Website isolation was disabled server-wide.
110+
```
111+
112+
**Warning:** This command will:
113+
114+
* Disable isolation for all currently isolated domains
115+
* Remove all per-user isolation configurations
116+
* Terminate and restart affected PHP processes
117+
* Clean up token directories and overlay storage
118+
119+
***
120+
121+
#### Domain-Level Management
122+
123+
##### Enable Isolation for a Domain
124+
125+
```
126+
cagefsctl --site-isolation-enable <domain> [<domain2> ...]
127+
```
128+
129+
Enables Website Isolation for one or more specified domains.
130+
131+
**Parameters:**
132+
133+
| Parameter | Description |
134+
| ---------- | -------------------------------------------- |
135+
| `<domain>` | Domain name to isolate (e.g., `example.com`) |
136+
137+
**Example:**
138+
139+
```
140+
# cagefsctl --site-isolation-enable example.com
141+
Website isolation was enabled for domain(s),
142+
<example.com>
143+
144+
# cagefsctl --site-isolation-enable site1.com site2.com
145+
Website isolation was enabled for domain(s),
146+
site1.com,site2.com
147+
```
148+
149+
**Requirements:**
150+
151+
* Website Isolation must be enabled server-wide first
152+
* The domain must exist and be associated with a valid user account
153+
* Must be run with root privileges
154+
155+
> \[!NOTE]
156+
> Currently, this command requires root execution. Future releases may allow end users to enable isolation for their own domains.
157+
158+
**What happens when isolation is enabled:**
159+
160+
1. A unique website token directory is created
161+
2. Overlay storage directory is configured for the website
162+
3. User configuration is updated with the isolated domain
163+
4. If this is the first isolated website for the user, CageFS is remounted
164+
5. Existing PHP processes for the domain are terminated and restarted in isolation
165+
166+
***
167+
168+
##### Disable Isolation for a Domain
169+
170+
```
171+
cagefsctl --site-isolation-disable <domain> [<domain2> ...]
172+
```
173+
174+
Disables Website Isolation for one or more specified domains.
175+
176+
**Parameters:**
177+
178+
| Parameter | Description |
179+
| ---------- | ------------------------------------ |
180+
| `<domain>` | Domain name to remove from isolation |
181+
182+
**Example:**
183+
184+
```
185+
# cagefsctl --site-isolation-disable <example.com>
186+
Website isolation was disabled for domain(s),
187+
<example.com>
188+
```
189+
190+
**Requirements:**
191+
192+
* Must be run with root privileges
193+
194+
:::tip Note
195+
Currently, this command requires root execution. Future releases may allow end users to disable isolation for their own domains
196+
:::
197+
198+
**What happens when isolation is disabled:**
199+
200+
1. Domain is removed from the user's isolation configuration
201+
2. Mount configuration is regenerated
202+
3. PHP processes for the domain are restarted outside of isolation
203+
4. Token directories are cleaned up
204+
205+
***
206+
207+
#### Monitoring and Management
208+
209+
##### List Isolated Domains
210+
211+
```
212+
cagefsctl --site-isolation-list [<username> ...]
213+
```
214+
215+
Lists all users and domains that have Website Isolation enabled.
216+
217+
**Parameters:**
218+
219+
| Parameter | Description |
220+
| ------------ | --------------------------------------------- |
221+
| `<username>` | (Optional) Filter results by specific user(s) |
222+
223+
**Example - List all isolated domains:**
224+
225+
```
226+
# cagefsctl --site-isolation-list
227+
228+
Domains with enabled website isolation for user john:
229+
example.com
230+
mysite.org
231+
232+
Domains with enabled website isolation for user jane:
233+
shop.example.com
234+
```
235+
236+
**Example - List isolated domains for specific user:**
237+
238+
```
239+
# cagefsctl --site-isolation-list john
240+
241+
Domains with enabled website isolation for user john:
242+
example.com
243+
mysite.org
244+
```
245+
246+
**Output when no domains are isolated:**
247+
248+
```
249+
# cagefsctl --site-isolation-list
250+
No users with enabled Website isolation
251+
```
252+
253+
***
254+
255+
##### Regenerate Isolation Configuration
256+
257+
```
258+
cagefsctl --site-isolation-regenerate <username> [<username2> ...]
259+
```
260+
261+
Regenerates the Website Isolation configuration for specified users. Use this command after manual configuration changes or when troubleshooting isolation issues.
262+
263+
**Parameters:**
264+
265+
| Parameter | Description |
266+
| ------------ | ------------------------------------------- |
267+
| `<username>` | Username(s) to regenerate configuration for |
268+
269+
**Example:**
270+
271+
```
272+
# cagefsctl --site-isolation-regenerate john jane
273+
Regenerated configuration website isolation for users:
274+
john
275+
jane
276+
```
277+
278+
**When to use:**
279+
280+
* After domain document root changes
281+
* After domain renames or migrations
282+
* When isolation configuration appears out of sync
283+
* As part of troubleshooting steps recommended by support
284+
285+
***
286+
287+
### Troubleshooting
288+
289+
#### Common Issues
290+
291+
**"Website isolation is not enabled server-wide"**
292+
293+
```
294+
# Solution: Enable server-wide first
295+
cagefsctl --site-isolation-allow
296+
```
297+
298+
**"Please specify existing domain name and try again"**
299+
300+
* Verify the domain exists in the control panel
301+
* Check that the domain is associated with a valid user account
302+
303+
***
304+
305+
### Integration with Control Panels
306+
307+
Website Isolation integrates automatically with supported control panels. When domains are:
308+
309+
* **Created**: No automatic action (isolation must be explicitly enabled)
310+
* **Renamed**: Isolation configuration is automatically updated
311+
* **Deleted**: Isolation configuration is automatically cleaned up
312+
* **Document root changed**: Configuration is regenerated via hooks

0 commit comments

Comments
 (0)