From 3b62fcf9affc2004c59db7f8bf815253b3dcb27d Mon Sep 17 00:00:00 2001 From: fortuna Date: Thu, 18 Oct 2018 14:53:29 -0400 Subject: [PATCH] Ignore invalid ciphers --- src/shadowbox/server/outline_shadowsocks_server.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/shadowbox/server/outline_shadowsocks_server.ts b/src/shadowbox/server/outline_shadowsocks_server.ts index 40821b15..4bc7c59d 100644 --- a/src/shadowbox/server/outline_shadowsocks_server.ts +++ b/src/shadowbox/server/outline_shadowsocks_server.ts @@ -56,6 +56,11 @@ export class OutlineShadowsocksServer implements ShadowsocksServer { return new Promise((resolve, reject) => { const keysJson = {keys: [] as AccessKey[]}; for (const key of keys) { + if (!isAeadCipher(key.cipher)) { + logging.error(`Cipher ${key.cipher} for access key ${ + key.id} is not supported: use an AEAD cipher instead.`); + continue; + } keysJson.keys.push(key); } const ymlTxt = jsyaml.safeDump(keysJson, {'sortKeys': true}); @@ -92,3 +97,9 @@ export class OutlineShadowsocksServer implements ShadowsocksServer { this.ssProcess.stderr.pipe(process.stderr); } } + +// List of AEAD ciphers can be found at https://shadowsocks.org/en/spec/AEAD-Ciphers.html +function isAeadCipher(cipherAlias: string) { + cipherAlias = cipherAlias.toLowerCase(); + return cipherAlias.endsWith('gcm') || cipherAlias.endsWith('poly1305'); +} \ No newline at end of file