GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 6ceda2e5 authored by Kathleen Brade's avatar Kathleen Brade

Bug 19757: Support on-disk storage of v3 client auth keys

Create a client-auth directory within the Tor data directory and use it.
parent f53497c7
// Copyright (c) 2018, The Tor Project, Inc. // Copyright (c) 2020, The Tor Project, Inc.
// See LICENSE for licensing information. // See LICENSE for licensing information.
// //
// vim: set sw=2 sts=2 ts=8 et syntax=javascript: // vim: set sw=2 sts=2 ts=8 et syntax=javascript:
...@@ -372,6 +372,7 @@ TorProcessService.prototype = ...@@ -372,6 +372,7 @@ TorProcessService.prototype =
// Get the Tor data directory first so it is created before we try to // Get the Tor data directory first so it is created before we try to
// construct paths to files that will be inside it. // construct paths to files that will be inside it.
var dataDir = TorLauncherUtil.getTorFile("tordatadir", true); var dataDir = TorLauncherUtil.getTorFile("tordatadir", true);
var onionAuthDir = TorLauncherUtil.getTorFile("toronionauthdir", true);
var exeFile = TorLauncherUtil.getTorFile("tor", false); var exeFile = TorLauncherUtil.getTorFile("tor", false);
var torrcFile = TorLauncherUtil.getTorFile("torrc", true); var torrcFile = TorLauncherUtil.getTorFile("torrc", true);
var torrcDefaultsFile = var torrcDefaultsFile =
...@@ -388,6 +389,8 @@ TorProcessService.prototype = ...@@ -388,6 +389,8 @@ TorProcessService.prototype =
detailsKey = "torrc_missing"; detailsKey = "torrc_missing";
else if (!dataDir) else if (!dataDir)
detailsKey = "datadir_missing"; detailsKey = "datadir_missing";
else if (!onionAuthDir)
detailsKey = "onionauthdir_missing";
else if (!hashedPassword) else if (!hashedPassword)
detailsKey = "password_hash_missing"; detailsKey = "password_hash_missing";
...@@ -418,6 +421,8 @@ TorProcessService.prototype = ...@@ -418,6 +421,8 @@ TorProcessService.prototype =
args.push(torrcFile.path); args.push(torrcFile.path);
args.push("DataDirectory"); args.push("DataDirectory");
args.push(dataDir.path); args.push(dataDir.path);
args.push("ClientOnionAuthDir");
args.push(onionAuthDir.path);
args.push("GeoIPFile"); args.push("GeoIPFile");
args.push(geoipFile.path); args.push(geoipFile.path);
args.push("GeoIPv6File"); args.push("GeoIPv6File");
......
// Copyright (c) 2019, The Tor Project, Inc. // Copyright (c) 2020, The Tor Project, Inc.
// See LICENSE for licensing information. // See LICENSE for licensing information.
// //
// vim: set sw=2 sts=2 ts=8 et syntax=javascript: // vim: set sw=2 sts=2 ts=8 et syntax=javascript:
...@@ -571,6 +571,8 @@ let TorLauncherUtil = // Public ...@@ -571,6 +571,8 @@ let TorLauncherUtil = // Public
path = "Tor\\torrc"; path = "Tor\\torrc";
else if ("tordatadir" == aTorFileType) else if ("tordatadir" == aTorFileType)
path = "Tor"; path = "Tor";
else if ("toronionauthdir" == aTorFileType)
path = "Tor\\onion-auth";
else if ("pt-profiles-dir" == aTorFileType) else if ("pt-profiles-dir" == aTorFileType)
path = "Tor\\PluggableTransports"; path = "Tor\\PluggableTransports";
} }
...@@ -586,6 +588,8 @@ let TorLauncherUtil = // Public ...@@ -586,6 +588,8 @@ let TorLauncherUtil = // Public
path = "Tor/torrc"; path = "Tor/torrc";
else if ("tordatadir" == aTorFileType) else if ("tordatadir" == aTorFileType)
path = "Tor"; path = "Tor";
else if ("toronionauthdir" == aTorFileType)
path = "Tor/onion-auth";
else if ("pt-profiles-dir" == aTorFileType) else if ("pt-profiles-dir" == aTorFileType)
path = "Tor/PluggableTransports"; path = "Tor/PluggableTransports";
else if (isIPC) else if (isIPC)
...@@ -603,6 +607,8 @@ let TorLauncherUtil = // Public ...@@ -603,6 +607,8 @@ let TorLauncherUtil = // Public
path = "Tor/torrc"; path = "Tor/torrc";
else if ("tordatadir" == aTorFileType) else if ("tordatadir" == aTorFileType)
path = "Tor"; path = "Tor";
else if ("toronionauthdir" == aTorFileType)
path = "Tor/onion-auth";
else if ("pt-profiles-dir" == aTorFileType) else if ("pt-profiles-dir" == aTorFileType)
path = "Tor/PluggableTransports"; path = "Tor/PluggableTransports";
else if (isIPC) else if (isIPC)
...@@ -622,6 +628,8 @@ let TorLauncherUtil = // Public ...@@ -622,6 +628,8 @@ let TorLauncherUtil = // Public
path = "Data\\Tor\\torrc"; path = "Data\\Tor\\torrc";
else if ("tordatadir" == aTorFileType) else if ("tordatadir" == aTorFileType)
path = "Data\\Tor"; path = "Data\\Tor";
else if ("toronionauthdir" == aTorFileType)
path = "Data\\Tor\\onion-auth";
else if ("pt-profiles-dir" == aTorFileType) else if ("pt-profiles-dir" == aTorFileType)
path = "Data\\Browser"; path = "Data\\Browser";
} }
...@@ -638,6 +646,8 @@ let TorLauncherUtil = // Public ...@@ -638,6 +646,8 @@ let TorLauncherUtil = // Public
path = "Data/Tor/torrc"; path = "Data/Tor/torrc";
else if ("tordatadir" == aTorFileType) else if ("tordatadir" == aTorFileType)
path = "Data/Tor"; path = "Data/Tor";
else if ("toronionauthdir" == aTorFileType)
path = "Data/Tor/onion-auth";
else if ("pt-profiles-dir" == aTorFileType) else if ("pt-profiles-dir" == aTorFileType)
path = "Data/Browser"; path = "Data/Browser";
else if (isIPC) else if (isIPC)
...@@ -683,6 +693,7 @@ let TorLauncherUtil = // Public ...@@ -683,6 +693,7 @@ let TorLauncherUtil = // Public
try try
{ {
if (("tordatadir" == aTorFileType) || if (("tordatadir" == aTorFileType) ||
("toronionauthdir" == aTorFileType) ||
("pt-profiles-dir" == aTorFileType)) ("pt-profiles-dir" == aTorFileType))
{ {
torFile.create(torFile.DIRECTORY_TYPE, 0o700); torFile.create(torFile.DIRECTORY_TYPE, 0o700);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment