# # \brief Test for TOR # \author Stefan Kalkowski # \date 2016-06-24 # # # Currently this scenario needs static network settings, # which we can only anticipate under QEMU # assert_spec x86 if {![have_include power_on/qemu]} { puts "\n Run script is not supported on this platform. \n"; exit 0 } set build_components { app/fetchurl app/tor core drivers/nic drivers/rtc timer init lib/vfs/jitterentropy server/dynamic_rom server/nic_router server/ram_fs } source ${genode_dir}/repos/base/run/platform_drv.inc append_platform_drv_build_components build $build_components create_boot_directory set config { } append_platform_drv_config append config { SOCKSPort 10.1.2.2:9050 DataDirectory /tor } install_config $config set boot_modules { core curl.lib.so dynamic_rom fetchurl init ld.lib.so libc.lib.so vfs.lib.so posix.lib.so libcrypto.lib.so libevent.lib.so libm.lib.so libssh.lib.so libssl.lib.so lwip_legacy.lib.so nic_drv nic_router pthread.lib.so ram_fs rtc_drv timer tor vfs_jitterentropy.lib.so zlib.lib.so } append_platform_drv_boot_modules build_boot_image $boot_modules # # Prepare network environment # set tapdev tap0 set netdev eth0 set username $tcl_platform(user) if {[have_include power_on/qemu]} { if { [info exists ::env(TAP) ] } { set tapdev $::env(TAP) } if { [info exists ::env(ETH) ] } { set netdev $::env(ETH) } exec sudo tunctl -u $username -t $tapdev > /dev/null exec sudo ifconfig $tapdev up exec sudo ifconfig $tapdev 10.1.1.1 netmask 255.255.255.0 exec sudo iptables -t nat -A POSTROUTING -o $netdev -j MASQUERADE exec sudo iptables -A FORWARD -i $tapdev -o $netdev -j ACCEPT exec sudo iptables -A FORWARD -i $netdev -o $tapdev -m state --state RELATED,ESTABLISHED -j ACCEPT exec sudo sysctl -w net.ipv4.ip_forward=1 append qemu_args " -nographic -net nic,model=e1000 -net tap,ifname=tap0,downscript=no,script=no " } # # Execute test case # run_genode_until {.*Congratulations. This browser is configured to use Tor.*/n} 300 set serial_id [output_spawn_id] set core_pid [exp_pid -i $serial_id] exec kill -9 $core_pid # # Reset network environment again # if {[have_include power_on/qemu]} { exec sudo sysctl -w net.ipv4.ip_forward=0 >/dev/null exec sudo iptables -F exec sudo iptables -t nat -F exec sudo ifconfig $tapdev down exec sudo tunctl -d $tapdev >/dev/null } # vi: set ft=tcl :