added C/C++ and Python sources om
authorom
Tue, 12 Nov 2013 11:31:34 +0100
branchom
changeset 2c9bf2537109a
parent 1 446a7ba98309
added C/C++ and Python sources
ait/os/CMakeLists.txt
ait/os/baseinc.h
ait/os/bin/CMakeLists.txt
ait/os/bin/autoshadow/CMakeLists.txt
ait/os/bin/autoshadow/autoshadow.py
ait/os/bin/mirrorfuse/CMakeLists.txt
ait/os/bin/mirrorfuse/mirrorfuse.py
ait/os/bin/opensecurityd/CMakeLists.txt
ait/os/bin/opensecurityd/about.py
ait/os/bin/opensecurityd/credentials.py
ait/os/bin/opensecurityd/environment.py
ait/os/bin/opensecurityd/launch.py
ait/os/bin/opensecurityd/opensecurity-dialog.py
ait/os/bin/opensecurityd/opensecurity-tray.py
ait/os/bin/opensecurityd/opensecurityd.py
ait/os/bin/opensecurityd/password.py
ait/os/bin/opensecurityd/vm-start.vbs
ait/os/bin/shadowfuse/CMakeLists.txt
ait/os/bin/shadowfuse/main.cpp
ait/os/cmake/cpack/deb/control/postinst
ait/os/cmake/cpack/deb/control/postrm
ait/os/cmake/cpack/deb/control/prerm
ait/os/config.h.in
ait/os/etc/dbus-1/system.d/at.ac.ait.opensecurity.AutoShadow.conf
ait/os/share/opensecurity/192.168.56.15-putty.reg
ait/os/share/opensecurity/192.168.56.15.ppk
ait/os/share/opensecurity/192.168.56.15.pub
ait/os/share/opensecurity/OpenSecurity.reg
ait/os/share/opensecurity/gfx/ait_logo.jpg
ait/os/share/opensecurity/gfx/ait_logo_no_claim.png
ait/os/share/opensecurity/gfx/bmvit_logo.jpg
ait/os/share/opensecurity/gfx/ffg_logo.jpg
ait/os/share/opensecurity/gfx/ikarus_logo.jpg
ait/os/share/opensecurity/gfx/kiras_logo.jpg
ait/os/share/opensecurity/gfx/linz_logo.jpg
ait/os/share/opensecurity/gfx/liqua_logo.jpg
ait/os/share/opensecurity/gfx/opensecurity.ico
ait/os/share/opensecurity/gfx/opensecurity_icon_64.png
ait/os/share/opensecurity/gfx/opensecurity_logo.jpg
ait/os/share/opensecurity/gfx/x-net_logo.jpg
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ait/os/CMakeLists.txt	Tue Nov 12 11:31:34 2013 +0100
     1.3 @@ -0,0 +1,285 @@
     1.4 +# ------------------------------------------------------------
     1.5 +# CMakeLists.txt the AIT OpenSecurity ShadowFUSE
     1.6 +#
     1.7 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
     1.8 +# 
     1.9 +# Copyright (C) 2013 AIT Austrian Institute of Technology
    1.10 +# AIT Austrian Institute of Technology GmbH
    1.11 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
    1.12 +# http://www.ait.ac.at
    1.13 +#
    1.14 +# This program is free software; you can redistribute it and/or 
    1.15 +# modify it under the terms of the GNU General Public License 
    1.16 +# version 2 as published by the Free Software Foundation.
    1.17 +#
    1.18 +# This program is distributed in the hope that it will be useful,
    1.19 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.20 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.21 +# GNU General Public License for more details.
    1.22 +#
    1.23 +# You should have received a copy of the GNU Lesser General Public
    1.24 +# License along with this library; if not, write to the
    1.25 +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    1.26 +# Boston, MA 02110-1301, USA.
    1.27 +# ------------------------------------------------------------
    1.28 +
    1.29 +# project data
    1.30 +project(os-server C CXX)
    1.31 +cmake_minimum_required(VERSION 2.6)
    1.32 +
    1.33 +# load necessary basic cmake modules
    1.34 +include(CheckIncludeFile)
    1.35 +include(CheckIncludeFiles)
    1.36 +include(CheckLibraryExists)
    1.37 +include(FindPkgConfig)
    1.38 +include(FindPythonInterp)
    1.39 +
    1.40 +# enable tests
    1.41 +ENABLE_TESTING()
    1.42 +
    1.43 +
    1.44 +# ------------------------------------------------------------
    1.45 +# set global compiler flags
    1.46 +
    1.47 +set(VERSION "0.1")
    1.48 +add_definitions(-DVERSION=\"${VERSION}\")
    1.49 +
    1.50 +# we relay on a GNU/BSD SOURCE
    1.51 +add_definitions(-D_GNU_SOURCE)
    1.52 +add_definitions(-D_BSD_SOURCE)
    1.53 +
    1.54 +# set compile flags
    1.55 +if (CMAKE_COMPILER_IS_GNUCC)
    1.56 +
    1.57 +    # tweak capabilities of gcc versions prior to 4.8
    1.58 +    if (${CMAKE_C_COMPILER_VERSION} LESS 4.8)
    1.59 +    
    1.60 +        message(STATUS "gcc compiler < 4.8 detected - tweaking flags")
    1.61 +
    1.62 +        # make this clear: we use std::thread
    1.63 +        # so enforce pthread bindings
    1.64 +        # this may not be needed for gcc >= 4.8
    1.65 +        add_definitions(-pthread)
    1.66 +        
    1.67 +        # this is needed to have
    1.68 +        #   std::_this_thread::sleep(...)
    1.69 +        # at hand - at least for gcc 4.6.3 and glibc 2.15
    1.70 +        add_definitions(-D_GLIBCXX_USE_NANOSLEEP)
    1.71 +
    1.72 +        # this is needed to have
    1.73 +        #   std::_this_thread::yield()
    1.74 +        # at hand - at least for gcc 4.6.3 and glibc 2.15
    1.75 +        add_definitions(-D_GLIBCXX_USE_SCHED_YIELD)
    1.76 +        
    1.77 +    endif (${CMAKE_C_COMPILER_VERSION} LESS 4.8)
    1.78 +    
    1.79 +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Werror -Wall -Wextra -pedantic -g -ggdb3 -rdynamic")
    1.80 +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x -Werror -Wall -Wextra -pedantic -g -ggdb3 -rdynamic")
    1.81 +    
    1.82 +    # TODO: make speed tests with -fno-builtin especially to
    1.83 +    #       get a better memcpy performance
    1.84 +    #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-builtin")
    1.85 +    #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin")
    1.86 +    
    1.87 +endif (CMAKE_COMPILER_IS_GNUCC)
    1.88 +
    1.89 +# additional debug and profiling options
    1.90 +option(DEBUG_MODE_ENABLED "enable debug mode" off)
    1.91 +if (CMAKE_COMPILER_IS_GNUCC)
    1.92 +    if (DEBUG_MODE_ENABLED)
    1.93 +        message(STATUS "debug and profiling mode enabled")
    1.94 +        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -pg --coverage")
    1.95 +        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -pg --coverage")
    1.96 +    else(DEBUG_MODE_ENABLED)
    1.97 +        message(STATUS "debug and profiling mode disabled: go for optimizations")
    1.98 +        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
    1.99 +        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
   1.100 +    endif(DEBUG_MODE_ENABLED)
   1.101 +endif (CMAKE_COMPILER_IS_GNUCC)
   1.102 +
   1.103 +
   1.104 +# ------------------------------------------------------------
   1.105 +# check for an existing python module (maybe extra)
   1.106 +
   1.107 +macro(CHECK_PYTHON_MODULE VARIABLE MODULE)
   1.108 +
   1.109 +    message(STATUS "Looking for python module ${MODULE}")        
   1.110 +    
   1.111 +    if (PYTHONINTERP_FOUND)
   1.112 +    
   1.113 +        execute_process(
   1.114 +            COMMAND ${PYTHON_EXECUTABLE} -c "import ${MODULE}"
   1.115 +            RESULT_VARIABLE _result
   1.116 +            OUTPUT_QUIET
   1.117 +            ERROR_QUIET
   1.118 +            )
   1.119 +            
   1.120 +        if ("${_result}" EQUAL "0")
   1.121 +            set (${VARIABLE}_FOUND TRUE)
   1.122 +        endif ("${_result}" EQUAL "0")
   1.123 +        
   1.124 +    endif (PYTHONINTERP_FOUND)
   1.125 +
   1.126 +    if (${VARIABLE}_FOUND)
   1.127 +        message(STATUS "Looking for python module ${MODULE} - found")        
   1.128 +    else (${VARIABLE}_FOUND)
   1.129 +        message(STATUS "Looking for python module ${MODULE} - not found")        
   1.130 +    endif (${VARIABLE}_FOUND)
   1.131 +
   1.132 +endmacro(CHECK_PYTHON_MODULE MODULE)
   1.133 +
   1.134 +
   1.135 +# ------------------------------------------------------------
   1.136 +# check libs and packages (headers + lib)
   1.137 +
   1.138 +# standard C files
   1.139 +check_include_file(stdio.h HAVE_STDIO_H)
   1.140 +check_include_file(stddef.h HAVE_STDDEF_H)
   1.141 +check_include_file(stdlib.h HAVE_STDLIB_H)
   1.142 +check_include_file(inttypes.h HAVE_INTTYPES_H)
   1.143 +check_include_file(memory.h HAVE_MEMORY_H)
   1.144 +check_include_file(string.h HAVE_STRING_H)
   1.145 +check_include_file(unistd.h HAVE_UNISTD_H)
   1.146 +
   1.147 +# time
   1.148 +check_include_file(sys/time.h HAVE_SYS_TIME_H)
   1.149 +check_include_file(time.h HAVE_TIME_H)
   1.150 +
   1.151 +# file system stuff
   1.152 +check_include_file(fcntl.h HAVE_FCNTL_H)
   1.153 +check_include_file(sys/stat.h HAVE_SYS_STAT_H)
   1.154 +
   1.155 +# math
   1.156 +check_include_file(math.h HAVE_MATH_H)
   1.157 +
   1.158 +# stdbool
   1.159 +check_include_file(stdbool.h HAVE_STDBOOL_H)
   1.160 +
   1.161 +# endian
   1.162 +check_include_file(endian.h HAVE_ENDIAN_H)
   1.163 +
   1.164 +# math.h
   1.165 +check_include_file(math.h HAVE_MATH_H)
   1.166 +
   1.167 +# networking
   1.168 +check_include_file(netdb.h HAVE_NETDB_H)
   1.169 +check_include_file(ifaddrs.h HAVE_IFADDRS_H)
   1.170 +check_include_file(netinet/in.h HAVE_NETINET_IN_H)
   1.171 +check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
   1.172 +check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)
   1.173 +check_include_file(sys/un.h HAVE_SYS_UN_H)
   1.174 +
   1.175 +# assert
   1.176 +check_include_file(assert.h HAVE_ASSERT_H)
   1.177 +
   1.178 +# signal
   1.179 +check_include_file(signal.h HAVE_SIGNAL_H)
   1.180 +
   1.181 +# sys/uio
   1.182 +check_include_file(sys/uio.h HAVE_SYS_UIO_H)
   1.183 +
   1.184 +# syslog
   1.185 +check_include_file(syslog.h HAVE_SYSLOG_H)
   1.186 +
   1.187 +# errno
   1.188 +check_include_file(errno.h HAVE_ERRNO_H)
   1.189 +
   1.190 +# limits
   1.191 +check_include_file(limits.h HAVE_LIMITS_H)
   1.192 +
   1.193 +# sys/mman.h
   1.194 +check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
   1.195 +
   1.196 +# dirent.h
   1.197 +check_include_file(dirent.h HAVE_DIRENT_H)
   1.198 +
   1.199 +# fuse.h
   1.200 +pkg_check_modules(FUSE REQUIRED fuse)
   1.201 +if (FUSE_FOUND)
   1.202 +    set(HAVE_FUSE_H 1)
   1.203 +    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FUSE_CFLAGS_OTHER}")
   1.204 +    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FUSE_CFLAGS_OTHER}")
   1.205 +    set(CMAKE_REQUIRED_LIBRARIES "${FUSE_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
   1.206 +endif (FUSE_FOUND)
   1.207 +
   1.208 +# check python module dbus
   1.209 +check_python_module(PYTHON_DBUS dbus)
   1.210 +if (NOT PYTHON_DBUS_FOUND)
   1.211 +    message(FATAL_ERROR "python module 'dbus' missing.")
   1.212 +endif (NOT PYTHON_DBUS_FOUND)
   1.213 +
   1.214 +# check python module fuse
   1.215 +check_python_module(PYTHON_FUSE fuse)
   1.216 +if (NOT PYTHON_FUSE_FOUND)
   1.217 +    message(FATAL_ERROR "python module 'fuse' missing. please install 'fuse-python'.")
   1.218 +endif (NOT PYTHON_FUSE_FOUND)
   1.219 +
   1.220 +# check python module web
   1.221 +check_python_module(PYTHON_WEB web)
   1.222 +if (NOT PYTHON_WEB_FOUND)
   1.223 +    message(FATAL_ERROR "python module 'web' missing. please install 'web.py'.")
   1.224 +endif (NOT PYTHON_WEB_FOUND)
   1.225 +
   1.226 +
   1.227 +# ------------------------------------------------------------
   1.228 +# dump the config file
   1.229 +
   1.230 +# create the config.h and baseinc.h
   1.231 +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
   1.232 +include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
   1.233 +
   1.234 +
   1.235 +# ------------------------------------------------------------
   1.236 +# go through the subs
   1.237 +
   1.238 +add_subdirectory(bin)
   1.239 +
   1.240 +
   1.241 +# ------------------------------------------------------------
   1.242 +# additional stuff for installation
   1.243 +
   1.244 +install(DIRECTORY etc/dbus-1 DESTINATION /etc)
   1.245 +
   1.246 +
   1.247 +# ------------------------------------------------------------
   1.248 +# packaging
   1.249 +
   1.250 +set(CPACK_PACKAGE_NAME "opensecurity")
   1.251 +
   1.252 +set(CPACK_PACKAGE_DESCRIPTION "OpenSecurity System")
   1.253 +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This is the OpenSecurity System suite to be insalled into a Security VM")
   1.254 +set(CPACK_PACKAGE_CONTACT "Oliver Maurhart <oliver.maurhart@ait.ac.at>")
   1.255 +set(CPACK_PACKAGE_VENDOR "AIT")
   1.256 +set(CPACK_PACKAGE_VERSION_MAJOR "0")
   1.257 +set(CPACK_PACKAGE_VERSION_MINOR "1")
   1.258 +set(CPACK_PACKAGE_VERSION_PATCH "0")
   1.259 +set(CPACK_PROJECT_VERSION_STRING "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}" )
   1.260 +
   1.261 +set(CPACK_GENERATOR "DEB;RPM;")
   1.262 +set(CPACK_SOURCE_GENERATOR "TGZ")
   1.263 +
   1.264 +set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${CMAKE_SYSTEM_PROCESSOR}")
   1.265 +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
   1.266 +set(CPACK_SOURCE_IGNORE_FILES "/build/*;/.git/")
   1.267 +
   1.268 +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.13), libgcc1 (>= 1:4.4), python (>= 2.7)")
   1.269 +set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cpack/deb/control/postinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/cpack/deb/control/postrm;${CMAKE_CURRENT_SOURCE_DIR}/cmake/cpack/deb/control/prerm;")
   1.270 +
   1.271 +# debianization
   1.272 +string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
   1.273 +find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
   1.274 +if (DPKG_PROGRAM)
   1.275 +    # use dpkg to fix the package file name
   1.276 +    execute_process(
   1.277 +        COMMAND ${DPKG_PROGRAM} --print-architecture
   1.278 +        OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
   1.279 +        OUTPUT_STRIP_TRAILING_WHITESPACE
   1.280 +    )
   1.281 +    set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}_${CPACK_PROJECT_VERSION_STRING}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
   1.282 +else (DPKG_PROGRAM)
   1.283 +    set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}_${CPACK_PROJECT_VERSION_STRING}_${CMAKE_SYSTEM_NAME}")
   1.284 +endif (DPKG_PROGRAM)
   1.285 +
   1.286 +# package it
   1.287 +include(CPack)
   1.288 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/ait/os/baseinc.h	Tue Nov 12 11:31:34 2013 +0100
     2.3 @@ -0,0 +1,263 @@
     2.4 +/*
     2.5 + * baseinc.h
     2.6 + *
     2.7 + * Standard header include file to get the most common system definitions
     2.8 + *
     2.9 + * Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
    2.10 + *
    2.11 + * Copyright (C) 2013 AIT Austrian Institute of Technology
    2.12 + * AIT Austrian Institute of Technology GmbH
    2.13 + * Donau-City-Strasse 1 | 1220 Vienna | Austria
    2.14 + * http://www.ait.ac.at
    2.15 + *
    2.16 + * This library is free software; you can redistribute it and/or
    2.17 + * modify it under the terms of the GNU Lesser General Public
    2.18 + * License version 2.1 as published by the Free Software Foundation.
    2.19 + *
    2.20 + * This library is distributed in the hope that it will be useful,
    2.21 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.22 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    2.23 + * Lesser General Public License for more details.
    2.24 + *
    2.25 + * You should have received a copy of the GNU Lesser General Public
    2.26 + * License along with this library; if not, write to the
    2.27 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    2.28 + * Boston, MA 02110-1301, USA.
    2.29 + */
    2.30 +
    2.31 +#ifndef __BASEINC_H
    2.32 +#define __BASEINC_H
    2.33 +
    2.34 +// get definitions found by cmake
    2.35 +#include "config.h"
    2.36 +
    2.37 +// ------------------------------------------------------------
    2.38 +// C++
    2.39 +
    2.40 +// C++11 standard and boost stuff
    2.41 +#ifdef __cplusplus
    2.42 +#   include <algorithm>
    2.43 +#   include <atomic>
    2.44 +#   include <cassert>
    2.45 +#   include <chrono>
    2.46 +#   include <condition_variable>
    2.47 +#   include <deque>
    2.48 +#   include <exception>
    2.49 +#   include <fstream>
    2.50 +#   include <iostream>
    2.51 +#   include <iomanip>
    2.52 +#   include <limits>
    2.53 +#   include <list>
    2.54 +#   include <map>
    2.55 +#   include <memory>
    2.56 +#   include <mutex>
    2.57 +#   include <queue>
    2.58 +#   include <set>
    2.59 +#   include <stdexcept>
    2.60 +#   include <sstream>
    2.61 +#   include <string>
    2.62 +#   include <thread>
    2.63 +#   include <tuple>
    2.64 +#   include <vector>
    2.65 +
    2.66 +#   ifdef HAVE_BOOST_LIB
    2.67 +#       include <boost/algorithm/string.hpp>
    2.68 +#       include <boost/crc.hpp>
    2.69 +#       include <boost/filesystem.hpp>
    2.70 +#       include <boost/format.hpp>
    2.71 +#       include <boost/program_options.hpp>
    2.72 +#       include <boost/program_options/detail/config_file.hpp>
    2.73 +#       include <boost/range.hpp>
    2.74 +#       include <boost/tokenizer.hpp>
    2.75 +#   endif
    2.76 +
    2.77 +#endif
    2.78 +
    2.79 +
    2.80 +// ------------------------------------------------------------
    2.81 +// check defs (headers only)
    2.82 +
    2.83 +// standard C headers
    2.84 +#ifdef HAVE_STDIO_H 
    2.85 +#   include <stdio.h>
    2.86 +#endif
    2.87 +
    2.88 +#ifdef HAVE_STDDEF_H 
    2.89 +#   include <stddef.h>
    2.90 +#endif
    2.91 +
    2.92 +#ifdef HAVE_STDLIB_H
    2.93 +#   include <stdlib.h>
    2.94 +#endif
    2.95 +
    2.96 +#ifdef HAVE_INTTYPES_H
    2.97 +#   include <inttypes.h>
    2.98 +#endif
    2.99 +
   2.100 +#ifdef HAVE_MEMORY_H
   2.101 +#   include <memory.h>
   2.102 +#endif
   2.103 +
   2.104 +#ifdef HAVE_STRING_H
   2.105 +#   include <string.h>
   2.106 +#endif
   2.107 +
   2.108 +#ifdef HAVE_UNISTD_H
   2.109 +#   include <unistd.h>
   2.110 +#endif
   2.111 +
   2.112 +
   2.113 +// stdbool.h
   2.114 +#ifdef HAVE_STDBOOL_H
   2.115 +#   include <stdbool.h>
   2.116 +#endif
   2.117 +
   2.118 +
   2.119 +// endian.h
   2.120 +#ifdef HAVE_ENDIAN_H
   2.121 +#   include <endian.h>
   2.122 +#endif
   2.123 +
   2.124 +
   2.125 +// time system headers
   2.126 +#ifdef HAVE_SYS_TIME_H
   2.127 +#   include <sys/time.h>
   2.128 +#endif
   2.129 +
   2.130 +#ifdef HAVE_SYS_TIMES_H
   2.131 +#   include <sys/times.h>
   2.132 +#endif
   2.133 +
   2.134 +#ifdef HAVE_TIME_H
   2.135 +#   include <time.h>
   2.136 +#endif
   2.137 +
   2.138 +
   2.139 +// files
   2.140 +#ifdef HAVE_FCNTL_H
   2.141 +#   include <fcntl.h>
   2.142 +#endif
   2.143 +
   2.144 +#ifdef HAVE_SYS_STAT_H
   2.145 +#   include <sys/stat.h>
   2.146 +#endif
   2.147 +
   2.148 +
   2.149 +// some math
   2.150 +#ifdef HAVE_MATH_H
   2.151 +#   include <math.h>
   2.152 +#endif
   2.153 +
   2.154 +
   2.155 +// networking
   2.156 +#ifdef HAVE_NETDB_H
   2.157 +#   include <netdb.h>
   2.158 +#endif
   2.159 +
   2.160 +#ifdef HAVE_IFADDRS_H
   2.161 +#   include <ifaddrs.h>
   2.162 +#endif
   2.163 +
   2.164 +#ifdef HAVE_NETINET_IN_H
   2.165 +#   include <netinet/in.h>
   2.166 +#endif
   2.167 +
   2.168 +#ifdef HAVE_ARPA_INET_H
   2.169 +#   include <arpa/inet.h>
   2.170 +#endif
   2.171 +
   2.172 +#ifdef HAVE_SYS_SOCKET_H
   2.173 +#   include <sys/socket.h>
   2.174 +#endif
   2.175 +
   2.176 +#ifdef HAVE_SYS_UN_H
   2.177 +#   include <sys/un.h>
   2.178 +#endif
   2.179 +
   2.180 +
   2.181 +// assert.h
   2.182 +#ifdef HAVE_ASSERT_H
   2.183 +#   include <assert.h>
   2.184 +#endif
   2.185 +
   2.186 +
   2.187 +// signal.h
   2.188 +#ifdef HAVE_SIGNAL_H
   2.189 +#   include <signal.h>
   2.190 +#endif
   2.191 +
   2.192 +
   2.193 +// sys/uio.h
   2.194 +#ifdef HAVE_SYS_UIO_H
   2.195 +#   include <sys/uio.h>
   2.196 +#endif
   2.197 +
   2.198 +
   2.199 +// syslog.h
   2.200 +#ifdef HAVE_SYSLOG_H
   2.201 +#   include <syslog.h>
   2.202 +#endif
   2.203 +
   2.204 +
   2.205 +// errno.h
   2.206 +#ifdef HAVE_ERRNO_H
   2.207 +#   include <errno.h>
   2.208 +#endif
   2.209 +
   2.210 +
   2.211 +// limits.h
   2.212 +#ifdef HAVE_LIMITS_H
   2.213 +#   include <limits.h>
   2.214 +#endif
   2.215 +
   2.216 +
   2.217 +// sys/mman.h
   2.218 +#ifdef HAVE_SYS_MMAN_H
   2.219 +#   include <sys/mman.h>
   2.220 +#endif
   2.221 +
   2.222 +
   2.223 +// dirent.h
   2.224 +#ifdef HAVE_DIRENT_H
   2.225 +#   include <dirent.h>
   2.226 +#endif
   2.227 +
   2.228 +
   2.229 +// fuse.h
   2.230 +#ifdef HAVE_FUSE_H
   2.231 +#   ifndef FUSE_USE_VERSION
   2.232 +#       define FUSE_USE_VERSION 30
   2.233 +#   endif
   2.234 +#   include <fuse.h>
   2.235 +#endif
   2.236 +
   2.237 +
   2.238 +// ------------------------------------------------------------
   2.239 +// Windows
   2.240 +
   2.241 +#ifdef __WIN32__
   2.242 +#   include <windows.h>
   2.243 +#endif
   2.244 +
   2.245 +
   2.246 +// ------------------------------------------------------------
   2.247 +// Linux
   2.248 +
   2.249 +#ifdef __linux__
   2.250 +#   include <execinfo.h>
   2.251 +#endif
   2.252 +
   2.253 +
   2.254 +// ------------------------------------------------------------
   2.255 +// common macros
   2.256 +
   2.257 +#if defined(__GNUC__) || defined(__GNUCPP__)
   2.258 +#   define UNUSED   __attribute__((unused))
   2.259 +#else
   2.260 +#   define UNUSED
   2.261 +#endif
   2.262 +
   2.263 +
   2.264 +
   2.265 +#endif
   2.266 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/ait/os/bin/CMakeLists.txt	Tue Nov 12 11:31:34 2013 +0100
     3.3 @@ -0,0 +1,36 @@
     3.4 +# ------------------------------------------------------------
     3.5 +# CMakeLists.txt 
     3.6 +# 
     3.7 +# make: os/bin
     3.8 +#
     3.9 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
    3.10 +#
    3.11 +# Copyright (C) 2013 AIT Austrian Institute of Technology
    3.12 +# AIT Austrian Institute of Technology GmbH
    3.13 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
    3.14 +# http://www.ait.ac.at
    3.15 +#
    3.16 +# This program is free software; you can redistribute it and/or
    3.17 +# modify it under the terms of the GNU General Public License
    3.18 +# as published by the Free Software Foundation version 2.
    3.19 +# 
    3.20 +# This program is distributed in the hope that it will be useful,
    3.21 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.22 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.23 +# GNU General Public License for more details.
    3.24 +# 
    3.25 +# You should have received a copy of the GNU General Public License
    3.26 +# along with this program; if not, write to the Free Software
    3.27 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
    3.28 +# Boston, MA  02110-1301, USA.
    3.29 +# ------------------------------------------------------------
    3.30 +
    3.31 +
    3.32 +# ------------------------------------------------------------
    3.33 +# go through the subs
    3.34 +
    3.35 +
    3.36 +add_subdirectory(autoshadow)
    3.37 +add_subdirectory(mirrorfuse)
    3.38 +add_subdirectory(opensecurityd)
    3.39 +add_subdirectory(shadowfuse)
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/ait/os/bin/autoshadow/CMakeLists.txt	Tue Nov 12 11:31:34 2013 +0100
     4.3 @@ -0,0 +1,36 @@
     4.4 +# ------------------------------------------------------------
     4.5 +# CMakeLists.txt 
     4.6 +# 
     4.7 +# make: os/bin/autoshadow/autoshadow.py
     4.8 +#
     4.9 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
    4.10 +#
    4.11 +# Copyright (C) 2013 AIT Austrian Institute of Technology
    4.12 +# AIT Austrian Institute of Technology GmbH
    4.13 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
    4.14 +# http://www.ait.ac.at
    4.15 +#
    4.16 +# This program is free software; you can redistribute it and/or
    4.17 +# modify it under the terms of the GNU General Public License
    4.18 +# as published by the Free Software Foundation version 2.
    4.19 +# 
    4.20 +# This program is distributed in the hope that it will be useful,
    4.21 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.22 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.23 +# GNU General Public License for more details.
    4.24 +# 
    4.25 +# You should have received a copy of the GNU General Public License
    4.26 +# along with this program; if not, write to the Free Software
    4.27 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
    4.28 +# Boston, MA  02110-1301, USA.
    4.29 +# ------------------------------------------------------------
    4.30 +
    4.31 +
    4.32 +# ------------------------------------------------------------
    4.33 +# test
    4.34 +
    4.35 +# script is as-is
    4.36 +configure_file(autoshadow.py        ${CMAKE_CURRENT_BINARY_DIR}/autoshadow.py        @ONLY)
    4.37 +
    4.38 +# install script
    4.39 +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/autoshadow.py DESTINATION bin)
    4.40 \ No newline at end of file
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/ait/os/bin/autoshadow/autoshadow.py	Tue Nov 12 11:31:34 2013 +0100
     5.3 @@ -0,0 +1,152 @@
     5.4 +#!/bin/env python
     5.5 +# -*- coding: utf-8 -*-
     5.6 +
     5.7 +# ------------------------------------------------------------
     5.8 +# autoshadow.py
     5.9 +# 
    5.10 +# Listen on DBus and mount any USB stick automatically
    5.11 +# and invoke shadowfuse for it
    5.12 +#
    5.13 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
    5.14 +#
    5.15 +# Copyright (C) 2013 AIT Austrian Institute of Technology
    5.16 +# AIT Austrian Institute of Technology GmbH
    5.17 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
    5.18 +# http://www.ait.ac.at
    5.19 +#
    5.20 +# This program is free software; you can redistribute it and/or
    5.21 +# modify it under the terms of the GNU General Public License
    5.22 +# as published by the Free Software Foundation version 2.
    5.23 +# 
    5.24 +# This program is distributed in the hope that it will be useful,
    5.25 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.26 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.27 +# GNU General Public License for more details.
    5.28 +# 
    5.29 +# You should have received a copy of the GNU General Public License
    5.30 +# along with this program; if not, write to the Free Software
    5.31 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
    5.32 +# Boston, MA  02110-1301, USA.
    5.33 +# ------------------------------------------------------------
    5.34 +
    5.35 +
    5.36 +# ------------------------------------------------------------
    5.37 +# imports
    5.38 +
    5.39 +import argparse
    5.40 +import dbus
    5.41 +import dbus.glib
    5.42 +import dbus.service
    5.43 +import gobject
    5.44 +import sys
    5.45 +
    5.46 +
    5.47 +# ------------------------------------------------------------
    5.48 +# const
    5.49 +
    5.50 +
    5.51 +__version__ = "0.1"
    5.52 +
    5.53 +
    5.54 +# ------------------------------------------------------------
    5.55 +# code
    5.56 +
    5.57 +
    5.58 +class AutoShadowService(dbus.service.Object):
    5.59 +    
    5.60 +    """The AutoShadowService is the DBus object which listens on UDisk2 events and decides to mount and shadow a device.
    5.61 +    
    5.62 +    This class incorporates a DBus service (at.ac.ait.opensecurity.AutoShadow) and binds
    5.63 +    itself to the /AutoShadow object.
    5.64 +    """
    5.65 +
    5.66 +    def __init__(self):
    5.67 +        
    5.68 +        bus = dbus.SystemBus()
    5.69 +        bus_name = dbus.service.BusName('at.ac.ait.opensecurity.AutoShadow', bus)
    5.70 +        dbus.service.Object.__init__(self, bus_name, '/AutoShadow')
    5.71 +        
    5.72 +        # get the UDisk2 system object
    5.73 +        try:
    5.74 +            udisk2 = bus.get_object('org.freedesktop.UDisks2', '/org/freedesktop/UDisks2')
    5.75 +        except:
    5.76 +            sys.stderr.write('Failed to aquire DBus Service org.freedesktop.UDisks2 object /org/freedesktop/UDisks2 on system DBus.\n')
    5.77 +            sys.exit(1)
    5.78 +            
    5.79 +        # connect our signal
    5.80 +        udisk2.connect_to_signal('InterfacesAdded', self.interface_added, sender_keyword='sender')
    5.81 +    
    5.82 +    
    5.83 +    def interface_added(*args, **kwargs):
    5.84 +        
    5.85 +        """Entry point for signal for new interfaces"""
    5.86 +        
    5.87 +        # a new interface has been added
    5.88 +        object_path = args[1]
    5.89 +        interfaces_and_properties = args[2]
    5.90 +        interface_keys = interfaces_and_properties.keys()
    5.91 +        
    5.92 +        if (interface_keys[0] == 'org.freedesktop.UDisks2.Drive'):
    5.93 +            
    5.94 +            # added a new drive
    5.95 +            drive_values = interfaces_and_properties[interface_keys[0]]
    5.96 +            drive_id = str(drive_values['Id'])
    5.97 +            drive_vendor = str(drive_values['Vendor'])
    5.98 +            drive_removeable = bool(drive_values['Removable'])
    5.99 +            print('detected new drive: id=\'{0}\' vendor=\'{1}\' removeable={2}'.format(drive_id, drive_vendor, drive_removeable))
   5.100 +        
   5.101 +        if (interface_keys[0] == 'org.freedesktop.UDisks2.Block'):
   5.102 +            
   5.103 +            # added a new device - filesystem?
   5.104 +            if ('org.freedesktop.UDisks2.Filesystem' in interface_keys):
   5.105 +                
   5.106 +                # pick values of the device
   5.107 +                device_values = interfaces_and_properties[interface_keys[0]]
   5.108 +                device_path = bytearray(device_values['Device'][0:-1]).decode('latin-1')
   5.109 +                print('detected new device: path=\'{0}\''.format(device_path))
   5.110 +                enforce_mount('/org/freedesktop/UDisks2/block_devices/' + device_path.split('/')[-1])
   5.111 +            
   5.112 +
   5.113 +    def listen(self):
   5.114 +        """Start listening on DBus"""
   5.115 +        self.loop = gobject.MainLoop()
   5.116 +        self.loop.run()
   5.117 +
   5.118 +
   5.119 +    @dbus.service.method('at.ac.ait.opensecurity.AutoShadow')
   5.120 +    def Quit(self):
   5.121 +        """Terminate this service"""
   5.122 +        self.loop.quit()
   5.123 +
   5.124 +
   5.125 +    @dbus.service.method('at.ac.ait.opensecurity.AutoShadow', out_signature='s')
   5.126 +    def Version(self):
   5.127 +        """Give a version string"""
   5.128 +        return __version__
   5.129 +
   5.130 +
   5.131 +def enforce_mount(udisk_object):
   5.132 +    
   5.133 +    """This function does the real mounting of drives. 
   5.134 +    It also enforces the MirrorFuse on these mounts.
   5.135 +    """
   5.136 +    
   5.137 +    print("ENFORCING mount of " + udisk_object)
   5.138 +
   5.139 +
   5.140 +def main():             
   5.141 +            
   5.142 +    # parse command line
   5.143 +    parser = argparse.ArgumentParser(description = 'Automount USB storage devices and invoke shadowfuse for it.')
   5.144 +    args = parser.parse_args()
   5.145 +    
   5.146 +    # setup DBus event loop
   5.147 +    autoshadow_service = AutoShadowService()
   5.148 +    autoshadow_service.listen()    
   5.149 +    
   5.150 +
   5.151 +# start
   5.152 +if __name__ == "__main__":
   5.153 +    main()
   5.154 +
   5.155 + 
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/ait/os/bin/mirrorfuse/CMakeLists.txt	Tue Nov 12 11:31:34 2013 +0100
     6.3 @@ -0,0 +1,36 @@
     6.4 +# ------------------------------------------------------------
     6.5 +# CMakeLists.txt 
     6.6 +# 
     6.7 +# make: os/bin/mirrorfuse/mirrorfuse.py
     6.8 +#
     6.9 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
    6.10 +#
    6.11 +# Copyright (C) 2013 AIT Austrian Institute of Technology
    6.12 +# AIT Austrian Institute of Technology GmbH
    6.13 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
    6.14 +# http://www.ait.ac.at
    6.15 +#
    6.16 +# This program is free software; you can redistribute it and/or
    6.17 +# modify it under the terms of the GNU General Public License
    6.18 +# as published by the Free Software Foundation version 2.
    6.19 +# 
    6.20 +# This program is distributed in the hope that it will be useful,
    6.21 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.22 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6.23 +# GNU General Public License for more details.
    6.24 +# 
    6.25 +# You should have received a copy of the GNU General Public License
    6.26 +# along with this program; if not, write to the Free Software
    6.27 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
    6.28 +# Boston, MA  02110-1301, USA.
    6.29 +# ------------------------------------------------------------
    6.30 +
    6.31 +
    6.32 +# ------------------------------------------------------------
    6.33 +# test
    6.34 +
    6.35 +# script is as-is
    6.36 +configure_file(mirrorfuse.py        ${CMAKE_CURRENT_BINARY_DIR}/mirrorfuse.py    @ONLY)
    6.37 +
    6.38 +# install script
    6.39 +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/mirrorfuse.py DESTINATION bin)
    6.40 \ No newline at end of file
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/ait/os/bin/mirrorfuse/mirrorfuse.py	Tue Nov 12 11:31:34 2013 +0100
     7.3 @@ -0,0 +1,270 @@
     7.4 +#!/bin/env python
     7.5 +# -*- coding: utf-8 -*-
     7.6 +
     7.7 +# ------------------------------------------------------------
     7.8 +# mirrorfuse
     7.9 +# 
    7.10 +# create a mirror filesystem folder as a new filesystem to mount
    7.11 +#
    7.12 +# This is directly based on xmp.py of the 
    7.13 +# dev-python/fuse-python example
    7.14 +#
    7.15 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
    7.16 +#
    7.17 +# Copyright (C) 2013 AIT Austrian Institute of Technology
    7.18 +# AIT Austrian Institute of Technology GmbH
    7.19 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
    7.20 +# http://www.ait.ac.at
    7.21 +#
    7.22 +# This program is free software; you can redistribute it and/or
    7.23 +# modify it under the terms of the GNU General Public License
    7.24 +# as published by the Free Software Foundation version 2.
    7.25 +# 
    7.26 +# This program is distributed in the hope that it will be useful,
    7.27 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.28 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7.29 +# GNU General Public License for more details.
    7.30 +# 
    7.31 +# You should have received a copy of the GNU General Public License
    7.32 +# along with this program; if not, write to the Free Software
    7.33 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
    7.34 +# Boston, MA  02110-1301, USA.
    7.35 +# ------------------------------------------------------------
    7.36 +
    7.37 +
    7.38 +# ------------------------------------------------------------
    7.39 +# imports
    7.40 +
    7.41 +import errno
    7.42 +import fcntl
    7.43 +import fuse
    7.44 +import os
    7.45 +import sys
    7.46 +
    7.47 +from fuse import Fuse
    7.48 +
    7.49 +# ------------------------------------------------------------
    7.50 +# const
    7.51 +
    7.52 +
    7.53 +__version__ = "0.1"
    7.54 +
    7.55 +
    7.56 +# ------------------------------------------------------------
    7.57 +# code
    7.58 +
    7.59 +
    7.60 +class MirrorFuse(Fuse):
    7.61 +    
    7.62 +    """This is the Mirror FUSE in python.
    7.63 +    
    7.64 +    This is to represnt a file hierarchy elsewhere (and intercept each file system call)
    7.65 +    """
    7.66 +
    7.67 +    def __init__(self, *args, **kw):
    7.68 +        fuse.fuse_python_api = (0, 2)
    7.69 +        super(MirrorFuse, self).__init__(*args, **kw)
    7.70 +        self.root = '/'
    7.71 +        self.os_server_url = ''
    7.72 +        
    7.73 +    def getattr(self, path):
    7.74 +        return os.lstat("." + path)
    7.75 +    
    7.76 +
    7.77 +    #
    7.78 +    # links are not allowed for a mirrored FS
    7.79 +    #
    7.80 +    def readlink(self, path):
    7.81 +        eturn -errno.EACCES
    7.82 +    
    7.83 +
    7.84 +    def readdir(self, path, offset):
    7.85 +        for e in os.listdir("." + path):
    7.86 +            yield fuse.Direntry(e)
    7.87 +            
    7.88 +
    7.89 +    def unlink(self, path):
    7.90 +        sys.stdout.write("===\nInsert Hook here! Deleting file %s\n===\n" % path)
    7.91 +        os.unlink("." + path)
    7.92 +        
    7.93 +
    7.94 +    def rmdir(self, path):
    7.95 +        sys.stdout.write("===\nInsert Hook here! Deleting folder %s\n===\n" % path)
    7.96 +        os.rmdir("." + path)
    7.97 +        
    7.98 +
    7.99 +    #
   7.100 +    # links are not allowed for a mirrored FS
   7.101 +    #
   7.102 +    def symlink(self, path, path1):
   7.103 +        eturn -errno.EACCES
   7.104 +        
   7.105 +
   7.106 +    def rename(self, path, path1):
   7.107 +        sys.stdout.write("===\nInsert Hook here! Moving file %s --> %s\n===\n" % path % path1)
   7.108 +        os.rename("." + path, "." + path1)
   7.109 +        
   7.110 +
   7.111 +    #
   7.112 +    # links are not allowed for a mirrored FS
   7.113 +    #
   7.114 +    def link(self, path, path1):
   7.115 +        return -errno.EACCES
   7.116 +        
   7.117 +
   7.118 +    #
   7.119 +    # changing access mode is not allowed in mirrored FS
   7.120 +    #
   7.121 +    def chmod(self, path, mode):
   7.122 +        return -errno.EACCES
   7.123 +        
   7.124 +
   7.125 +    #
   7.126 +    # changing ownership is not allowed in mirrored FS
   7.127 +    #
   7.128 +    def chown(self, path, user, group):
   7.129 +        return -errno.EACCES
   7.130 +        
   7.131 +
   7.132 +    def truncate(self, path, len):
   7.133 +        f = open("." + path, "a")
   7.134 +        f.truncate(len)
   7.135 +        f.close()
   7.136 +        
   7.137 +
   7.138 +    def mknod(self, path, mode, dev):
   7.139 +        sys.stdout.write("===\nInsert Hook here! Creating file %s\n===\n" % path)
   7.140 +        os.mknod("." + path, mode, dev)
   7.141 +        
   7.142 +
   7.143 +    def mkdir(self, path, mode):
   7.144 +        sys.stdout.write("===\nInsert Hook here! Creating folder %s\n===\n" % path)
   7.145 +        os.mkdir("." + path, mode)
   7.146 +        
   7.147 +
   7.148 +    def utime(self, path, times):
   7.149 +        os.utime("." + path, times)
   7.150 +    
   7.151 +
   7.152 +    def access(self, path, mode):
   7.153 +        if not os.access("." + path, mode):
   7.154 +            return -errno.EACCES
   7.155 +
   7.156 +
   7.157 +    def statfs(self):
   7.158 +        return os.statvfs(".")
   7.159 +
   7.160 +
   7.161 +    def fsinit(self):
   7.162 +        os.chdir(self.root)
   7.163 +
   7.164 +
   7.165 +    def main(self, *a, **kw):
   7.166 +        self.file_class = MirrorFuseFile
   7.167 +        return Fuse.main(self, *a, **kw)
   7.168 +
   7.169 +
   7.170 +class MirrorFuseFile(object):
   7.171 +    
   7.172 +    """This is a single "File" in the Mirror FUSE"""
   7.173 +
   7.174 +    def __init__(self, path, flags, *mode):
   7.175 +        sys.stdout.write("===\nInsert Hook here! Opening file %s\n===\n" % path)
   7.176 +        self.file = os.fdopen(os.open("." + path, flags, *mode), flag2mode(flags))
   7.177 +        self.fd = self.file.fileno()
   7.178 +        
   7.179 +
   7.180 +    def read(self, length, offset):
   7.181 +        self.file.seek(offset)
   7.182 +        return self.file.read(length)
   7.183 +    
   7.184 +
   7.185 +    def write(self, buf, offset):
   7.186 +        self.file.seek(offset)
   7.187 +        self.file.write(buf)
   7.188 +        return len(buf)
   7.189 +    
   7.190 +
   7.191 +    def release(self, flags):
   7.192 +        self.file.close()
   7.193 +        
   7.194 +
   7.195 +    def _fflush(self):
   7.196 +        if 'w' in self.file.mode or 'a' in self.file.mode:
   7.197 +            self.file.flush()
   7.198 +
   7.199 +    def fsync(self, isfsyncfile):
   7.200 +        self._fflush()
   7.201 +        if isfsyncfile and hasattr(os, 'fdatasync'):
   7.202 +            os.fdatasync(self.fd)
   7.203 +        else:
   7.204 +            os.fsync(self.fd)
   7.205 +            
   7.206 +
   7.207 +    def flush(self):
   7.208 +        self._fflush()
   7.209 +        os.close(os.dup(self.fd))
   7.210 +        
   7.211 +
   7.212 +    def fgetattr(self):
   7.213 +        return os.fstat(self.fd)
   7.214 +    
   7.215 +
   7.216 +    def ftruncate(self, len):
   7.217 +        self.file.truncate(len)
   7.218 +        
   7.219 +
   7.220 +    def lock(self, cmd, owner, **kw):
   7.221 +        op = {fcntl.F_UNLCK : fcntl.LOCK_UN, fcntl.F_RDLCK : fcntl.LOCK_SH, fcntl.F_WRLCK : fcntl.LOCK_EX}[kw['l_type']]
   7.222 +        if cmd == fcntl.F_GETLK:
   7.223 +            return -EOPNOTSUPP
   7.224 +        elif cmd == fcntl.F_SETLK:
   7.225 +            if op != fcntl.LOCK_UN:
   7.226 +                op |= fcntl.LOCK_NB
   7.227 +        elif cmd == fcntl.F_SETLKW:
   7.228 +            pass
   7.229 +        else:
   7.230 +            return -errno.EINVAL
   7.231 +
   7.232 +        fcntl.lockf(self.fd, op, kw['l_start'], kw['l_len'])
   7.233 +
   7.234 +
   7.235 +def flag2mode(flags):
   7.236 +    
   7.237 +    """Turn os flags into mode chars"""
   7.238 +    
   7.239 +    md = {os.O_RDONLY: 'r', os.O_WRONLY: 'w', os.O_RDWR: 'w+'}
   7.240 +    m = md[flags & (os.O_RDONLY | os.O_WRONLY | os.O_RDWR)]
   7.241 +    if flags | os.O_APPEND:
   7.242 +        m = m.replace('w', 'a', 1)
   7.243 +    return m
   7.244 +
   7.245 +
   7.246 +def main():             
   7.247 +            
   7.248 +    usage = """
   7.249 +mirror the a file tree from some point on.
   7.250 +
   7.251 +""" + Fuse.fusage
   7.252 +
   7.253 +    # launch the Fuse server
   7.254 +    server = MirrorFuse(version = "%prog " + __version__, usage = usage, dash_s_do = 'setsingle')
   7.255 +    server.parser.add_option(mountopt = "root", metavar = "PATH", default='/',  help="mirror filesystem from under PATH [default: %default]")
   7.256 +    server.parser.add_option(mountopt = "os_server_url", metavar = "URL", default='http://localhost:8080',  help="URL to OpenSecurity Server [default: %default]")
   7.257 +    server.parse(values=server, errex=1)
   7.258 +
   7.259 +    try:
   7.260 +        if server.fuse_args.mount_expected():
   7.261 +            os.chdir(server.root)
   7.262 +    except OSError:
   7.263 +        print >> sys.stderr, "can't enter root of underlying filesystem"
   7.264 +        sys.exit(1)
   7.265 +
   7.266 +    server.main()
   7.267 +    
   7.268 +
   7.269 +# start
   7.270 +if __name__ == "__main__":
   7.271 +    main()
   7.272 +
   7.273 + 
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/ait/os/bin/opensecurityd/CMakeLists.txt	Tue Nov 12 11:31:34 2013 +0100
     8.3 @@ -0,0 +1,53 @@
     8.4 +# ------------------------------------------------------------
     8.5 +# CMakeLists.txt 
     8.6 +# 
     8.7 +# make: os/bin/opensecurity-server/opensecurity-server.py
     8.8 +#
     8.9 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
    8.10 +#
    8.11 +# Copyright (C) 2013 AIT Austrian Institute of Technology
    8.12 +# AIT Austrian Institute of Technology GmbH
    8.13 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
    8.14 +# http://www.ait.ac.at
    8.15 +#
    8.16 +# This program is free software; you can redistribute it and/or
    8.17 +# modify it under the terms of the GNU General Public License
    8.18 +# as published by the Free Software Foundation version 2.
    8.19 +# 
    8.20 +# This program is distributed in the hope that it will be useful,
    8.21 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.22 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8.23 +# GNU General Public License for more details.
    8.24 +# 
    8.25 +# You should have received a copy of the GNU General Public License
    8.26 +# along with this program; if not, write to the Free Software
    8.27 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
    8.28 +# Boston, MA  02110-1301, USA.
    8.29 +# ------------------------------------------------------------
    8.30 +
    8.31 +
    8.32 +# ------------------------------------------------------------
    8.33 +# test
    8.34 +
    8.35 +# script is as-is
    8.36 +configure_file(about.py                 ${CMAKE_CURRENT_BINARY_DIR}/about.py                    @ONLY)
    8.37 +configure_file(credentials.py           ${CMAKE_CURRENT_BINARY_DIR}/credentials.py              @ONLY)
    8.38 +configure_file(environment.py           ${CMAKE_CURRENT_BINARY_DIR}/environment.py              @ONLY)
    8.39 +configure_file(launch.py                ${CMAKE_CURRENT_BINARY_DIR}/launch.py                   @ONLY)
    8.40 +configure_file(opensecurity-dialog.py   ${CMAKE_CURRENT_BINARY_DIR}/opensecurity-dialog.py      @ONLY)
    8.41 +configure_file(opensecurity-tray.py     ${CMAKE_CURRENT_BINARY_DIR}/opensecurity-tray.py        @ONLY)
    8.42 +configure_file(opensecurityd.py         ${CMAKE_CURRENT_BINARY_DIR}/opensecurityd.py            @ONLY)
    8.43 +configure_file(password.py              ${CMAKE_CURRENT_BINARY_DIR}/password.py                 @ONLY)
    8.44 +
    8.45 +# copy share/opensecurity stuff for convenient testing
    8.46 +file(COPY ${CMAKE_SOURCE_DIR}/share/opensecurity DESTINATION ${CMAKE_BINARY_DIR}/bin/share USE_SOURCE_PERMISSIONS)
    8.47 +
    8.48 +# install script
    8.49 +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/about.py                   DESTINATION bin)
    8.50 +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/credentials.py             DESTINATION bin)
    8.51 +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/environment.py             DESTINATION bin)
    8.52 +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/launch.py                  DESTINATION bin)
    8.53 +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/opensecurity-dialog.py     DESTINATION bin)
    8.54 +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/opensecurity-tray.py       DESTINATION bin)
    8.55 +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/password.py                DESTINATION bin)
    8.56 +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/opensecurityd.py           DESTINATION bin)
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/ait/os/bin/opensecurityd/about.py	Tue Nov 12 11:31:34 2013 +0100
     9.3 @@ -0,0 +1,124 @@
     9.4 +#!/bin/env python
     9.5 +# -*- coding: utf-8 -*-
     9.6 +
     9.7 +# ------------------------------------------------------------
     9.8 +# about-dialog
     9.9 +# 
    9.10 +# tell the user about the project
    9.11 +#
    9.12 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
    9.13 +#
    9.14 +# Copyright (C) 2013 AIT Austrian Institute of Technology
    9.15 +# AIT Austrian Institute of Technology GmbH
    9.16 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
    9.17 +# http://www.ait.ac.at
    9.18 +#
    9.19 +# This program is free software; you can redistribute it and/or
    9.20 +# modify it under the terms of the GNU General Public License
    9.21 +# as published by the Free Software Foundation version 2.
    9.22 +# 
    9.23 +# This program is distributed in the hope that it will be useful,
    9.24 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.25 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9.26 +# GNU General Public License for more details.
    9.27 +# 
    9.28 +# You should have received a copy of the GNU General Public License
    9.29 +# along with this program; if not, write to the Free Software
    9.30 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
    9.31 +# Boston, MA  02110-1301, USA.
    9.32 +# ------------------------------------------------------------
    9.33 +
    9.34 +
    9.35 +# ------------------------------------------------------------
    9.36 +# imports
    9.37 +
    9.38 +from PyQt4 import QtCore
    9.39 +from PyQt4 import QtGui
    9.40 +
    9.41 +# local
    9.42 +from environment import Environment
    9.43 +
    9.44 +# ------------------------------------------------------------
    9.45 +# vars
    9.46 +
    9.47 +
    9.48 +ABOUT_TEXT = """
    9.49 +<html>
    9.50 +<body bgcolor="#FFFFFF">
    9.51 +
    9.52 +<div align="center">
    9.53 +<p/>
    9.54 +<img src="image:ait_logo_no_claim.png"/>
    9.55 +<p/>
    9.56 +<h1>OpenSecurity</h1>
    9.57 +<p/>
    9.58 +</div>
    9.59 +<p/>
    9.60 +Blah ...<br/>
    9.61 +
    9.62 +<p>
    9.63 +Copyright (C) 2013, AIT Austrian Institute of Technology<br/>
    9.64 +AIT Austrian Institute of Technology GmbH<br/>
    9.65 +Donau-City-Strasse 1 | 1220 Vienna | Austria<br/>
    9.66 +<a href="http://www.ait.ac.at">http://www.ait.ac.at</a>
    9.67 +</p>
    9.68 +</div>
    9.69 +
    9.70 +</body>
    9.71 +</html>
    9.72 +""";
    9.73 +
    9.74 +
    9.75 +# ------------------------------------------------------------
    9.76 +# code
    9.77 +
    9.78 +
    9.79 +class About(QtGui.QDialog):
    9.80 +    
    9.81 +    """Show some about stuff."""
    9.82 +    
    9.83 +    def __init__(self, parent = None, flags = QtCore.Qt.WindowFlags(0)):
    9.84 +        
    9.85 +        # super call and widget init
    9.86 +        super(About, self).__init__(parent, flags)
    9.87 +        
    9.88 +        # setup image search path
    9.89 +        QtCore.QDir.setSearchPaths("image", QtCore.QStringList(Environment('opensecurity').image_path));
    9.90 +        
    9.91 +        self.setWindowTitle('About OpenSecuirty ...')
    9.92 +        self.setup_ui()
    9.93 +        
    9.94 +
    9.95 +    def setup_ui(self):
    9.96 +        
    9.97 +        """Create the widgets."""
    9.98 +        
    9.99 +        lyMain = QtGui.QVBoxLayout(self)
   9.100 +        lyMain.setContentsMargins(8, 8, 8, 8)
   9.101 +        
   9.102 +        lbAbout = QtGui.QLabel()
   9.103 +        lbAbout.setStyleSheet("QWidget { background: white; color: black; };")
   9.104 +        lbAbout.setText(ABOUT_TEXT)
   9.105 +        lbAbout.setContentsMargins(12, 12, 12, 12)
   9.106 +        
   9.107 +        scAbout = QtGui.QScrollArea()
   9.108 +        scAbout.setWidget(lbAbout)
   9.109 +        scAbout.viewport().setStyleSheet("QWidget { background: white; color: black; };")
   9.110 +        lyMain.addWidget(scAbout)
   9.111 +        
   9.112 +        # buttons
   9.113 +        lyButton = QtGui.QHBoxLayout()
   9.114 +        lyMain.addLayout(lyButton)
   9.115 +        
   9.116 +        lyButton.addStretch(1)
   9.117 +        btnOk = QtGui.QPushButton('&Ok', self)
   9.118 +        btnOk.setMinimumWidth(100)
   9.119 +        lyButton.addWidget(btnOk)
   9.120 +        
   9.121 +        # connectors
   9.122 +        btnOk.clicked.connect(self.accept)
   9.123 +        
   9.124 +        # reduce to the max
   9.125 +        self.setMinimumSize(400, 200)
   9.126 +        self.resize(lyMain.minimumSize())
   9.127 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/ait/os/bin/opensecurityd/credentials.py	Tue Nov 12 11:31:34 2013 +0100
    10.3 @@ -0,0 +1,160 @@
    10.4 +#!/bin/env python
    10.5 +# -*- coding: utf-8 -*-
    10.6 +
    10.7 +# ------------------------------------------------------------
    10.8 +# credentials-dialog
    10.9 +# 
   10.10 +# ask the user credentials
   10.11 +#
   10.12 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   10.13 +#
   10.14 +# Copyright (C) 2013 AIT Austrian Institute of Technology
   10.15 +# AIT Austrian Institute of Technology GmbH
   10.16 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
   10.17 +# http://www.ait.ac.at
   10.18 +#
   10.19 +# This program is free software; you can redistribute it and/or
   10.20 +# modify it under the terms of the GNU General Public License
   10.21 +# as published by the Free Software Foundation version 2.
   10.22 +# 
   10.23 +# This program is distributed in the hope that it will be useful,
   10.24 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.25 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   10.26 +# GNU General Public License for more details.
   10.27 +# 
   10.28 +# You should have received a copy of the GNU General Public License
   10.29 +# along with this program; if not, write to the Free Software
   10.30 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
   10.31 +# Boston, MA  02110-1301, USA.
   10.32 +# ------------------------------------------------------------
   10.33 +
   10.34 +
   10.35 +# ------------------------------------------------------------
   10.36 +# imports
   10.37 +
   10.38 +import sys
   10.39 +
   10.40 +from PyQt4 import QtCore
   10.41 +from PyQt4 import QtGui
   10.42 +
   10.43 +# local
   10.44 +from about import About
   10.45 +
   10.46 +# ------------------------------------------------------------
   10.47 +# code
   10.48 +
   10.49 +
   10.50 +class Credentials(QtGui.QDialog):
   10.51 +    
   10.52 +    """Ask the user for credentials."""
   10.53 +    
   10.54 +    def __init__(self, text, parent = None, flags = QtCore.Qt.WindowFlags(0)):
   10.55 +        
   10.56 +        super(Credentials, self).__init__(parent, flags)
   10.57 +        self.setWindowTitle('OpenSecuirty Credentials Request')
   10.58 +        self.setup_ui()
   10.59 +        
   10.60 +        # positionate ourself central
   10.61 +        screen = QtGui.QDesktopWidget().screenGeometry()
   10.62 +        self.resize(self.geometry().width() * 1.25, self.geometry().height())
   10.63 +        size = self.geometry()
   10.64 +        self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2)
   10.65 +        
   10.66 +        # fix up text
   10.67 +        self.lbText.setText(text)
   10.68 +        
   10.69 +
   10.70 +    def clicked_about(self):
   10.71 +        """clicked the about button"""
   10.72 +        dlgAbout = About()
   10.73 +        dlgAbout.exec_()
   10.74 +    
   10.75 +
   10.76 +    def clicked_cancel(self):
   10.77 +        """clicked the cancel button"""
   10.78 +        self.reject()
   10.79 +    
   10.80 +
   10.81 +    def clicked_ok(self):
   10.82 +        """clicked the ok button"""
   10.83 +        sys.stdout.write('{ ')
   10.84 +        sys.stdout.write('\'user\': \'')
   10.85 +        sys.stdout.write(self.edUser.text())
   10.86 +        sys.stdout.write('\', ')
   10.87 +        sys.stdout.write('\'password\': \'')
   10.88 +        sys.stdout.write(self.edPassword.text())
   10.89 +        sys.stdout.write('\' ')
   10.90 +        sys.stdout.write('}\n')
   10.91 +        self.accept()
   10.92 +    
   10.93 +
   10.94 +    def setup_ui(self):
   10.95 +        
   10.96 +        """Create the widgets."""
   10.97 +        
   10.98 +        lyMain = QtGui.QVBoxLayout(self)
   10.99 +        lyMain.setContentsMargins(8, 8, 8, 8)
  10.100 +        
  10.101 +        # content area: left pixmap, right text
  10.102 +        lyContent = QtGui.QHBoxLayout()
  10.103 +        lyMain.addLayout(lyContent)
  10.104 +        
  10.105 +        # pixmap
  10.106 +        lbPix = QtGui.QLabel()
  10.107 +        lbPix.setPixmap(QtGui.QPixmapCache.find('opensecurity_icon_64'))
  10.108 +        lyContent.addWidget(lbPix, 0, QtCore.Qt.Alignment(QtCore.Qt.AlignTop + QtCore.Qt.AlignHCenter))
  10.109 +        lyContent.addSpacing(16)
  10.110 +        
  10.111 +        # text ...
  10.112 +        lyText = QtGui.QGridLayout()
  10.113 +        lyContent.addLayout(lyText)
  10.114 +        self.lbText = QtGui.QLabel()
  10.115 +        lyText.addWidget(self.lbText, 0, 0, 1, 2)
  10.116 +        
  10.117 +        lbUser = QtGui.QLabel('&User:')
  10.118 +        lyText.addWidget(lbUser, 1, 0)
  10.119 +        self.edUser = QtGui.QLineEdit()
  10.120 +        lyText.addWidget(self.edUser, 1, 1)
  10.121 +        lbUser.setBuddy(self.edUser)
  10.122 +        
  10.123 +        lbPassword = QtGui.QLabel('&Password:')
  10.124 +        lyText.addWidget(lbPassword, 2, 0)
  10.125 +        self.edPassword = QtGui.QLineEdit()
  10.126 +        self.edPassword.setEchoMode(QtGui.QLineEdit.Password)
  10.127 +        lyText.addWidget(self.edPassword, 2, 1)
  10.128 +        lbPassword.setBuddy(self.edPassword)
  10.129 +        
  10.130 +        lyText.addWidget(QtGui.QWidget(), 3, 0, 1, 2)
  10.131 +        lyText.setColumnStretch(1, 1)
  10.132 +        lyText.setRowStretch(3, 1)
  10.133 +        
  10.134 +        lyMain.addStretch(1)
  10.135 +        
  10.136 +        # buttons
  10.137 +        lyButton = QtGui.QHBoxLayout()
  10.138 +        lyMain.addLayout(lyButton)
  10.139 +        
  10.140 +        lyButton.addStretch(1)
  10.141 +        btnOk = QtGui.QPushButton('&Ok', self)
  10.142 +        btnOk.setDefault(True)
  10.143 +        btnOk.setMinimumWidth(100)
  10.144 +        lyButton.addWidget(btnOk)
  10.145 +        btnCancel = QtGui.QPushButton('&Cancel', self)
  10.146 +        btnCancel.setMinimumWidth(100)
  10.147 +        lyButton.addWidget(btnCancel)
  10.148 +        btnAbout = QtGui.QPushButton('&About', self)
  10.149 +        btnAbout.setMinimumWidth(100)
  10.150 +        lyButton.addWidget(btnAbout)
  10.151 +        
  10.152 +        button_width = max(btnOk.width(), btnCancel.width(), btnAbout.width())
  10.153 +        btnOk.setMinimumWidth(button_width)
  10.154 +        btnCancel.setMinimumWidth(button_width)
  10.155 +        btnAbout.setMinimumWidth(button_width)
  10.156 +        
  10.157 +        # reduce to the max
  10.158 +        self.resize(lyMain.minimumSize())
  10.159 +        
  10.160 +        # connectors
  10.161 +        btnOk.clicked.connect(self.clicked_ok)
  10.162 +        btnCancel.clicked.connect(self.clicked_cancel)
  10.163 +        btnAbout.clicked.connect(self.clicked_about)
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/ait/os/bin/opensecurityd/environment.py	Tue Nov 12 11:31:34 2013 +0100
    11.3 @@ -0,0 +1,97 @@
    11.4 +#!/bin/env python
    11.5 +# -*- coding: utf-8 -*-
    11.6 +
    11.7 +# ------------------------------------------------------------
    11.8 +# environment.py
    11.9 +# 
   11.10 +# pick some current environment infos
   11.11 +#
   11.12 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   11.13 +#
   11.14 +# Copyright (C) 2013 AIT Austrian Institute of Technology
   11.15 +# AIT Austrian Institute of Technology GmbH
   11.16 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
   11.17 +# http://www.ait.ac.at
   11.18 +#
   11.19 +# This program is free software; you can redistribute it and/or
   11.20 +# modify it under the terms of the GNU General Public License
   11.21 +# as published by the Free Software Foundation version 2.
   11.22 +# 
   11.23 +# This program is distributed in the hope that it will be useful,
   11.24 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.25 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11.26 +# GNU General Public License for more details.
   11.27 +# 
   11.28 +# You should have received a copy of the GNU General Public License
   11.29 +# along with this program; if not, write to the Free Software
   11.30 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
   11.31 +# Boston, MA  02110-1301, USA.
   11.32 +# ------------------------------------------------------------
   11.33 +
   11.34 +
   11.35 +# ------------------------------------------------------------
   11.36 +# imports
   11.37 +
   11.38 +import os
   11.39 +import os.path
   11.40 +import sys
   11.41 +
   11.42 +
   11.43 +# ------------------------------------------------------------
   11.44 +# code
   11.45 +
   11.46 +
   11.47 +class Environment(object):
   11.48 +    
   11.49 +    """Hold some nifty environment stuff in a dedicated class."""
   11.50 +    
   11.51 +    def __init__(self, application = None):
   11.52 +        
   11.53 +        # if we ain't got a path to start from, all is valid/lost
   11.54 +        if len(sys.path[0]) == 0:
   11.55 +            self.prefix_path = ''
   11.56 +            self.data_path = ''
   11.57 +            self.image_path = ''
   11.58 +            return
   11.59 +        
   11.60 +        # the prefix path
   11.61 +        #
   11.62 +        # - on Linux: this is ../../ to the current executable
   11.63 +        #   e.g. "/usr/bin/myprogram" --> "/usr"
   11.64 +        #
   11.65 +        # - on Windows: this is the installation folder
   11.66 +        #   e.g. "C:/Program Files/MyProgram/bin/myprogam" --> "C:/Program Files/MyProgram"
   11.67 +        #
   11.68 +        if sys.platform == 'linux2':
   11.69 +            self.prefix_path = os.path.split(sys.path[0])[0]
   11.70 +        elif sys.platform == 'win32':
   11.71 +            self.prefix_path = os.path.split(sys.path[0])[0]
   11.72 +            
   11.73 +        # the data path where all data files are stored
   11.74 +        if sys.platform == 'linux2':
   11.75 +            if not application is None:
   11.76 +                self.data_path = os.path.join(self.prefix_path, os.path.join('share', application))
   11.77 +            else:
   11.78 +                self.data_path = os.path.join(self.prefix_path, 'share')
   11.79 +        elif sys.platform == 'win32':
   11.80 +            self.data_path = self.prefix_path
   11.81 +
   11.82 +        # the image path 
   11.83 +        if sys.platform == 'linux2':
   11.84 +            self.image_path = os.path.join(self.data_path, 'gfx')
   11.85 +        elif sys.platform == 'win32':
   11.86 +            self.image_path = os.path.join(self.data_path, 'gfx')
   11.87 +
   11.88 +
   11.89 +# test the module
   11.90 +def test():
   11.91 +    """Module test call."""
   11.92 +    
   11.93 +    e = Environment("opensecurity")
   11.94 +    print("prefix_path: {0}".format(e.prefix_path))
   11.95 +    print("  data_path: {0}".format(e.data_path))
   11.96 +    print(" image_path: {0}".format(e.image_path))
   11.97 +
   11.98 +# standalone calls are module tests
   11.99 +if __name__ == '__main__':
  11.100 +    test()
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/ait/os/bin/opensecurityd/launch.py	Tue Nov 12 11:31:34 2013 +0100
    12.3 @@ -0,0 +1,201 @@
    12.4 +#!/bin/env python
    12.5 +# -*- coding: utf-8 -*-
    12.6 +
    12.7 +# ------------------------------------------------------------
    12.8 +# opensecurity-launcher
    12.9 +# 
   12.10 +# launches an application inside a VM
   12.11 +#
   12.12 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   12.13 +#
   12.14 +# Copyright (C) 2013 AIT Austrian Institute of Technology
   12.15 +# AIT Austrian Institute of Technology GmbH
   12.16 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
   12.17 +# http://www.ait.ac.at
   12.18 +#
   12.19 +# This program is free software; you can redistribute it and/or
   12.20 +# modify it under the terms of the GNU General Public License
   12.21 +# as published by the Free Software Foundation version 2.
   12.22 +# 
   12.23 +# This program is distributed in the hope that it will be useful,
   12.24 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.25 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12.26 +# GNU General Public License for more details.
   12.27 +# 
   12.28 +# You should have received a copy of the GNU General Public License
   12.29 +# along with this program; if not, write to the Free Software
   12.30 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
   12.31 +# Boston, MA  02110-1301, USA.
   12.32 +# ------------------------------------------------------------
   12.33 +
   12.34 +
   12.35 +# ------------------------------------------------------------
   12.36 +# imports
   12.37 +
   12.38 +import argparse
   12.39 +import os
   12.40 +import subprocess
   12.41 +import sys
   12.42 +import urllib
   12.43 +
   12.44 +from PyQt4 import QtCore
   12.45 +from PyQt4 import QtGui
   12.46 +
   12.47 +# local
   12.48 +from about import About
   12.49 +from environment import Environment
   12.50 +
   12.51 +
   12.52 +# ------------------------------------------------------------
   12.53 +# code
   12.54 +
   12.55 +
   12.56 +class Chooser(QtGui.QDialog):
   12.57 +    
   12.58 +    """Ask the user what to launch."""
   12.59 +    
   12.60 +    def __init__(self, parent = None, flags = QtCore.Qt.WindowFlags(0)):
   12.61 +        
   12.62 +        super(Chooser, self).__init__(parent, flags)
   12.63 +        self.setWindowTitle('OpenSecuirty Launch Application')
   12.64 +        self.setup_ui()
   12.65 +        
   12.66 +        # positionate ourself central
   12.67 +        screen = QtGui.QDesktopWidget().screenGeometry()
   12.68 +        self.resize(self.geometry().width() * 1.25, self.geometry().height())
   12.69 +        size = self.geometry()
   12.70 +        self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2)
   12.71 +        
   12.72 +
   12.73 +    def clicked_about(self):
   12.74 +        """clicked the about button"""
   12.75 +        dlgAbout = About()
   12.76 +        dlgAbout.exec_()
   12.77 +    
   12.78 +
   12.79 +    def clicked_cancel(self):
   12.80 +        """clicked the cancel button"""
   12.81 +        self.reject()
   12.82 +    
   12.83 +
   12.84 +    def clicked_ok(self):
   12.85 +        """clicked the ok button"""
   12.86 +        self.accept()
   12.87 +    
   12.88 +
   12.89 +    def setup_ui(self):
   12.90 +        
   12.91 +        """Create the widgets."""
   12.92 +        
   12.93 +        lyMain = QtGui.QVBoxLayout(self)
   12.94 +        lyMain.setContentsMargins(8, 8, 8, 8)
   12.95 +        
   12.96 +        # content area: left pixmap, right text
   12.97 +        lyContent = QtGui.QHBoxLayout()
   12.98 +        lyMain.addLayout(lyContent)
   12.99 +        
  12.100 +        # pixmap
  12.101 +        lbPix = QtGui.QLabel()
  12.102 +        lbPix.setPixmap(QtGui.QPixmapCache.find('opensecurity_icon_64'))
  12.103 +        lyContent.addWidget(lbPix, 0, QtCore.Qt.Alignment(QtCore.Qt.AlignTop + QtCore.Qt.AlignHCenter))
  12.104 +        lyContent.addSpacing(16)
  12.105 +        
  12.106 +        # launch ...
  12.107 +        lyLaunch = QtGui.QGridLayout()
  12.108 +        lyContent.addLayout(lyLaunch)
  12.109 +        lbTitle = QtGui.QLabel('Specify details for application to launch.')
  12.110 +        lyLaunch.addWidget(lbTitle, 0, 0, 1, 2)
  12.111 +        
  12.112 +        lbVM = QtGui.QLabel('&VM-ID:')
  12.113 +        lyLaunch.addWidget(lbVM, 1, 0)
  12.114 +        self.edVM = QtGui.QLineEdit()
  12.115 +        lyLaunch.addWidget(self.edVM, 1, 1)
  12.116 +        lbVM.setBuddy(self.edVM)
  12.117 +        
  12.118 +        # TODO: HARD CODED!
  12.119 +        self.edVM.setText('Debian 7')
  12.120 +        
  12.121 +        lbApplication = QtGui.QLabel('&Application:')
  12.122 +        lyLaunch.addWidget(lbApplication, 2, 0)
  12.123 +        self.cbApplication = QtGui.QComboBox()
  12.124 +        self.cbApplication.setEditable(True)
  12.125 +        lyLaunch.addWidget(self.cbApplication, 2, 1)
  12.126 +        lbApplication.setBuddy(self.cbApplication)
  12.127 +        
  12.128 +        # TODO: HARD CODED!
  12.129 +        self.cbApplication.addItem('iceweasel')
  12.130 +        self.cbApplication.addItem('vlc')
  12.131 +        self.cbApplication.addItem('xfce4-terminal')
  12.132 +        
  12.133 +        lyLaunch.addWidget(QtGui.QWidget(), 3, 0, 1, 2)
  12.134 +        lyLaunch.setColumnStretch(1, 1)
  12.135 +        lyLaunch.setRowStretch(3, 1)
  12.136 +        
  12.137 +        lyMain.addStretch(1)
  12.138 +        
  12.139 +        # buttons
  12.140 +        lyButton = QtGui.QHBoxLayout()
  12.141 +        lyMain.addLayout(lyButton)
  12.142 +        
  12.143 +        lyButton.addStretch(1)
  12.144 +        btnOk = QtGui.QPushButton('&Ok', self)
  12.145 +        btnOk.setDefault(True)
  12.146 +        btnOk.setMinimumWidth(100)
  12.147 +        lyButton.addWidget(btnOk)
  12.148 +        btnCancel = QtGui.QPushButton('&Cancel', self)
  12.149 +        btnCancel.setMinimumWidth(100)
  12.150 +        lyButton.addWidget(btnCancel)
  12.151 +        btnAbout = QtGui.QPushButton('&About', self)
  12.152 +        btnAbout.setMinimumWidth(100)
  12.153 +        lyButton.addWidget(btnAbout)
  12.154 +        
  12.155 +        button_width = max(btnOk.width(), btnCancel.width(), btnAbout.width())
  12.156 +        btnOk.setMinimumWidth(button_width)
  12.157 +        btnCancel.setMinimumWidth(button_width)
  12.158 +        btnAbout.setMinimumWidth(button_width)
  12.159 +        
  12.160 +        # reduce to the max
  12.161 +        self.resize(lyMain.minimumSize())
  12.162 +        
  12.163 +        # connectors
  12.164 +        btnOk.clicked.connect(self.clicked_ok)
  12.165 +        btnCancel.clicked.connect(self.clicked_cancel)
  12.166 +        btnAbout.clicked.connect(self.clicked_about)
  12.167 +
  12.168 +
  12.169 +def main():
  12.170 +    
  12.171 +    # parse command line
  12.172 +    app = QtGui.QApplication(sys.argv)
  12.173 +    
  12.174 +    # prebuild the pixmap cache: fetch all jpg, png and jpeg images and load them
  12.175 +    data_path = Environment("opensecurity").image_path
  12.176 +    for file in os.listdir(data_path):
  12.177 +        if file.lower().rpartition('.')[2] in ('jpg', 'png', 'jpeg'):
  12.178 +            QtGui.QPixmapCache.insert(file.lower().rpartition('.')[0], QtGui.QPixmap(os.path.join(data_path, file)))
  12.179 +            
  12.180 +    # we should have now our application icon
  12.181 +    app.setWindowIcon(QtGui.QIcon(QtGui.QPixmapCache.find('opensecurity_icon_64')))
  12.182 +    
  12.183 +    dlg = Chooser()
  12.184 +
  12.185 +    # pop up the dialog
  12.186 +    dlg.show()
  12.187 +    app.exec_()
  12.188 +    
  12.189 +    if dlg.result() == QtGui.QDialog.Accepted:
  12.190 +        # encode an proper GET request to the opensecurity daemon
  12.191 +        get_vm = urllib.quote(str(dlg.edVM.text()))
  12.192 +        get_app = urllib.quote(str(dlg.cbApplication.currentText()))
  12.193 +        osd_request = 'http://127.0.0.1:8080/application?vm={0}&app={1}'.format(get_vm, get_app)
  12.194 +        urllib.urlopen(osd_request)
  12.195 +        res = 0
  12.196 +    else:
  12.197 +        res = 1
  12.198 +        
  12.199 +    sys.exit(res)
  12.200 +    
  12.201 +# start
  12.202 +if __name__ == "__main__":
  12.203 +    main()
  12.204 +
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/ait/os/bin/opensecurityd/opensecurity-dialog.py	Tue Nov 12 11:31:34 2013 +0100
    13.3 @@ -0,0 +1,92 @@
    13.4 +#!/bin/env python
    13.5 +# -*- coding: utf-8 -*-
    13.6 +
    13.7 +# ------------------------------------------------------------
    13.8 +# opensecurity-dialog
    13.9 +# 
   13.10 +# an opensecurity dialog
   13.11 +#
   13.12 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   13.13 +#
   13.14 +# Copyright (C) 2013 AIT Austrian Institute of Technology
   13.15 +# AIT Austrian Institute of Technology GmbH
   13.16 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
   13.17 +# http://www.ait.ac.at
   13.18 +#
   13.19 +# This program is free software; you can redistribute it and/or
   13.20 +# modify it under the terms of the GNU General Public License
   13.21 +# as published by the Free Software Foundation version 2.
   13.22 +# 
   13.23 +# This program is distributed in the hope that it will be useful,
   13.24 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.25 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13.26 +# GNU General Public License for more details.
   13.27 +# 
   13.28 +# You should have received a copy of the GNU General Public License
   13.29 +# along with this program; if not, write to the Free Software
   13.30 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
   13.31 +# Boston, MA  02110-1301, USA.
   13.32 +# ------------------------------------------------------------
   13.33 +
   13.34 +
   13.35 +# ------------------------------------------------------------
   13.36 +# imports
   13.37 +
   13.38 +import argparse
   13.39 +import os
   13.40 +import sys
   13.41 +
   13.42 +from PyQt4 import QtCore
   13.43 +from PyQt4 import QtGui
   13.44 +
   13.45 +# local
   13.46 +from credentials import Credentials
   13.47 +from environment import Environment
   13.48 +from password import Password
   13.49 +
   13.50 +
   13.51 +# ------------------------------------------------------------
   13.52 +# code
   13.53 +
   13.54 +
   13.55 +def main():
   13.56 +    
   13.57 +    # parse command line
   13.58 +    parser = argparse.ArgumentParser(description = 'OpenSecuirty Dialog.')
   13.59 +    parser.add_argument('mode', metavar='MODE', help='dialog mode: \'password\' or \'credentials\'')
   13.60 +    parser.add_argument('text', metavar='TEXT', help='text to show')
   13.61 +    args = parser.parse_args()
   13.62 +    
   13.63 +    app = QtGui.QApplication(sys.argv)
   13.64 +    
   13.65 +    # prebuild the pixmap cache: fetch all jpg, png and jpeg images and load them
   13.66 +    data_path = Environment("opensecurity").image_path
   13.67 +    for file in os.listdir(data_path):
   13.68 +        if file.lower().rpartition('.')[2] in ('jpg', 'png', 'jpeg'):
   13.69 +            QtGui.QPixmapCache.insert(file.lower().rpartition('.')[0], QtGui.QPixmap(os.path.join(data_path, file)))
   13.70 +            
   13.71 +    # we should have now our application icon
   13.72 +    app.setWindowIcon(QtGui.QIcon(QtGui.QPixmapCache.find('opensecurity_icon_64')))
   13.73 +    
   13.74 +    if args.mode == 'password':
   13.75 +        dlg = Password(args.text)
   13.76 +    
   13.77 +    if args.mode == 'credentials':
   13.78 +        dlg = Credentials(args.text)
   13.79 +    
   13.80 +    # pop up the dialog
   13.81 +    dlg.show()
   13.82 +    app.exec_()
   13.83 +    
   13.84 +    # give proper result code
   13.85 +    if dlg.result() == QtGui.QDialog.Accepted:
   13.86 +        res = 0
   13.87 +    else:
   13.88 +        res = 1
   13.89 +    sys.exit(res)
   13.90 +    
   13.91 +
   13.92 +# start
   13.93 +if __name__ == "__main__":
   13.94 +    main()
   13.95 +
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/ait/os/bin/opensecurityd/opensecurity-tray.py	Tue Nov 12 11:31:34 2013 +0100
    14.3 @@ -0,0 +1,104 @@
    14.4 +#!/bin/env python
    14.5 +# -*- coding: utf-8 -*-
    14.6 +
    14.7 +# ------------------------------------------------------------
    14.8 +# opensecurity-dialog
    14.9 +# 
   14.10 +# an opensecurity dialog
   14.11 +#
   14.12 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   14.13 +#
   14.14 +# Copyright (C) 2013 AIT Austrian Institute of Technology
   14.15 +# AIT Austrian Institute of Technology GmbH
   14.16 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
   14.17 +# http://www.ait.ac.at
   14.18 +#
   14.19 +# This program is free software; you can redistribute it and/or
   14.20 +# modify it under the terms of the GNU General Public License
   14.21 +# as published by the Free Software Foundation version 2.
   14.22 +# 
   14.23 +# This program is distributed in the hope that it will be useful,
   14.24 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   14.25 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14.26 +# GNU General Public License for more details.
   14.27 +# 
   14.28 +# You should have received a copy of the GNU General Public License
   14.29 +# along with this program; if not, write to the Free Software
   14.30 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
   14.31 +# Boston, MA  02110-1301, USA.
   14.32 +# ------------------------------------------------------------
   14.33 +
   14.34 +
   14.35 +# ------------------------------------------------------------
   14.36 +# imports
   14.37 +
   14.38 +import argparse
   14.39 +import os
   14.40 +import subprocess
   14.41 +import sys
   14.42 +
   14.43 +from PyQt4 import QtCore
   14.44 +from PyQt4 import QtGui
   14.45 +
   14.46 +# local
   14.47 +from environment import Environment
   14.48 +
   14.49 +
   14.50 +# ------------------------------------------------------------
   14.51 +# code
   14.52 +
   14.53 +
   14.54 +class OpenSecurityTrayIcon(QtGui.QSystemTrayIcon):
   14.55 +    
   14.56 +    """This is the OpenSecuirty Tray Icon"""
   14.57 +
   14.58 +    def __init__(self, icon, parent=None):
   14.59 +        
   14.60 +        super(OpenSecurityTrayIcon, self).__init__(icon, parent)
   14.61 +        
   14.62 +        # define the tray icon menu
   14.63 +        menu = QtGui.QMenu(parent)
   14.64 +        self.setContextMenu(menu)
   14.65 +        
   14.66 +        cAcLaunch = menu.addAction(QtGui.QIcon(QtGui.QPixmapCache.find('opensecurity_icon_64')), 'Lauch Application')
   14.67 +        menu.addSeparator()
   14.68 +        cAcExit = menu.addAction("Exit")
   14.69 +        
   14.70 +        cAcLaunch.triggered.connect(self.clicked_launch_application)
   14.71 +        cAcExit.triggered.connect(self.clicked_exit)
   14.72 +        
   14.73 +        
   14.74 +    def clicked_exit(self):
   14.75 +        """clicked exit"""
   14.76 +        sys.exit(0)
   14.77 +    
   14.78 +
   14.79 +    def clicked_launch_application(self):
   14.80 +        """clicked the launch an application"""
   14.81 +        dlg_launch_image = os.path.join(sys.path[0], 'launch.py')
   14.82 +        process_command = [sys.executable, dlg_launch_image]
   14.83 +        process = subprocess.Popen(process_command, shell = False)
   14.84 +        process.communicate()
   14.85 +            
   14.86 +
   14.87 +def main():
   14.88 +    
   14.89 +    app = QtGui.QApplication(sys.argv)
   14.90 +
   14.91 +    # prebuild the pixmap cache: fetch all jpg, png and jpeg images and load them
   14.92 +    data_path = Environment("opensecurity").image_path
   14.93 +    for file in os.listdir(data_path):
   14.94 +        if file.lower().rpartition('.')[2] in ('jpg', 'png', 'jpeg'):
   14.95 +            QtGui.QPixmapCache.insert(file.lower().rpartition('.')[0], QtGui.QPixmap(os.path.join(data_path, file)))
   14.96 +
   14.97 +    w = QtGui.QWidget()
   14.98 +    trayIcon = OpenSecurityTrayIcon(QtGui.QIcon(QtGui.QPixmapCache.find('opensecurity_icon_64')), w)
   14.99 +
  14.100 +    trayIcon.show()
  14.101 +    sys.exit(app.exec_())
  14.102 +   
  14.103 +
  14.104 +# start
  14.105 +if __name__ == "__main__":
  14.106 +    main()
  14.107 +
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/ait/os/bin/opensecurityd/opensecurityd.py	Tue Nov 12 11:31:34 2013 +0100
    15.3 @@ -0,0 +1,178 @@
    15.4 +#!/bin/env python
    15.5 +# -*- coding: utf-8 -*-
    15.6 +
    15.7 +# ------------------------------------------------------------
    15.8 +# opensecurityd
    15.9 +# 
   15.10 +# the opensecurityd as RESTful server
   15.11 +#
   15.12 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   15.13 +#
   15.14 +# Copyright (C) 2013 AIT Austrian Institute of Technology
   15.15 +# AIT Austrian Institute of Technology GmbH
   15.16 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
   15.17 +# http://www.ait.ac.at
   15.18 +#
   15.19 +# This program is free software; you can redistribute it and/or
   15.20 +# modify it under the terms of the GNU General Public License
   15.21 +# as published by the Free Software Foundation version 2.
   15.22 +# 
   15.23 +# This program is distributed in the hope that it will be useful,
   15.24 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   15.25 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   15.26 +# GNU General Public License for more details.
   15.27 +# 
   15.28 +# You should have received a copy of the GNU General Public License
   15.29 +# along with this program; if not, write to the Free Software
   15.30 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
   15.31 +# Boston, MA  02110-1301, USA.
   15.32 +# ------------------------------------------------------------
   15.33 +
   15.34 +
   15.35 +# ------------------------------------------------------------
   15.36 +# imports
   15.37 +
   15.38 +import os
   15.39 +import os.path
   15.40 +import subprocess
   15.41 +import sys
   15.42 +import web
   15.43 +
   15.44 +# local
   15.45 +from environment import Environment
   15.46 +
   15.47 +
   15.48 +# ------------------------------------------------------------
   15.49 +# const
   15.50 +
   15.51 +
   15.52 +__version__ = "0.1"
   15.53 +
   15.54 +
   15.55 +"""All the URLs we know mapping to class handler"""
   15.56 +opensecurity_urls = (
   15.57 +    '/application',             'os_application',
   15.58 +    '/device',                  'os_device',
   15.59 +    '/device/credentials',      'os_device_credentials',
   15.60 +    '/device/password',         'os_device_password',
   15.61 +    '/',                        'os_root'
   15.62 +)
   15.63 +
   15.64 +
   15.65 +# ------------------------------------------------------------
   15.66 +# code
   15.67 +
   15.68 +
   15.69 +class os_application:
   15.70 +    
   15.71 +    """OpenSecurity '/application' handler.
   15.72 +    
   15.73 +    This is called on GET /application?vm=VM-ID&app=APP-ID
   15.74 +    This tries to access the vm identified with the label VM-ID
   15.75 +    and launched the application identified APP-ID
   15.76 +    """
   15.77 +    
   15.78 +    def GET(self):
   15.79 +        
   15.80 +        # pick the arguments
   15.81 +        args = web.input()
   15.82 +        
   15.83 +        # we _need_ a vm
   15.84 +        if not "vm" in args:
   15.85 +            raise web.badrequest()
   15.86 +        
   15.87 +        # we _need_ a app
   15.88 +        if not "app" in args:
   15.89 +            raise web.badrequest()
   15.90 +        
   15.91 +        ## TODO: HARD CODED STUFF HERE! THIS SHOULD BE FLEXIBLE!
   15.92 +        ssh_private_key = os.path.join(Environment("opensecurity").data_path, 'share', '192.168.56.15.ppk')
   15.93 +        putty_session = '192.168.56.15'
   15.94 +        process_command = ['plink.exe', '-i', ssh_private_key, putty_session, args.app]
   15.95 +        si = subprocess.STARTUPINFO()
   15.96 +        si.dwFlags = subprocess.STARTF_USESHOWWINDOW
   15.97 +        si.wShowWindow = subprocess.SW_HIDE
   15.98 +        print('tyring to launch: ' + ' '.join(process_command))
   15.99 +        process = subprocess.Popen(process_command, shell = True)
  15.100 +        return 'launched: ' + ' '.join(process_command)
  15.101 +
  15.102 +
  15.103 +class os_device:
  15.104 +    
  15.105 +    """OpenSecurity '/device' handler"""
  15.106 +    
  15.107 +    def GET(self):
  15.108 +        return "os_device"
  15.109 +
  15.110 +
  15.111 +class os_device_credentials:
  15.112 +    
  15.113 +    """OpenSecurity '/device/credentials' handler.
  15.114 +    
  15.115 +    This is called on GET /device/credentials?id=DEVICE-ID.
  15.116 +    Ideally this should pop up a user dialog to insert his
  15.117 +    credentials based the DEVICE-ID
  15.118 +    """
  15.119 +    
  15.120 +    def GET(self):
  15.121 +        
  15.122 +        # pick the arguments
  15.123 +        args = web.input()
  15.124 +        
  15.125 +        # we _need_ a device id
  15.126 +        if not "id" in args:
  15.127 +            raise web.badrequest()
  15.128 +        
  15.129 +        # invoke the user dialog as a subprocess
  15.130 +        dlg_credentials_image = os.path.join(sys.path[0], 'opensecurity-dialog.py')
  15.131 +        process_command = [sys.executable, dlg_credentials_image, 'credentials', 'Please provide credentials for accessing \ndevice: "{0}".'.format(args.id)]
  15.132 +        process = subprocess.Popen(process_command, shell = False, stdout = subprocess.PIPE)
  15.133 +        result = process.communicate()[0]
  15.134 +        if process.returncode != 0:
  15.135 +            return 'Credentials request has been aborted.'
  15.136 +        
  15.137 +        return result
  15.138 +
  15.139 +
  15.140 +class os_device_password:
  15.141 +    
  15.142 +    """OpenSecurity '/device/password' handler.
  15.143 +    
  15.144 +    This is called on GET /device/password?id=DEVICE-ID.
  15.145 +    Ideally this should pop up a user dialog to insert his
  15.146 +    password based the DEVICE-ID
  15.147 +    """
  15.148 +    
  15.149 +    def GET(self):
  15.150 +        
  15.151 +        # pick the arguments
  15.152 +        args = web.input()
  15.153 +        
  15.154 +        # we _need_ a device id
  15.155 +        if not "id" in args:
  15.156 +            raise web.badrequest()
  15.157 +            
  15.158 +        # invoke the user dialog as a subprocess
  15.159 +        dlg_credentials_image = os.path.join(sys.path[0], 'opensecurity-dialog.py')
  15.160 +        process_command = [sys.executable, dlg_credentials_image, 'password', 'Please provide a password for accessing \ndevice: "{0}".'.format(args.id)]
  15.161 +        process = subprocess.Popen(process_command, shell = False, stdout = subprocess.PIPE)
  15.162 +        result = process.communicate()[0]
  15.163 +        if process.returncode != 0:
  15.164 +            return 'Credentials request has been aborted.'
  15.165 +        
  15.166 +        return result
  15.167 +
  15.168 +
  15.169 +class os_root:
  15.170 +    
  15.171 +    """OpenSecurity '/' handler"""
  15.172 +    
  15.173 +    def GET(self):
  15.174 +        return "OpenSecurity-Server { \"version\": \"%s\" }" % __version__
  15.175 +
  15.176 +
  15.177 +# start
  15.178 +if __name__ == "__main__":
  15.179 +    server = web.application(opensecurity_urls, globals())
  15.180 +    server.run()
  15.181 +
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/ait/os/bin/opensecurityd/password.py	Tue Nov 12 11:31:34 2013 +0100
    16.3 @@ -0,0 +1,150 @@
    16.4 +#!/bin/env python
    16.5 +# -*- coding: utf-8 -*-
    16.6 +
    16.7 +# ------------------------------------------------------------
    16.8 +# password-dialog
    16.9 +# 
   16.10 +# ask the user a password
   16.11 +#
   16.12 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   16.13 +#
   16.14 +# Copyright (C) 2013 AIT Austrian Institute of Technology
   16.15 +# AIT Austrian Institute of Technology GmbH
   16.16 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
   16.17 +# http://www.ait.ac.at
   16.18 +#
   16.19 +# This program is free software; you can redistribute it and/or
   16.20 +# modify it under the terms of the GNU General Public License
   16.21 +# as published by the Free Software Foundation version 2.
   16.22 +# 
   16.23 +# This program is distributed in the hope that it will be useful,
   16.24 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   16.25 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16.26 +# GNU General Public License for more details.
   16.27 +# 
   16.28 +# You should have received a copy of the GNU General Public License
   16.29 +# along with this program; if not, write to the Free Software
   16.30 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
   16.31 +# Boston, MA  02110-1301, USA.
   16.32 +# ------------------------------------------------------------
   16.33 +
   16.34 +
   16.35 +# ------------------------------------------------------------
   16.36 +# imports
   16.37 +
   16.38 +import sys
   16.39 +
   16.40 +from PyQt4 import QtCore
   16.41 +from PyQt4 import QtGui
   16.42 +
   16.43 +# local
   16.44 +from about import About
   16.45 +
   16.46 +# ------------------------------------------------------------
   16.47 +# code
   16.48 +
   16.49 +
   16.50 +class Password(QtGui.QDialog):
   16.51 +    
   16.52 +    """Ask the user for a password."""
   16.53 +    
   16.54 +    def __init__(self, text, parent = None, flags = QtCore.Qt.WindowFlags(0)):
   16.55 +        
   16.56 +        # super call and widget init
   16.57 +        super(Password, self).__init__(parent, flags)
   16.58 +        self.setWindowTitle('OpenSecuirty Password Request')
   16.59 +        self.setup_ui()
   16.60 +        
   16.61 +        # positionate ourself central
   16.62 +        screen = QtGui.QDesktopWidget().screenGeometry()
   16.63 +        self.resize(self.geometry().width() * 1.25, self.geometry().height())
   16.64 +        size = self.geometry()
   16.65 +        self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2)
   16.66 +        
   16.67 +        # fix up text
   16.68 +        self.lbText.setText(text)
   16.69 +        
   16.70 +
   16.71 +    def clicked_about(self):
   16.72 +        """clicked the about button"""
   16.73 +        dlgAbout = About()
   16.74 +        dlgAbout.exec_()
   16.75 +    
   16.76 +
   16.77 +    def clicked_cancel(self):
   16.78 +        """clicked the cancel button"""
   16.79 +        self.reject()
   16.80 +    
   16.81 +
   16.82 +    def clicked_ok(self):
   16.83 +        """clicked the ok button"""
   16.84 +        sys.stdout.write('{ ')
   16.85 +        sys.stdout.write('\'password\': \'')
   16.86 +        sys.stdout.write(self.edPassword.text())
   16.87 +        sys.stdout.write('\' ')
   16.88 +        sys.stdout.write('}\n')
   16.89 +        self.accept()
   16.90 +    
   16.91 +
   16.92 +    def setup_ui(self):
   16.93 +        
   16.94 +        """Create the widgets."""
   16.95 +        
   16.96 +        lyMain = QtGui.QVBoxLayout(self)
   16.97 +        lyMain.setContentsMargins(8, 8, 8, 8)
   16.98 +        
   16.99 +        # content area: left pixmap, right text
  16.100 +        lyContent = QtGui.QHBoxLayout()
  16.101 +        lyMain.addLayout(lyContent)
  16.102 +        
  16.103 +        # pixmap
  16.104 +        lbPix = QtGui.QLabel()
  16.105 +        lbPix.setPixmap(QtGui.QPixmapCache.find('opensecurity_icon_64'))
  16.106 +        lyContent.addWidget(lbPix, 0, QtCore.Qt.Alignment(QtCore.Qt.AlignTop + QtCore.Qt.AlignHCenter))
  16.107 +        lyContent.addSpacing(16)
  16.108 +        
  16.109 +        # text ...
  16.110 +        lyText = QtGui.QVBoxLayout()
  16.111 +        lyContent.addLayout(lyText)
  16.112 +        self.lbText = QtGui.QLabel()
  16.113 +        lyText.addWidget(self.lbText)
  16.114 +        lyPassword = QtGui.QHBoxLayout()
  16.115 +        lyText.addLayout(lyPassword)
  16.116 +        lbPassword = QtGui.QLabel('&Password:')
  16.117 +        lyPassword.addWidget(lbPassword)
  16.118 +        self.edPassword = QtGui.QLineEdit()
  16.119 +        self.edPassword.setEchoMode(QtGui.QLineEdit.Password)
  16.120 +        lyPassword.addWidget(self.edPassword)
  16.121 +        lbPassword.setBuddy(self.edPassword)
  16.122 +        lyText.addStretch(1)
  16.123 +        
  16.124 +        lyMain.addStretch(1)
  16.125 +        
  16.126 +        # buttons
  16.127 +        lyButton = QtGui.QHBoxLayout()
  16.128 +        lyMain.addLayout(lyButton)
  16.129 +        
  16.130 +        lyButton.addStretch(1)
  16.131 +        btnOk = QtGui.QPushButton('&Ok', self)
  16.132 +        btnOk.setDefault(True)
  16.133 +        btnOk.setMinimumWidth(100)
  16.134 +        lyButton.addWidget(btnOk)
  16.135 +        btnCancel = QtGui.QPushButton('&Cancel', self)
  16.136 +        btnCancel.setMinimumWidth(100)
  16.137 +        lyButton.addWidget(btnCancel)
  16.138 +        btnAbout = QtGui.QPushButton('&About', self)
  16.139 +        btnAbout.setMinimumWidth(100)
  16.140 +        lyButton.addWidget(btnAbout)
  16.141 +        
  16.142 +        button_width = max(btnOk.width(), btnCancel.width(), btnAbout.width())
  16.143 +        btnOk.setMinimumWidth(button_width)
  16.144 +        btnCancel.setMinimumWidth(button_width)
  16.145 +        btnAbout.setMinimumWidth(button_width)
  16.146 +        
  16.147 +        # reduce to the max
  16.148 +        self.resize(lyMain.minimumSize())
  16.149 +        
  16.150 +        # connectors
  16.151 +        btnOk.clicked.connect(self.clicked_ok)
  16.152 +        btnCancel.clicked.connect(self.clicked_cancel)
  16.153 +        btnAbout.clicked.connect(self.clicked_about)
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/ait/os/bin/opensecurityd/vm-start.vbs	Tue Nov 12 11:31:34 2013 +0100
    17.3 @@ -0,0 +1,30 @@
    17.4 +Option Explicit
    17.5 +
    17.6 +' ------------------------------------------------------------
    17.7 +' start the VMs in the background and mount "network" shares
    17.8 +'
    17.9 +' Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   17.10 +'
   17.11 +' Copyright (C) 2013 AIT Austrian Institute of Technology
   17.12 +' AIT Austrian Institute of Technology GmbH
   17.13 +' Donau-City-Strasse 1 | 1220 Vienna | Austria
   17.14 +' http://www.ait.ac.at
   17.15 +' ------------------------------------------------------------
   17.16 +
   17.17 +Dim cShell
   17.18 +Dim nError
   17.19 +
   17.20 +' get the Windows Scripting Host Shell
   17.21 +Set cShell = CreateObject("WScript.Shell")
   17.22 + 
   17.23 +' Start the VM
   17.24 +cShell.Run """C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe"" startvm ""Debian 7"" --type headless", 0, True
   17.25 +
   17.26 +' Mount the VM Internal "Downloads" folder
   17.27 +Do 
   17.28 +	nError = cShell.Run("net view \\192.168.56.15", 0, True)
   17.29 +	If nError <> 0 Then
   17.30 +		WScript.Sleep 100
   17.31 +	End If
   17.32 +Loop While nError <> 0
   17.33 +nError = cShell.Run("net use Z: \\192.168.56.15\Downloads", 0, True)
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/ait/os/bin/shadowfuse/CMakeLists.txt	Tue Nov 12 11:31:34 2013 +0100
    18.3 @@ -0,0 +1,44 @@
    18.4 +# ------------------------------------------------------------
    18.5 +# CMakeLists.txt 
    18.6 +# 
    18.7 +# make: bin/ make the shadowfuse binary
    18.8 +#
    18.9 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   18.10 +#
   18.11 +# Copyright (C) 2013 AIT Austrian Institute of Technology
   18.12 +# AIT Austrian Institute of Technology GmbH
   18.13 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
   18.14 +# http://www.ait.ac.at
   18.15 +#
   18.16 +# This program is free software; you can redistribute it and/or
   18.17 +# modify it under the terms of the GNU General Public License
   18.18 +# as published by the Free Software Foundation version 2.
   18.19 +# 
   18.20 +# This program is distributed in the hope that it will be useful,
   18.21 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   18.22 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18.23 +# GNU General Public License for more details.
   18.24 +# 
   18.25 +# You should have received a copy of the GNU General Public License
   18.26 +# along with this program; if not, write to the Free Software
   18.27 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
   18.28 +# Boston, MA  02110-1301, USA.
   18.29 +# ------------------------------------------------------------
   18.30 +
   18.31 +
   18.32 +# ------------------------------------------------------------
   18.33 +# shadowfuse
   18.34 +
   18.35 +# sources
   18.36 +set(SHADOWFUSE_SRC
   18.37 +    main.cpp
   18.38 +)
   18.39 +
   18.40 +# bin definition
   18.41 +add_executable(shadowfuse ${SHADOWFUSE_SRC})
   18.42 +
   18.43 +# linkage
   18.44 +target_link_libraries(shadowfuse ${CMAKE_REQUIRED_LIBRARIES})
   18.45 +
   18.46 +# install
   18.47 +install(TARGETS shadowfuse RUNTIME DESTINATION bin)
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/ait/os/bin/shadowfuse/main.cpp	Tue Nov 12 11:31:34 2013 +0100
    19.3 @@ -0,0 +1,421 @@
    19.4 +/*
    19.5 + * main.cpp
    19.6 + * 
    19.7 + * This is the shadowfuse main startup file.
    19.8 + *
    19.9 + * Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   19.10 + *
   19.11 + * Copyright (C) 2013 AIT Austrian Institute of Technology
   19.12 + * AIT Austrian Institute of Technology GmbH
   19.13 + * Donau-City-Strasse 1 | 1220 Vienna | Austria
   19.14 + * http://www.ait.ac.at
   19.15 + *
   19.16 + * This program is free software; you can redistribute it and/or
   19.17 + * modify it under the terms of the GNU General Public License
   19.18 + * as published by the Free Software Foundation version 2.
   19.19 + * 
   19.20 + * This program is distributed in the hope that it will be useful,
   19.21 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   19.22 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   19.23 + * GNU General Public License for more details.
   19.24 + * 
   19.25 + * You should have received a copy of the GNU General Public License
   19.26 + * along with this program; if not, write to the Free Software
   19.27 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
   19.28 + * Boston, MA  02110-1301, USA.
   19.29 + */
   19.30 +
   19.31 + 
   19.32 +// ------------------------------------------------------------
   19.33 +// incs
   19.34 +
   19.35 +#include "baseinc.h"
   19.36 +
   19.37 +
   19.38 +// ------------------------------------------------------------
   19.39 +// defs
   19.40 +
   19.41 +
   19.42 +/**
   19.43 + * shadowfuse version
   19.44 + */
   19.45 +#define SHADOWFUSE_VERSION  "0.1"
   19.46 +
   19.47 +
   19.48 +// ------------------------------------------------------------
   19.49 +// vars
   19.50 +
   19.51 +
   19.52 +/**
   19.53 + * keys for FUSE_OPT_ options 
   19.54 + */
   19.55 +enum {
   19.56 +   KEY_VERSION,
   19.57 +   KEY_HELP,
   19.58 +};
   19.59 +
   19.60 +
   19.61 +/**
   19.62 + * array of options we know
   19.63 + */
   19.64 +static struct fuse_opt shadowfuse_opts[] = {
   19.65 +    FUSE_OPT_KEY("-V",             KEY_VERSION),
   19.66 +    FUSE_OPT_KEY("--version",      KEY_VERSION),
   19.67 +    FUSE_OPT_KEY("-h",             KEY_HELP),
   19.68 +    FUSE_OPT_KEY("--help",         KEY_HELP),
   19.69 +    FUSE_OPT_END
   19.70 +};
   19.71 +
   19.72 +
   19.73 +/**
   19.74 + * configuration of shadowfuse
   19.75 + */
   19.76 +static struct shadowfuse_config {
   19.77 +
   19.78 +    std::string sShadowedPath;
   19.79 +    std::string sMountPoint;
   19.80 +    
   19.81 +    /**
   19.82 +     * check for paths been set
   19.83 +     */
   19.84 +    inline bool is_paths_set() const { return !(sShadowedPath.empty() || sMountPoint.empty()); };
   19.85 +    
   19.86 +} g_cShadowFuseConfig;
   19.87 +
   19.88 +
   19.89 +// ------------------------------------------------------------
   19.90 +// fwd
   19.91 +
   19.92 +static int option_processor(void * cData, const char * sArg, int nKey, struct fuse_args * cOutArgs);
   19.93 +static void usage(const char * sProgName);
   19.94 +
   19.95 +
   19.96 +// ------------------------------------------------------------
   19.97 +// code
   19.98 +
   19.99 +
  19.100 +
  19.101 +/** 
  19.102 + * get file attributes.
  19.103 + */
  19.104 +static int shadow_getattr(const char * sPath, struct stat * cFileStat) {
  19.105 +    
  19.106 +    // open the shadow file
  19.107 +    std::string sShadow = g_cShadowFuseConfig.sShadowedPath + sPath;
  19.108 +std::cerr << "=== INSERT HOOK HERE. Getting file attributes of " << sShadow << std::endl;
  19.109 +
  19.110 +    memset(cFileStat, 0, sizeof(struct stat));
  19.111 +    if (stat(sShadow.c_str(), cFileStat) == -1) return -errno;
  19.112 +    
  19.113 +    return 0;
  19.114 +}
  19.115 +
  19.116 +
  19.117 +
  19.118 +/** 
  19.119 + * create a directory 
  19.120 + */
  19.121 +static int shadow_mkdir(const char * sPath, mode_t cMode) {
  19.122 +    
  19.123 +    // create directory
  19.124 +    std::string sShadow = g_cShadowFuseConfig.sShadowedPath + sPath;
  19.125 +std::cerr << "=== INSERT HOOK HERE. Create directory " << sShadow << std::endl;
  19.126 +
  19.127 +    if (mkdir(sShadow.c_str(), cMode) == -1) return -errno;
  19.128 +    return 0;
  19.129 +}
  19.130 +
  19.131 +
  19.132 +/** 
  19.133 + * create a file
  19.134 + */
  19.135 +static int shadow_mknod(const char * sPath, mode_t cMode, dev_t cDev) {
  19.136 +    
  19.137 +    // create file
  19.138 +    std::string sShadow = g_cShadowFuseConfig.sShadowedPath + sPath;
  19.139 +std::cerr << "=== INSERT HOOK HERE. Create file " << sShadow << std::endl;
  19.140 +
  19.141 +    if (mknod(sShadow.c_str(), cMode, cDev) == -1) return -errno;
  19.142 +    return 0;
  19.143 +}
  19.144 +
  19.145 +
  19.146 +/**
  19.147 + * open file
  19.148 + */
  19.149 +static int shadow_open(const char * sPath, struct fuse_file_info * cFileInfo) {
  19.150 +    
  19.151 +    // open the shadow file
  19.152 +    std::string sShadow = g_cShadowFuseConfig.sShadowedPath + sPath;
  19.153 +std::cerr << "=== INSERT HOOK HERE. Opening file " << sShadow << std::endl;
  19.154 +
  19.155 +    if (open(sShadow.c_str(), cFileInfo->flags) == -1) return -errno;
  19.156 +    return 0;
  19.157 +}
  19.158 +
  19.159 +
  19.160 +/**
  19.161 + * read from file
  19.162 + */
  19.163 +static int shadow_read(const char * sPath, char * cBuffer, size_t nSize, off_t nOffset, UNUSED struct fuse_file_info * cFileInfo) {
  19.164 +    
  19.165 +    // read from shadow file
  19.166 +    std::string sShadow = g_cShadowFuseConfig.sShadowedPath + sPath;
  19.167 +std::cerr << "=== INSERT HOOK HERE. Reading file " << sShadow << " [offset=" << nOffset << ", fetch max bytes=" << nSize << "]" << std::endl;
  19.168 +
  19.169 +    // open, pick bytes, close & out
  19.170 +    int fd = open(sShadow.c_str(), O_RDONLY);
  19.171 +    if (fd == -1) return -errno;
  19.172 +    int res = pread(fd, cBuffer, nSize, nOffset);
  19.173 +    if (res == -1) res = -errno;
  19.174 +    close(fd);
  19.175 +    
  19.176 +    return res;
  19.177 +}
  19.178 +
  19.179 +
  19.180 +/**
  19.181 + * read directory
  19.182 + */
  19.183 +static int shadow_readdir(const char * sPath, void * cBuffer, fuse_fill_dir_t fFiller, UNUSED off_t nOffset, UNUSED struct fuse_file_info * cFileInfo) {
  19.184 +
  19.185 +    DIR * cDIR;
  19.186 +    struct dirent * cDirEntry;
  19.187 +    int res = 0;
  19.188 +
  19.189 +    // open the shadow folder
  19.190 +    std::string sShadow = g_cShadowFuseConfig.sShadowedPath + sPath;
  19.191 +std::cerr << "=== INSERT HOOK HERE. Reading content of " << sShadow << std::endl;
  19.192 +    
  19.193 +    cDIR = opendir(sShadow.c_str());
  19.194 +    if (!cDIR) return -errno;
  19.195 +
  19.196 +    // walk over the entries
  19.197 +    while ((cDirEntry = readdir(cDIR)) != NULL) {
  19.198 +        
  19.199 +        // pick file stat as well
  19.200 +        struct stat cFileStat;
  19.201 +        stat(sShadow.c_str(), &cFileStat);
  19.202 +        res = fFiller(cBuffer, cDirEntry->d_name, &cFileStat, 0);
  19.203 +         if (res != 0) break;
  19.204 +    }
  19.205 +
  19.206 +    // free directory
  19.207 +    closedir(cDIR);
  19.208 +    return res;
  19.209 +}
  19.210 +
  19.211 +
  19.212 +/**
  19.213 + * move file
  19.214 + */
  19.215 +static int shadow_rename(const char * sFromPath, const char * sToPath) {
  19.216 +    
  19.217 +    // move file
  19.218 +    std::string sShadowFrom = g_cShadowFuseConfig.sShadowedPath + sFromPath;
  19.219 +    std::string sShadowTo = g_cShadowFuseConfig.sShadowedPath + sToPath;
  19.220 +std::cerr << "=== INSERT HOOK HERE. Moving file from " << sShadowFrom << " to " << sShadowTo << std::endl;
  19.221 +
  19.222 +    if (rename(sShadowFrom.c_str(), sShadowTo.c_str()) == -1) return -errno;
  19.223 +    return 0;
  19.224 +}
  19.225 +
  19.226 +
  19.227 +/**
  19.228 + * delete a folder
  19.229 + */
  19.230 +static int shadow_rmdir(const char * sPath) {
  19.231 +    
  19.232 +    // delete the shadow folder
  19.233 +    std::string sShadow = g_cShadowFuseConfig.sShadowedPath + sPath;
  19.234 +std::cerr << "=== INSERT HOOK HERE. Delete folder " << sShadow << std::endl;
  19.235 +
  19.236 +    if (rmdir(sShadow.c_str()) == -1) return -errno;
  19.237 +    return 0;
  19.238 +}
  19.239 +
  19.240 +
  19.241 +/**
  19.242 + * delete a file
  19.243 + */
  19.244 +static int shadow_unlink(const char * sPath) {
  19.245 +    
  19.246 +    // delete the shadow file
  19.247 +    std::string sShadow = g_cShadowFuseConfig.sShadowedPath + sPath;
  19.248 +std::cerr << "=== INSERT HOOK HERE. Delete file " << sShadow << std::endl;
  19.249 +
  19.250 +    if (unlink(sShadow.c_str()) == -1) return -errno;
  19.251 +    return 0;
  19.252 +}
  19.253 +
  19.254 +
  19.255 +/**
  19.256 + * write int file
  19.257 + */
  19.258 +static int shadow_write(const char * sPath, const char * cBuffer, size_t nSize, off_t nOffset, UNUSED struct fuse_file_info * cFileInfo) {
  19.259 +    
  19.260 +    // write into file
  19.261 +    std::string sShadow = g_cShadowFuseConfig.sShadowedPath + sPath;
  19.262 +std::cerr << "=== INSERT HOOK HERE. Write into file " << sShadow << std::endl;
  19.263 +
  19.264 +    // open, push bytes, close & out
  19.265 +    int fd = open(sShadow.c_str(), O_WRONLY);
  19.266 +    if (fd == -1) return -errno;
  19.267 +    int res = pwrite(fd, cBuffer, nSize, nOffset);
  19.268 +    if (res == -1) res = -errno;
  19.269 +    close(fd);
  19.270 +    
  19.271 +    return res;
  19.272 +}
  19.273 +
  19.274 +
  19.275 +/**
  19.276 + * the shadowfuse function table
  19.277 + */
  19.278 +static struct fuse_operations shadowfuse_operations {
  19.279 +    
  19.280 +    shadow_getattr,     // getattr
  19.281 +    nullptr,            // readlink
  19.282 +    nullptr,            // getdir
  19.283 +    shadow_mknod,       // mknod
  19.284 +    shadow_mkdir,       // mkdir
  19.285 +    shadow_unlink,      // unlink
  19.286 +    shadow_rmdir,       // rmdir
  19.287 +    nullptr,            // symlink
  19.288 +    shadow_rename,      // rename
  19.289 +    nullptr,            // link
  19.290 +    nullptr,            // chmod
  19.291 +    nullptr,            // chown
  19.292 +    nullptr,            // truncate
  19.293 +    nullptr,            // utime
  19.294 +    shadow_open,        // open
  19.295 +    shadow_read,        // read
  19.296 +    shadow_write,       // write
  19.297 +    nullptr,            // statfs
  19.298 +    nullptr,            // flush
  19.299 +    nullptr,            // release
  19.300 +    nullptr,            // fsync
  19.301 +    nullptr,            // setxattr
  19.302 +    nullptr,            // getxattr
  19.303 +    nullptr,            // listxattr
  19.304 +    nullptr,            // removexattr
  19.305 +    nullptr,            // opendir
  19.306 +    shadow_readdir,     // readdir
  19.307 +    nullptr,            // releasedir
  19.308 +    nullptr,            // fsyncdir
  19.309 +    nullptr,            // init
  19.310 +    nullptr,            // destroy
  19.311 +    nullptr,            // access
  19.312 +    nullptr,            // create
  19.313 +    nullptr,            // ftruncate
  19.314 +    nullptr,            // fgetattr
  19.315 +    nullptr,            // lock
  19.316 +    nullptr,            // utimens
  19.317 +    nullptr,            // bmap
  19.318 +    0,                  // flag_nullpath_ok
  19.319 +    0,                  // flag_nopath
  19.320 +    0,                  // flag_utime_omit_ok
  19.321 +    0,                  // flag_reserved
  19.322 +    nullptr,            // ioctl
  19.323 +    nullptr,            // poll
  19.324 +    nullptr,            // write_buf
  19.325 +    nullptr,            // read_buf
  19.326 +    nullptr,            // flock
  19.327 +    nullptr             // fallocate
  19.328 +};
  19.329 +
  19.330 +
  19.331 +/**
  19.332 + * start
  19.333 + * 
  19.334 + * @param   argc        as usual
  19.335 + * @param   argv        as usual
  19.336 + * @return  as usual
  19.337 + */
  19.338 +int main(int argc, char ** argv) {
  19.339 +    
  19.340 +    // option parsing
  19.341 +    struct fuse_args cFUSEArgs = FUSE_ARGS_INIT(argc, argv);
  19.342 +    if (fuse_opt_parse(&cFUSEArgs, NULL, shadowfuse_opts, option_processor) == -1) {
  19.343 +        return -1;
  19.344 +    }
  19.345 +    
  19.346 +    // test if our config is setup ok
  19.347 +    if (!g_cShadowFuseConfig.is_paths_set()) {
  19.348 +        std::cerr << "sourcefolder and/or mount point not given" << std::endl;
  19.349 +        exit(1);
  19.350 +    }
  19.351 +
  19.352 +    // do FUSE
  19.353 +    int ret = fuse_main(cFUSEArgs.argc, cFUSEArgs.argv, &shadowfuse_operations, NULL);
  19.354 +    if (ret) printf("\n");
  19.355 +    fuse_opt_free_args(&cFUSEArgs);
  19.356 +        
  19.357 +    return ret;
  19.358 +}
  19.359 +
  19.360 +
  19.361 +/**
  19.362 + * option parser processor
  19.363 + * 
  19.364 + * @param   cData       is the user data passed to the fuse_opt_parse() function
  19.365 + * @param   sArg        is the whole argument or option
  19.366 + * @param   nKey        determines why the processing function was called
  19.367 + * @param   cOutArgs    the current output argument list
  19.368 + * @return  -1 on error, 0 if arg is to be discarded, 1 if arg should be kept
  19.369 + */
  19.370 +static int option_processor(UNUSED void * cData, UNUSED const char * sArg, int nKey, struct fuse_args * cOutArgs) {
  19.371 +
  19.372 +    // select by key
  19.373 +    switch (nKey) {
  19.374 +        
  19.375 +    case FUSE_OPT_KEY_OPT:
  19.376 +        return 1;
  19.377 +
  19.378 +    case FUSE_OPT_KEY_NONOPT:
  19.379 +        // the non-options
  19.380 +        if (g_cShadowFuseConfig.sShadowedPath.empty()) {
  19.381 +            // first non-option is the path to be shadowed
  19.382 +            g_cShadowFuseConfig.sShadowedPath = sArg;
  19.383 +            return 0;
  19.384 +        }
  19.385 +        else
  19.386 +        if (g_cShadowFuseConfig.sMountPoint.empty()) {
  19.387 +            // the mount point
  19.388 +            g_cShadowFuseConfig.sMountPoint = sArg;
  19.389 +            return 1;
  19.390 +        }
  19.391 +        return 1;
  19.392 +
  19.393 +    case KEY_HELP:
  19.394 +        usage(cOutArgs->argv[0]);
  19.395 +        exit(1);
  19.396 +
  19.397 +    case KEY_VERSION:
  19.398 +        printf("shadowfuse version %s\n", SHADOWFUSE_VERSION);
  19.399 +        exit(0);
  19.400 +
  19.401 +    default:
  19.402 +        fprintf(stderr, "internal error\n");
  19.403 +        abort();
  19.404 +    }
  19.405 +}
  19.406 +
  19.407 +
  19.408 +/**
  19.409 + * print usage
  19.410 + * 
  19.411 + * @param   sProgName       name of the current program
  19.412 + */
  19.413 +static void usage(const char * sProgName) {
  19.414 +    printf(
  19.415 +"usage: %s sourcefolder mountpoint\n"
  19.416 +"\n"
  19.417 +"general options:\n"
  19.418 +"    -f                     foreground\n"
  19.419 +"    -d   -odebug           foreground, but keep the debug option\n"
  19.420 +"    -h   --help            print help\n"
  19.421 +"    -V   --version         print version\n"
  19.422 +"\n", sProgName);
  19.423 +}
  19.424 +
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/ait/os/cmake/cpack/deb/control/postinst	Tue Nov 12 11:31:34 2013 +0100
    20.3 @@ -0,0 +1,31 @@
    20.4 +#!/bin/sh
    20.5 +
    20.6 +# ------------------------------------------------------------
    20.7 +# postinst
    20.8 +#
    20.9 +# post installation script run
   20.10 +#
   20.11 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   20.12 +#
   20.13 +# Copyright (C) 2013 AIT Austrian Institute of Technology
   20.14 +# AIT Austrian Institute of Technology GmbH
   20.15 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
   20.16 +# http://www.ait.ac.at
   20.17 +#
   20.18 +# This program is free software; you can redistribute it and/or
   20.19 +# modify it under the terms of the GNU General Public License
   20.20 +# as published by the Free Software Foundation version 2.
   20.21 +# 
   20.22 +# This program is distributed in the hope that it will be useful,
   20.23 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   20.24 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   20.25 +# GNU General Public License for more details.
   20.26 +# 
   20.27 +# You should have received a copy of the GNU General Public License
   20.28 +# along with this program; if not, write to the Free Software
   20.29 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
   20.30 +# Boston, MA  02110-1301, USA.
   20.31 +# ------------------------------------------------------------
   20.32 +
   20.33 +# fail on error
   20.34 +set -e
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/ait/os/cmake/cpack/deb/control/postrm	Tue Nov 12 11:31:34 2013 +0100
    21.3 @@ -0,0 +1,28 @@
    21.4 +#!/bin/sh
    21.5 +
    21.6 +# ------------------------------------------------------------
    21.7 +# postrm
    21.8 +#
    21.9 +# post removal script run
   21.10 +#
   21.11 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   21.12 +#
   21.13 +# Copyright (C) 2013 AIT Austrian Institute of Technology
   21.14 +# AIT Austrian Institute of Technology GmbH
   21.15 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
   21.16 +# http://www.ait.ac.at
   21.17 +#
   21.18 +# This program is free software; you can redistribute it and/or
   21.19 +# modify it under the terms of the GNU General Public License
   21.20 +# as published by the Free Software Foundation version 2.
   21.21 +# 
   21.22 +# This program is distributed in the hope that it will be useful,
   21.23 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   21.24 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   21.25 +# GNU General Public License for more details.
   21.26 +# 
   21.27 +# You should have received a copy of the GNU General Public License
   21.28 +# along with this program; if not, write to the Free Software
   21.29 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
   21.30 +# Boston, MA  02110-1301, USA.
   21.31 +# ------------------------------------------------------------
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/ait/os/cmake/cpack/deb/control/prerm	Tue Nov 12 11:31:34 2013 +0100
    22.3 @@ -0,0 +1,28 @@
    22.4 +#!/bin/sh
    22.5 +
    22.6 +# ------------------------------------------------------------
    22.7 +# prerm
    22.8 +#
    22.9 +# pre removal script run
   22.10 +#
   22.11 +# Autor: Oliver Maurhart, <oliver.maurhart@ait.ac.at>
   22.12 +#
   22.13 +# Copyright (C) 2013 AIT Austrian Institute of Technology
   22.14 +# AIT Austrian Institute of Technology GmbH
   22.15 +# Donau-City-Strasse 1 | 1220 Vienna | Austria
   22.16 +# http://www.ait.ac.at
   22.17 +#
   22.18 +# This program is free software; you can redistribute it and/or
   22.19 +# modify it under the terms of the GNU General Public License
   22.20 +# as published by the Free Software Foundation version 2.
   22.21 +# 
   22.22 +# This program is distributed in the hope that it will be useful,
   22.23 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   22.24 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   22.25 +# GNU General Public License for more details.
   22.26 +# 
   22.27 +# You should have received a copy of the GNU General Public License
   22.28 +# along with this program; if not, write to the Free Software
   22.29 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, 
   22.30 +# Boston, MA  02110-1301, USA.
   22.31 +# ------------------------------------------------------------
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/ait/os/config.h.in	Tue Nov 12 11:31:34 2013 +0100
    23.3 @@ -0,0 +1,107 @@
    23.4 +/**
    23.5 + * config.h.in
    23.6 + *
    23.7 + * Template for config.h
    23.8 + * This file gets modified and expanded by cmake.
    23.9 + *
   23.10 + * Copyright (C) 2012, 2013 AIT Austrian Institute of Technology
   23.11 + * AIT Austrian Institute of Technology GmbH
   23.12 + * Donau-City-Strasse 1 | 1220 Vienna | Austria
   23.13 + * http://www.ait.ac.at
   23.14 + *
   23.15 + * This library is free software; you can redistribute it and/or
   23.16 + * modify it under the terms of the GNU Lesser General Public
   23.17 + * License version 2.1 as published by the Free Software Foundation.
   23.18 + *
   23.19 + * This library is distributed in the hope that it will be useful,
   23.20 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   23.21 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   23.22 + * Lesser General Public License for more details.
   23.23 + *
   23.24 + * You should have received a copy of the GNU Lesser General Public
   23.25 + * License along with this library; if not, write to the
   23.26 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   23.27 + * Boston, MA 02110-1301, USA.
   23.28 + */
   23.29 +
   23.30 +
   23.31 +#ifndef __CONFIG_H
   23.32 +#define __CONFIG_H
   23.33 +
   23.34 +
   23.35 +// ------------------------------------------------------------
   23.36 +// check defs (headers only)
   23.37 +
   23.38 +
   23.39 +// standard C headers
   23.40 +#cmakedefine HAVE_STDIO_H 1
   23.41 +#cmakedefine HAVE_STDDEF_H 1
   23.42 +#cmakedefine HAVE_STDLIB_H 1
   23.43 +#cmakedefine HAVE_INTTYPES_H 1
   23.44 +#cmakedefine HAVE_MEMORY_H 1
   23.45 +#cmakedefine HAVE_STRING_H 1
   23.46 +#cmakedefine HAVE_UNISTD_H 1
   23.47 +
   23.48 +// stdbool.h
   23.49 +#cmakedefine HAVE_STDBOOL_H 1
   23.50 +
   23.51 +// endian.h
   23.52 +#cmakedefine HAVE_ENDIAN_H 1
   23.53 +
   23.54 +// time system headers
   23.55 +#cmakedefine HAVE_SYS_TIME_H 1
   23.56 +#cmakedefine HAVE_SYS_TIMES_H 1
   23.57 +#cmakedefine HAVE_TIME_H 1
   23.58 +
   23.59 +// files
   23.60 +#cmakedefine HAVE_FCNTL_H 1
   23.61 +#cmakedefine HAVE_SYS_STAT_H 1
   23.62 +
   23.63 +
   23.64 +// some math
   23.65 +#cmakedefine HAVE_MATH_H 1
   23.66 +
   23.67 +// networking
   23.68 +#cmakedefine HAVE_NETDB_H 1
   23.69 +#cmakedefine HAVE_IFADDRS_H 1
   23.70 +#cmakedefine HAVE_NETINET_IN_H 1
   23.71 +#cmakedefine HAVE_ARPA_INET_H 1
   23.72 +#cmakedefine HAVE_SYS_SOCKET_H 1
   23.73 +#cmakedefine HAVE_SYS_UN_H 1
   23.74 +
   23.75 +// assert.h
   23.76 +#cmakedefine HAVE_ASSERT_H 1
   23.77 +
   23.78 +// signal.h
   23.79 +#cmakedefine HAVE_SIGNAL_H 1
   23.80 +
   23.81 +// sys/uio.h
   23.82 +#cmakedefine HAVE_SYS_UIO_H 1
   23.83 +
   23.84 +// syslog.h
   23.85 +#cmakedefine HAVE_SYSLOG_H 1
   23.86 +
   23.87 +// errno.h
   23.88 +#cmakedefine HAVE_ERRNO_H 1
   23.89 +
   23.90 +// limits.h
   23.91 +#cmakedefine HAVE_LIMITS_H 1
   23.92 +
   23.93 +// memory management
   23.94 +#cmakedefine HAVE_SYS_MMAN_H 1
   23.95 +
   23.96 +// directory entries
   23.97 +#cmakedefine HAVE_DIRENT_H 1
   23.98 +
   23.99 +// sys/uio.h
  23.100 +#cmakedefine HAVE_SYS_UIO_H 1
  23.101 +
  23.102 +// iconv.h
  23.103 +#cmakedefine HAVE_ICONV_H 1
  23.104 +
  23.105 +// fuse
  23.106 +#cmakedefine HAVE_FUSE_H 1
  23.107 +
  23.108 +
  23.109 +#endif
  23.110 +
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/ait/os/etc/dbus-1/system.d/at.ac.ait.opensecurity.AutoShadow.conf	Tue Nov 12 11:31:34 2013 +0100
    24.3 @@ -0,0 +1,24 @@
    24.4 +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
    24.5 + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
    24.6 +<busconfig>
    24.7 +
    24.8 +    <policy user="root">
    24.9 +        <allow own="at.ac.ait.opensecurity.AutoShadow"/>
   24.10 +        <allow send_destination="at.ac.ait.opensecurity.AutoShadow"/>
   24.11 +        <allow receive_sender="at.ac.ait.opensecurity.AutoShadow"/>
   24.12 +    </policy>
   24.13 +
   24.14 +    <policy context="default">
   24.15 +    
   24.16 +        <allow send_destination="at.ac.ait.opensecurity.AutoShadow"
   24.17 +            send_interface="org.freedesktop.DBus.Introspectable"/>
   24.18 +
   24.19 +        <allow send_destination="at.ac.ait.opensecurity.AutoShadow"
   24.20 +            send_interface="org.freedesktop.DBus.Peer"/>
   24.21 +            
   24.22 +        <allow send_destination="at.ac.ait.opensecurity.AutoShadow"
   24.23 +            send_interface="at.ac.ait.opensecurity.AutoShadow"/>
   24.24 +            
   24.25 +    </policy>
   24.26 +    
   24.27 +</busconfig>
    25.1 Binary file ait/os/share/opensecurity/192.168.56.15-putty.reg has changed
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/ait/os/share/opensecurity/192.168.56.15.ppk	Tue Nov 12 11:31:34 2013 +0100
    26.3 @@ -0,0 +1,26 @@
    26.4 +PuTTY-User-Key-File-2: ssh-rsa
    26.5 +Encryption: none
    26.6 +Comment: rsa-key-20131029
    26.7 +Public-Lines: 6
    26.8 +AAAAB3NzaC1yc2EAAAABJQAAAQEAgagcKFpJsMZduqucGZR0HmG2tNaUyrccmYzg
    26.9 +aAn5B/6o7jrArnTyAVdcQrrcUEN2zFfXMg36+JP1thoDaI1LkL3U+0ikdDkYq5hZ
   26.10 +WWOv9a9AJPDma5Ah/oxfmqqSv6spiUYQl2B72iuCvDnTMT1J7tUiy8UoRk/LxF+h
   26.11 +YIJyRxMrNTa8M5CU8Oqu2KF+PM4pk9sX70Oyci9uln1xUOg2lmjg8qf7ENwMx0G9
   26.12 +0YMtPssaPlqQrBr1w0SIOhT/975SclNyVcGZaZc+VC3x3Uc1X1XJJRtFc+GFjcBd
   26.13 +DMaocZ2dxXcrM2XQdKfIg3PnRwiu7DSV7G2nepF+uXpTNAxTXQ==
   26.14 +Private-Lines: 14
   26.15 +AAABAHck25qz1QNOf6SdsgmrAut8YrQDc/iMltJKGlHD+Zik0pW5csnTPz+AtaUa
   26.16 +aZXdIQ7NQkmr+2D2qm/8OnvAG+zKHaijngnvRxo4+CigyzTKjfhuqjlUA4/2nQqq
   26.17 +lLAgvmJ3vDgTeLqkhfkSiregGmzD2skWCVVeFTD97j0CP3+Tw20QJqJXvFHvbeVh
   26.18 +BjeooKWt559lJnDP9dfvTlo75pAYXSnEr6ALiZurGm6q3pmop2p3USBwrCr8Mu8D
   26.19 +3xuBXDw/cvcpeunl2UiRPYvXa8Mj0ewEPNfXJ3WaxQggmHcmUfDgbaXRpJcZKjAS
   26.20 +wfFsOGBTEJ8BKRmj+M0nEBQkGcUAAACBAMJHU5yzi5F9ybZTG0mxoWSNaa+8M03q
   26.21 +nRV7Wl+KMP0N+p5ZzDyLIdGyLSKaKqc0soSTzqQpJ6ky72yJJ6ovU9PJUK6eKnIR
   26.22 +HtQEd6XhCCWdCBEUsk3PKiIR4GePZhikFFl97l8M30by5JUwPSX6SDh0F3DSd2zz
   26.23 +j8eroHzISyozAAAAgQCq2RVPz1o+Cue1on6AmeY0UiUZUOYVDM4n7GJpr9BkRflk
   26.24 +vjpo0AgHNviF+yYbU9H9mJGbwYe+YY3zUnguSJn0o66ofXGK/5TfvPofmMWS9XmP
   26.25 +2tzTjKeabNWmmi4IAJRFdhwYl7j8CoIrD9cMXJ2EaaSiEpMVVIP7H4muVdYcLwAA
   26.26 +AIEAn/bZoFIGO5x8WaRlRLGN+v0bbfHiQ+zalLVCu8XqSaB5+THDUZClRdYhj8bO
   26.27 +zzfqyI9er04a74QjIPOpyUjy8uoYW0bJvVudD47GhezTDImopmvcrRiTLlG8khit
   26.28 +ZyznRaMcu6N/izFreCI1yeXnOMPtaAP+snRsUFwUGlpTe08=
   26.29 +Private-MAC: 050a2bfd9bac2d354384390ab8a180857c4442c4
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/ait/os/share/opensecurity/192.168.56.15.pub	Tue Nov 12 11:31:34 2013 +0100
    27.3 @@ -0,0 +1,1 @@
    27.4 +ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAgagcKFpJsMZduqucGZR0HmG2tNaUyrccmYzgaAn5B/6o7jrArnTyAVdcQrrcUEN2zFfXMg36+JP1thoDaI1LkL3U+0ikdDkYq5hZWWOv9a9AJPDma5Ah/oxfmqqSv6spiUYQl2B72iuCvDnTMT1J7tUiy8UoRk/LxF+hYIJyRxMrNTa8M5CU8Oqu2KF+PM4pk9sX70Oyci9uln1xUOg2lmjg8qf7ENwMx0G90YMtPssaPlqQrBr1w0SIOhT/975SclNyVcGZaZc+VC3x3Uc1X1XJJRtFc+GFjcBdDMaocZ2dxXcrM2XQdKfIg3PnRwiu7DSV7G2nepF+uXpTNAxTXQ== rsa-key-20131029
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/ait/os/share/opensecurity/OpenSecurity.reg	Tue Nov 12 11:31:34 2013 +0100
    28.3 @@ -0,0 +1,9 @@
    28.4 +Windows Registry Editor Version 5.00
    28.5 +
    28.6 +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
    28.7 +"VM-Start"="wscript C:\\Distribution\\OpenSecurity\\bin\\vm-start.vbs"
    28.8 +"Xming"="\"C:\\Program Files\\Xming\\Xming.exe\" +bs -multiwindow"
    28.9 +"OpenSecurityD"="\"C:\\Python27\\pythonw.exe\" C:\\Distribution\\OpenSecurity\\bin\\opensecurityd.py"
   28.10 +
   28.11 +[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
   28.12 +"OpenSecurity-Tray"="\"C:\\Python27\\pythonw.exe\" C:\\Distribution\\OpenSecurity\\bin\\opensecurity-tray.py"
    29.1 Binary file ait/os/share/opensecurity/gfx/ait_logo.jpg has changed
    30.1 Binary file ait/os/share/opensecurity/gfx/ait_logo_no_claim.png has changed
    31.1 Binary file ait/os/share/opensecurity/gfx/bmvit_logo.jpg has changed
    32.1 Binary file ait/os/share/opensecurity/gfx/ffg_logo.jpg has changed
    33.1 Binary file ait/os/share/opensecurity/gfx/ikarus_logo.jpg has changed
    34.1 Binary file ait/os/share/opensecurity/gfx/kiras_logo.jpg has changed
    35.1 Binary file ait/os/share/opensecurity/gfx/linz_logo.jpg has changed
    36.1 Binary file ait/os/share/opensecurity/gfx/liqua_logo.jpg has changed
    37.1 Binary file ait/os/share/opensecurity/gfx/opensecurity.ico has changed
    38.1 Binary file ait/os/share/opensecurity/gfx/opensecurity_icon_64.png has changed
    39.1 Binary file ait/os/share/opensecurity/gfx/opensecurity_logo.jpg has changed
    40.1 Binary file ait/os/share/opensecurity/gfx/x-net_logo.jpg has changed