-
Notifications
You must be signed in to change notification settings - Fork 269
Process configuration arguments enclosed with double quotes (") are not properly handled #1265
Copy link
Copy link
Closed
Labels
Type: BugError or flaw producing unexpected resultsError or flaw producing unexpected results
Description
Describe the issue
Some plugin may require parameters that contain a space and that need to be enclosed within double quotes (").
At the moment, the process.c module doesn't handle such special case because it just breaks down the string by spaces, resulting in a wrong argv vector passed to the plugin.
To Reproduce
- Extract shadowtor-minimal-config from shadow-plugin-tor.
- Remove the following two lines from
conf/tor.hiddenserver.torrc:
HiddenServiceDir shadow.data/hosts/hiddenserver/hs
HiddenServicePort 80 127.0.0.1:8080
- Update shadow.config.xml and add those two parameters
--HiddenServiceDir shadow.data/hosts/hiddenserver/hs --HiddenServicePort "80 127.0.0.1:8080"to the tor plugin arguments as follows (notice how the quotes"have been encoded to"so that they can be embedded within the xml attributearguments):
<host id="hiddenserver" bandwidthdown="102400" bandwidthup="102400" >
<process plugin="tgen" starttime="1" arguments="conf/tgen.hiddenserver.graphml.xml" />
<process plugin="tor" preload="tor-preload" starttime="900" arguments="--Address ${NODEID} --Nickname ${NODEID} --DataDirectory shadow.data/hosts/${NODEID} --GeoIPFile ~/.shadow/share/geoip --defaults-torrc conf/tor.common.torrc -f conf/tor.hiddenserver.torrc --BandwidthRate 1024000 --BandwidthBurst 1024000 --HiddenServiceDir shadow.data/hosts/hiddenserver/hs --HiddenServicePort "80 127.0.0.1:8080"" />
<process plugin="torctl" starttime="901" arguments="localhost 9051 STREAM,CIRC,CIRC_MINOR,ORCONN,BW,STREAM_BW,CIRC_BW,CONN_BW"/>
</host>
- Run the simulation and observe that it fails with
** Stopping Shadow, returning code -1 (error). - Open the
shadow.data/hosts/hiddenserver/stdout-hiddenserver.tor.1001.loglog file, and observe the following error:
Jan 01 00:15:00.000 [warn] Command-line option '127.0.0.1:8080"' with no value. Failing.
This is because the string --HiddenServicePort "80 127.0.0.1:8080" is split into three tokens, i.e.
--HiddenServicePort
"80
127.0.0.1:8080"
while it should be split into two tokens (see https://www.gnu.org/software/bash/manual/bash.html#Double-Quotes) as well having the quotes stripped:
--HiddenServicePort
80 127.0.0.1:8080
Operating System (please complete the following information):
- OS and version: post the output of
lsb_release -d
Description: Ubuntu 18.04.5 LTS - Kernel version: post the output of
uname -a
Linux ****** 4.15.0-137-generic #141-Ubuntu SMP Fri Feb 19 13:46:27 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Shadow (please complete the following information):
- Version: post the output of
shadow --version
Shadow v1.13.2-696-g1c7c8da0 2021-04-04--17:14:57 running GLib v2.56.4 and IGraph v0.7.1 Shadow was built from branch main on 2021-04-06--10:25:50 in Release mode with compile options: -ggdb;-fno-omit-frame-pointer;-O3 and link options: -Wl,--no-as-needed,-rpath=/home/msimioni/.shadow/lib,-dynamic-linker=/home/******/.shadow/lib/ldso -z lazy For more information, visit https://shadow.github.io or https://github.com/shadow - Which plug-ins you are using:
Shadow-Tor
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type: BugError or flaw producing unexpected resultsError or flaw producing unexpected results