Skip to content

Commit 7b44ed9

Browse files
committed
messy still not working proxy
1 parent 34be745 commit 7b44ed9

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

wrongsecrets-balancer/src/kubernetes.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,10 @@ const createDesktopDeploymentForTeam = async ({ team, passcodeHash }) => {
11061106
name: 'PUID',
11071107
value: '1000',
11081108
},
1109+
{
1110+
name: 'TITLE',
1111+
value: 'WrongSecrets CTF Desktop',
1112+
},
11091113
{
11101114
name: 'PGID',
11111115
value: '1000',
@@ -1191,7 +1195,7 @@ const createServiceForTeam = async (teamname) =>
11911195
},
11921196
ports: [
11931197
{
1194-
port: 8080,
1198+
port: 3000
11951199
},
11961200
],
11971201
},
@@ -1221,7 +1225,7 @@ const createDesktopServiceForTeam = async (teamname) =>
12211225
},
12221226
ports: [
12231227
{
1224-
port: 8080,
1228+
port: 3000,
12251229
targetPort: 3000,
12261230
},
12271231
],

wrongsecrets-balancer/src/proxy/proxy.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,14 @@ function proxyTrafficToJuiceShop(req, res) {
132132
req.path === '/public/css/filebrowser.css' ||
133133
req.path === '/public/js/filebrowser.js' ||
134134
req.path === '/public/js/jquery.min.js' ||
135+
req.path === '/public/css/kclient.css' ||
135136
req.path === '/vnc/vendor/interact.min.js.map' ||
136-
req.path.includes('vnc') ||
137-
req.path.includes('audio/socket.io')
137+
req.path === '/audio/socket.io/socket.io.js' ||
138+
req.path === '/files/socket.io/socket.io.js' ||
139+
req.path.includes('vnc')
138140
) {
139141
target = {
140-
target: `http://${teamname}-virtualdesktop.${teamname}.svc:8080`,
142+
target: `http://${teamname}-virtualdesktop.${teamname}.svc:3000`,
141143
ws: true,
142144
};
143145
} else {
@@ -156,7 +158,7 @@ function proxyTrafficToJuiceShop(req, res) {
156158
) {
157159
let server = res.socket.server;
158160
logger.info(
159-
'putting ws through for /quaclite or /websockify or /audio/socket.io/ or /files/socket.io/'
161+
`putting ws through for ${req.path}`
160162
);
161163
server.on('upgrade', function (req, socket, head) {
162164
cookieParser(get('cookieParser.secret'))(req, null, () => {});
@@ -172,7 +174,7 @@ function proxyTrafficToJuiceShop(req, res) {
172174
}
173175
logger.info(`proxying upgrade request for: ${req.url} with team ${upgradeTeamname}`);
174176
proxy.ws(req, socket, head, {
175-
target: `ws://${upgradeTeamname}-virtualdesktop.${upgradeTeamname}.svc:8080`,
177+
target: `ws://${upgradeTeamname}-virtualdesktop.${upgradeTeamname}.svc:3000`,
176178
ws: true,
177179
});
178180
});
@@ -183,9 +185,9 @@ function proxyTrafficToJuiceShop(req, res) {
183185
logger.info(`Got malformed teamname: ${teamname}s`);
184186
return res.redirect('/balancer/');
185187
}
186-
logger.info(`proxying upgrade request for: ${req.url} with team ${connectTeamname}`);
188+
logger.info(`proxying connect request for: ${req.url} with team ${connectTeamname}`);
187189
proxy.ws(req, socket, head, {
188-
target: `ws://${connectTeamname}-virtualdesktop.${connectTeamname}.svc:8080`,
190+
target: `ws://${connectTeamname}-virtualdesktop.${connectTeamname}.svc:3000`,
189191
ws: true,
190192
});
191193
});

0 commit comments

Comments
 (0)