mirror of
https://github.com/koush/scrypted.git
synced 2026-05-16 10:20:23 +01:00
security: require explicit address on all server listens
This commit is contained in:
@@ -293,7 +293,7 @@ export async function startRtpForwarderProcess(console: Console, ffmpegInput: FF
|
||||
}
|
||||
});
|
||||
|
||||
const audioClient = await listenZeroSingleClient();
|
||||
const audioClient = await listenZeroSingleClient('127.0.0.1');
|
||||
let audioPipe: Writable;
|
||||
killDeferred.promise.finally(() => audioClient.clientPromise.then(client => client.destroy()));
|
||||
let rtspServer: RtspServer;
|
||||
@@ -421,7 +421,7 @@ export async function startRtpForwarderProcess(console: Console, ffmpegInput: FF
|
||||
// seems better to use udp for audio timing/chop.
|
||||
const useUdp = rtspMode === 'udp';
|
||||
|
||||
const serverPort = await listenZeroSingleClient();
|
||||
const serverPort = await listenZeroSingleClient('127.0.0.1');
|
||||
|
||||
args.push(
|
||||
'-rtsp_transport',
|
||||
|
||||
@@ -7,13 +7,13 @@ export class ListenZeroSingleClientTimeoutError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
export async function listenZero(server: net.Server, hostname?: string) {
|
||||
export async function listenZero(server: net.Server, hostname: string) {
|
||||
server.listen(0, hostname);
|
||||
await once(server, 'listening');
|
||||
return (server.address() as net.AddressInfo).port;
|
||||
}
|
||||
|
||||
export async function listenZeroSingleClient(hostname?: string, options?: net.ServerOpts, listenTimeout = 30000) {
|
||||
export async function listenZeroSingleClient(hostname: string, options?: net.ServerOpts, listenTimeout = 30000) {
|
||||
const server = new net.Server(options);
|
||||
const port = await listenZero(server, hostname);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user