Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.

Commit 11c4e14

Browse files
committed
Revert "Propagate host DNS to workspaces"
This reverts commit 4778145.
1 parent 4778145 commit 11c4e14

File tree

8 files changed

+11
-22
lines changed

8 files changed

+11
-22
lines changed

app/agent/agent-util.service.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,22 @@ export class AgentUtilService {
9292
}
9393
}
9494

95-
async writeFile(
96-
ssh: NodeSSH,
97-
path: string,
98-
content: string,
99-
useSudo: boolean = false,
100-
): Promise<void> {
101-
const cmdPrefix = useSudo ? ["sudo"] : [];
95+
async writeFile(ssh: NodeSSH, path: string, content: string): Promise<void> {
10296
// I don't use SFTP because I've found it to be unreliable, causing
10397
// untraceable errors.
10498
try {
10599
await execSshCmd(
106100
{
107101
ssh,
108102
opts: {
109-
stdin: content,
103+
execOptions: {
104+
env: {
105+
FILE_CONTENT: content,
106+
} as any,
107+
},
110108
},
111109
},
112-
[...cmdPrefix, "bash", "-c", `cat - > ${path}`],
110+
["bash", "-c", `echo -n "$FILE_CONTENT" > ${path}`],
113111
);
114112
} catch (err) {
115113
throw new Error(`Failed to write file "${path}": ${(err as any)?.message}`);

app/agent/firecracker.service.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,12 +498,6 @@ export class FirecrackerService {
498498
useSudo,
499499
);
500500
}
501-
await this.agentUtilService.writeFile(
502-
ssh,
503-
"/etc/resolv.conf",
504-
(await fsAsync.readFile(this.agentConfig.dnsConfigPath)).toString(),
505-
useSudo,
506-
);
507501
const r = await fn({
508502
ssh,
509503
sshConfig,

app/config/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ export const config = makeConfig()({
3939
"/srv/jailer/resources/checkout-and-inspect.ext4",
4040
defaultWorkspaceRootFs:
4141
process.env.DEFAULT_WORKSPACE_ROOTFS_PATH ?? "/srv/jailer/resources/default-workspace.ext4",
42-
// DNS config which will be propagated to vm's
43-
dnsConfigPath: process.env.AGENT_DNS_CONFIG_PATH ?? "/host/resolv.conf",
4442
prebuildSshPublicKey:
4543
process.env.AGENT_PREBUILD_SSH_PUBLIC_KEY ?? DEFAULT_PREBUILD_SSH_KEY_PUBLIC,
4644
prebuildSshPrivateKey:

hocus-workspace/resources/docker/dnssetup

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# Required-Stop:
66
# Default-Start: 2 3 4 5
77
# Default-Stop:
8-
# Short-Description: Setups /etc/hosts
8+
# Short-Description: Setups /etc/resolv.conf
99
### END INIT INFO
10+
echo "nameserver 8.8.8.8" > /etc/resolv.conf
1011
echo "127.0.0.1 localhost" >> /etc/hosts

ops/docker/agent-dev.docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,4 @@ services:
3030
- "${REPO_DIR}:/app"
3131
- "${HOCUS_RESOURCES_DIR}:/srv/jailer"
3232
- /dev/kvm:/dev/kvm
33-
- /etc/resolv.conf:/host/resolv.conf:ro
3433
command: sleep infinity

ops/docker/agent-in-hocus.docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ services:
1616
- "${AGENT_REPO_DIR}:/app"
1717
- "${HOCUS_RESOURCES_DIR}:/srv/jailer"
1818
- /dev/kvm:/dev/kvm
19-
- /etc/resolv.conf:/host/resolv.conf:ro
2019
environment:
2120
- "HOCUS_DEV_GIT_NAME=${HOCUS_DEV_GIT_NAME}"
2221
- "HOCUS_DEV_GIT_EMAIL=${HOCUS_DEV_GIT_EMAIL}"

ops/docker/hocus-local.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,3 @@ services:
228228
volumes:
229229
- agent_data:/srv/jailer:rw
230230
- /dev/kvm:/dev/kvm
231-
- /etc/resolv.conf:/host/resolv.conf:ro

resources/docker/dnssetup

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# Required-Stop:
66
# Default-Start: 2 3 4 5
77
# Default-Stop:
8-
# Short-Description: Setups /etc/hosts
8+
# Short-Description: Setups /etc/resolv.conf
99
### END INIT INFO
10+
echo "nameserver 8.8.8.8" > /etc/resolv.conf
1011
echo "127.0.0.1 localhost" >> /etc/hosts

0 commit comments

Comments
 (0)