Using the Tcl VFS for Encryption



Similar documents
php-crypto-params Documentation

Key Management Interoperability Protocol (KMIP)

AN AES encryption and decryption software on LPC microcontrollers. Document information

ProTrack: A Simple Provenance-tracking Filesystem

Encrypt-FS: A Versatile Cryptographic File System for Linux

MatrixSSL Developer s Guide

PGP Portable Quick Start Guide Version 10.2

Open Source Encrypted Filesystems for Free Unix Systems

Magento Search Extension TECHNICAL DOCUMENTATION

SkyRecon Cryptographic Module (SCM)

Password-based encryption in ZIP files

Practice Fusion API Client Installation Guide for Windows

SMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2

Agent Languages. Overview. Requirements. Java. Tcl/Tk. Telescript. Evaluation. Artificial Intelligence Intelligent Agents

Project: Simulated Encrypted File System (SEFS)

PHP Integration Kit. Version User Guide

About This Document 3. Integration and Automation Capabilities 4. Command-Line Interface (CLI) 8. API RPC Protocol 9.

A Mechanism for VHDL Source Protection

WS_FTP Professional 12. Security Guide

YOUR DATA UNDER SIEGE. DEFEND IT WITH ENCRYPTION.

SiteCelerate white paper

UNIX File Management (continued)

Test Automation Integration with Test Management QAComplete

Web Application Report

Key Management Interoperability Protocol (KMIP)

VERITAS NetBackup 6.0 Encryption

Technical Overview Simple, Scalable, Object Storage Software

Qualtrics Single Sign-On Specification

EKT 332/4 COMPUTER NETWORK

Secure Web Application Coding Team Introductory Meeting December 1, :00 2:00PM Bits & Pieces Room, Sansom West Room 306 Agenda

Global security intelligence. YoUR DAtA UnDeR siege: DeFenD it with encryption. #enterprisesec kaspersky.com/enterprise

Comodo Disk Encryption

Protecting Data-at-Rest with SecureZIP for DLP

USING STUFFIT DELUXE THE STUFFIT START PAGE CREATING ARCHIVES (COMPRESSED FILES)

Configuring Backup Settings. Copyright 2009, Oracle. All rights reserved.

Design Notes for an Efficient Password-Authenticated Key Exchange Implementation Using Human-Memorable Passwords

Threat Modeling a SharePoint Application: An exploratory exercise in preventing data breaches and theft.

BlackBerry Enterprise Service 10. Secure Work Space for ios and Android Version: Security Note

Transparent Cryptographic File System for BSD. A primer. Luigi Catuogno [luicat@tcfs.unisa.it]

Java Application Developer Certificate Program Competencies

Acronis Backup & Recovery: Events in Application Event Log of Windows

SSL Tunnels. Introduction

How To Test The Bandwidth Meter For Hyperv On Windows V (Windows) On A Hyperv Server (Windows V2) On An Uniden V2 (Amd64) Or V2A (Windows 2

Criteria for web application security check. Version

McAfee Web Gateway Administration Intel Security Education Services Administration Course Training

Using weblock s Servlet Filters for Application-Level Security

HTTP connections can use transport-layer security (SSL or its successor, TLS) to provide data integrity

Linux LKM Firewall v 0.95 (2/5/2010)

Leak Check Version 2.1 for Linux TM

SubmitedBy: Name Reg No Address. Mirza Kashif Abrar T079 kasmir07 (at) student.hh.se

DiamondStream Data Security Policy Summary

RECOVER ( 8 ) Maintenance Procedures RECOVER ( 8 )

How To Secure My Data

Design: Metadata Cache Logging

AES Crypt User Guide

Dove User Guide Copyright Virgil Trasca

Version Control. Luka Milovanov

Managed Encryption Service

Storing Encrypted Plain Text Files Using Google Android

Introduction to the. Barracuda Embedded Web-Server

Red Hat Certifications: Red Hat Certified System Administrator (RHCSA)

Table of Contents. 1 Overview 1-1 Introduction 1-1 Product Design 1-1 Appearance 1-2

Secure Web Appliance. Reverse Proxy

Lecture 11 Web Application Security (part 1)

Introduction to WebSphere Administration

Course Number: IAC-SOFT-WDAD Web Design and Application Development

CheckPoint FireWall-1 Version 3.0 Highlights Contents

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)

Overview of Banking Application Security and PCI DSS Compliance for Banking Applications

COSC 6397 Big Data Analytics. Distributed File Systems (II) Edgar Gabriel Spring HDFS Basics

How To Get To A Cloud Storage And Byod System

WHITE PAPER. FortiWeb and the OWASP Top 10 Mitigating the most dangerous application security threats

Database Encryption Design Considerations and Best Practices for ASE 15

Designing a Cloud Storage System

UniFinger Engine SDK Manual (sample) Version 3.0.0

LSKA 2010 Survey Report I Device Drivers & Cloud Computing

Exploiting Local File Inclusion in A Co-Hosting Environment

FileBench's Multi-Client feature

Use Enterprise SSO as the Credential Server for Protected Sites

Integrating with BarTender Integration Builder

How To Install An Aneka Cloud On A Windows 7 Computer (For Free)

System Calls Related to File Manipulation

Survey of Filesystems for Embedded Linux. Presented by Gene Sally CELF

What is included in the ATRC server support

The FOSSology Project Overview and Discussion. » The Open Compliance Program. ... By Bob Gobeille, Hewlett-Packard

Application for Splunk Enterprise

Using EDA Databases: Milkyway & OpenAccess

Network Attached Storage. Jinfeng Yang Oct/19/2015

Considerations In Developing Firewall Selection Criteria. Adeptech Systems, Inc.

SNMP SECURITY A CLOSER LOOK JEFFERY E. HAMMONDS EAST CAROLINA UNIVERSITY ICTN 6865

SafeNet MSSQL EKM Provider User Guide

Xerox DocuShare Security Features. Security White Paper

IP Security. Ola Flygt Växjö University, Sweden

1. Overview of Nios II Embedded Development

Online signature API. Terms used in this document. The API in brief. Version 0.20,

Transcription:

Using the Tcl VFS for Encryption By Phil Brooks - Mentor Graphics Corporation & Arman Hunanyan - Mentor Graphics Corporation Presented at the 22 nd annual Tcl/Tk conference, Manassas Virginia, October 2015 Mentor Graphics Corporation 8005 Boeckman Road Wilsonville, Oregon 97070 phil_brooks@mentor.com arman_hunanyan@mentor.com Abstract: In today's world of constant hacker and security threats, the Tcl VFS Interface provides a mechanism whereby Tcl scripted applications that are previously unaware of security and encryption concerns can transparently access both data files and Tcl modules from an encrypted container file without modifying the application specific file accesses. This mechanism allows data residing on disc to be strongly encrypted while it can be transparently accessed from a Tcl application that has the appropriate decryption keys to access the data transparently through normal Tcl file accesses. We examine CalVFS, an implementation that allows users of Mentor Graphic's Calibre electronic circuit verification tool to encrypt sensitive user information in such a way that it can be transparently accessed by the Calibre application. Motivation Mentor Graphics Calibre product line has a large number of customers and suppliers that provide extensions to our solutions that are specific to various

integrated circuit foundries and design technologies. These groups are often providing proprietary extensions in the form of design files, data models, Tcl scripts, and Calibre rules files that their customers use in conjunction with our tools to build complete design solutions. The CalVFS system serves as a mechanism that these intermediate suppliers can use to securely encapsulate their design solutions and deliver them through to end users. Using this system, they build an encapsulated.calzip file that contains encrypted data files and Tcl scripts, deliver that file to end users who can then run the full design solution. The advantage of the CalVFS system and its implementation on top of Tcl s VFS filesystem support is that scripts that were developed independently of any knowledge of the.calzip file or how to get at its contents can seamlessly access data and run Tcl scripts using the system. The.calzip files provide transparent read-only access to their contents within the Calibre runtime process through the Tcl VFS filesystem. There is not a lot of documentation of the Tcl VFS or examples of its usage. As a result, we are providing this paper as a summary of our experiences developing an interface that uses the VFS in a manner that may be compelling to other developers. Tcl VFS Overview The Tcl Virtual File System (VFS) provides a low level C api through which all regular Tcl file mechanisms (things like open, read, and seek as well as higher level commands like source and glob) are routed. This abstraction allows a simple point of access that allows you to make up your own mechanism for supplying the data that any Tcl script can simply view as a bunch of regular file accesses. Tcl_FS* Functions The basic implementation of the Tcl VFS is through the Tcl_Filesystem structure and a group of functions that all start with Tcl_FS. The Tcl_Filesystem structure aggregates a group of functions that provide the underlying functionality of a particular filesystem implementation, and the Tcl_FS* functions allow installation, management and destruction of filesystem implementations as well as safe C level access to VFS filesystem functionality that would be short circuited by direct use of the C filesystem routines like stat(), access(), read() etc. For example, using the stat() function call directly from C will not reflect any VFS filesystems installed,

while use of TclFSStat will. The Tcl_FS* functions also provide consistent behavior across platforms (to the extent possible). The Tcl_FS functions provide a wide array of file related functionality. Highlights of the C level function are provided below, a full list of the functions (from the Tcl FileSystem man page) is provided in the appendix: File Access: Direct access and manipulation of a file and its contents is provided by a number of functions like Tcl_FSOpenFileChannel, Tcl_FSStat and Tcl_FSAccess. Directory Manipulation Directories,their contents, symbolic links, etc. can be accessed and manipulated using functions like Tcl_FSMatchInDirectory, Tcl_FSGetCwd, Tcl_FSChdir, Tcl_FSLink, Tcl_FSCreateDirectory and Tcl_FSUtime. File Path manipulation and construction Platform independent construction and manipulation of file paths are provided by functions like Tcl_FSPathSeparator, Tcl_FSNormalizePath, Tcl_FSJoinPath, and Tcl_FSSplitPath. VFS construction, manipulation and maintenance The VFS filesystem implementations themselves use functions like Tcl_FSRegister, TclFSUnregister, Tcl_FSData and TclFSMountsChanged to install and maintain VFS Filesystems. Tcl_Filesystem structure The Tcl_Filesystem structure contains pointers to functions that implement underlying VFS filesystem operations. Many of them correspond directly to Tcl_FS* functions listed above. These functions are called by the underlying Tcl when an installed VFS path is accessed through Tcl commands or the Tcl_FS* interfaces. One important function in the structure is the Tcl_FSPathInFilesystemProc. This function is the key mechanism by which a VFS filesystem identifies files that belong to it. The remaining functions can similarly be grouped according to function. The full structure is presented in the appendix.

File Access: Tcl_FSOpenFileChannelProc, TclFSStatProc, and Tcl_FSAccessProc. Tcl_FSOpenFileChannelProc is important to us in that the Tcl channel interface is used to return decrypted data to the end user. Directory Manipulation: TclFSMatchInDirectoryProc, Tcl_FSGetCwdProc, Tcl_FSChdirProc, Tcl_FSLinkProc, Tcl_FSCreateDirectoryProc, and Tcl_FSUtimeProc. File Path manipulation and construction Tcl_FSPathSeparatorProc, Tcl_FSNormalizePathProc. Tcl_FSJoinPath and TclFSSplitPath are algorithmically implemented and does not interact with an installed VFS. vfs:: Active Tcl package Provided with ActiveTcl, or available from SourceForge, the vfs:: package provides a number of vfs implementations. It consists of three parts: 1. vfs the vfs::filesystem commands allow mount, unmounts and manipulation of vfs filesystems. 2. vfs-filesystems: Several useful filesystems: zip, mk4, tar, ftp, ns, webdav, http, urltype 3. vfs-fsapi the interface for creating a filesystem. This allows you to write a command ensemble that supports access to a vfs filesystem Tcl Encryption Overview Many encryption packages are available for Tcl. The following are available with Tcllib: blowfish: http://tcllib.sourceforge.net/doc/blowfish.html aes: http://tcllib.sourceforge.net/doc/aes.html des (including triple des): http://tcllib.sourceforge.net/doc/des.html rc4: http://tcllib.sourceforge.net/doc/rc4.htmltcl Here is a des example: package require des set key "12345678"; # Must be 8 bytes long

set msg "abcde" ##### ENCRYPTION set encryptedmsg [DES::des -dir encrypt -key $key $msg] # $encryptedmsg is a bunch of bytes; you'll want to send this around... ##### DECRYPTION set decryptedmsg [DES::des -dir decrypt -key $key $encryptedmsg] puts "I got '$decryptedmsg'" Also more complicated, but with a lot of different components and interfaces: Cryptkit - www.patthoyts.tk/programming/cryptkit.pdf The encryption packages can be coupled with a Tcl Channel. This allows us to build a channel that does decryption and writes to a channel as it reads from an encrypted input channel. For example, the aes, blowfish, DES and rc4 packages all support in <channel> and out <channel> arguments when the channel object is created. Combining VFS and Encryption By building a decryption channel described above in the Tcl_FSOpenFileChannelProc function that is part of the Tcl_Filesystem api, a transparent read capability is created. As a result, Tcl code can transparently access objects in the.calzip filesystem: set fd [ open foo/bar.calzip/text_file.txt ] set buf [ read $fd ] source foo/bar.calzip/datafile.tcl

Calibre VFS Limitations of our implementation Since the target usage scenario for CalVFS is a supplier creates an archive, ships it to end users who then have read only access to the archive or write once, read many delivery, the implementation only implements a readonly file system. Also, it does not support symbolic links. While the Tcl_Filesystem interface calls for implementation of more of the filesystem interfaces, we found that a perfectly workable read-only filesystem can be implemented with only the following interfaces: pathinfilesystemproc identifies files that are part of the VFS statproc provides information similar to stat() accessproc - provides information similar to access() openfilechannelproc implements the read channel for files in the filesystem Mounts Anyone? The vfs:: package requires an explicit mount with a directory to enable a filesystem. In our use model, we don t know beforehand where the.calzip files will be. The user simply specifies a path name that may or may not include a.calzip archive. The Virual filesystem API doesn t specifically require a mount point, however. Instead, the CalVFS function that implements Tcl_FSPathInFilesystemProc (part of the Tcl_Filesystem structure) responds to a query signifying whether a particular path name is part of the CalVFS filesystem or not. The files are identified by examining the filepath and looking for.calzip archives along the path. Once a.calzip archive is identified, it is opened by the CalVFS filesystem implementation and its contents are transparently accessed. The automatic mounting mechanism also allows.calzip archives to access other external archives through relative paths. For example: If we have the following files: archive.calzip archive foo/demo1.calzip which contains a directory dir1/dir2 archive foo/demo2.calzip which contains the file dir3/dir4/file a regular file foo/bar/file that is outside of any archive

Then automatic mounting will allow to access through arbitrary paths like these: foo/demo1.calzip/dir1/dir2/../../../demo2.calzip/dir3/dir4/file foo/demo1.calzip/dir1/dir2/../../../demo2.calzip/dir3/dir4/../../../bar/file In both cases path access will force automatic mount of both the demo1.calzip and demo2.calzip archives. This will allow inclusion of source Tcl files or data files files from outside VFS. Nesting CalVFS archives can also be contained inside of one another. ACLs and permissions on contained archives can be different from one another. So the above case can also similarly work when the two archives are nested one inside the other: archive.calzip archive foo/demo1.calzip which contains a directory dir1/dir2 archive demo2.calzip which contains the file dir3/dir4/file is contained inside dir1 of demo1.calzip a regular file foo/bar/file that is outside of any archive Then automatic mounting will allow to access through arbitrary paths like these: foo/demo1.calzip/dir1/demo2.calzip/dir3/dir4/file foo/demo1.calzip/dir1/dir2/../demo2.calzip/dir3/dir4/../../../../../bar/file In these cases path access will also force automatic mount of both the demo1.calzip and demo2.calzip archives. Write/Encode Process Files are encoded in a simple serial archival process similar to what Zip or Tar would use. The files are encrypted as they are written into the archive. Contained.calzip files are simply copied into a containing archive.

Read/Decode Process Files are decoded in 1064 byte chunks and their decode state is maintained in conjunction with the channel that is currently reading from them. Offsets and intermediate decryption information are also maintained inside of the channel object. Seek Seek functionality is limited and can seeking can have performance implications since the decryption state must be maintained from a known starting point. When seek moves the current position of the channel away from its current point, access must start at a known starting point and continue forward to the seek position. Optimizations are possible if multiple starting points are possible for the encrypted file as in some block based encoding schemes. Access Control As described thus far, any Tcl interpreter running in the calibre process has full access to all of the files in the.calzip archive. One goal of the system is to provide at least some level of protection between the.calzip contents and prying eyes of the end user. (Note that complete protection cannot be provided due to the DVD problem i.e. if you have a well encrypted file and a box that can decode that file and a sufficiently sophisticated user with sufficient access to the insides of the box, the user can discover how to decrypt the file without using the box.) To that end, the CalVFS system uses a system of Access Control Lists to vary what type of access it will allow to which interpreters in the system. That way, a specific vendor s.calzip file can get its own dedicated interpreter that has access to the.calzip contents while other interpreters in the same running process are denied access to the same.calzip file. Development Mode Since the filesystem functionality of the.calzip archive is limited and different from normal file accesses in a regular filesystem, there is a potential debugging issue for developers that intent to deliver.calzip archives: If an application depends upon functionality not available in the CalVFS while they are developing the application using the regular filesystem, they will not discover that dependency until they go to the final stage

of creating the.calzip archive and then testing their application in that environment. Examples of functionality that they might depend upon includes erroneously expecting write access, or expecting meaningful symlinks inside of a.calzip archive, there would be no issue with doing that as long as the user was working in the regular filesystem, but when they create the.calzip archive, then the problem would become apparent. In order to facilitate simple development, testing, debugging and deployment, a development mode for the CalVFS filesystem allows the user to tag a development directory as being part of a CalVFS filesystem without actually creating the archive. Then accesses within the directory will carry the same limitations as they would if that directory were actually inside of a.calzip archive. In the final delivery state, the.calzip archive is, by default, very opaque. As a result, there are a number of other debugging features that allow a developer to control for more or less transparency into the contents of the.calzip archive during runtime. Conclusions The Tcl VFS system provides a highly functional interface that allows support for new filesystem functionality in applications that are using regular Tcl file accesses. Encryption libraries present in Tcl can be combined with the VFS filesystem access to provide transparent access to encrypted directories of files by combining elements of a zip or tar archive with encryption and the VFS.

Acknowledgements Special thanks to Fedor Pikus for helping develop the underlying filesystem semantics. Tcl_Filesystem and Tcl_FS* functions Full information is available at the following URL: https://www.tcl.tk/man/tcl8.6/tcllib/filesystem.htm The full list of Tcl_FS* functions available in Tcl 8.6 are: Tcl_FSRegister, Tcl_FSUnregister, Tcl_FSData, Tcl_FSMountsChanged, Tcl_FSGetFileSystemForPath, Tcl_FSGetPathType, Tcl_FSCopyFile, Tcl_FSCopyDirectory, Tcl_FSCreateDirectory, Tcl_FSDeleteFile, Tcl_FSRemoveDirectory, Tcl_FSRenameFile, Tcl_FSListVolumes, Tcl_FSEvalFile, Tcl_FSEvalFileEx, Tcl_FSLoadFile, Tcl_FSUnloadFile, Tcl_FSMatchInDirectory, Tcl_FSLink, Tcl_FSLstat, Tcl_FSUtime, Tcl_FSFileAttrsGet, Tcl_FSFileAttrsSet, Tcl_FSFileAttrStrings, Tcl_FSStat, Tcl_FSAccess, Tcl_FSOpenFileChannel, Tcl_FSGetCwd, Tcl_FSChdir, Tcl_FSPathSeparator, Tcl_FSJoinPath, Tcl_FSSplitPath, Tcl_FSEqualPaths, Tcl_FSGetNormalizedPath, Tcl_FSJoinToPath, Tcl_FSConvertToPathType, Tcl_FSGetInternalRep, Tcl_FSGetTranslatedPath, Tcl_FSGetTranslatedStringPath, Tcl_FSNewNativePath, Tcl_FSGetNativePath, Tcl_FSFileSystemInfo, Tcl_GetAccessTimeFromStat, Tcl_GetBlockSizeFromStat, Tcl_GetBlocksFromStat, Tcl_GetChangeTimeFromStat, Tcl_GetDeviceTypeFromStat, Tcl_GetFSDeviceFromStat, Tcl_GetFSInodeFromStat, Tcl_GetGroupIdFromStat, Tcl_GetLinkCountFromStat, Tcl_GetModeFromStat, Tcl_GetModificationTimeFromStat, Tcl_GetSizeFromStat, Tcl_GetUserIdFromStat, Tcl_AllocStatBuf

The Tcl_Filesystem structure: typedef struct Tcl_Filesystem { const char *typename; int structurelength; Tcl_FSVersion version; Tcl_FSPathInFilesystemProc *pathinfilesystemproc; Tcl_FSDupInternalRepProc *dupinternalrepproc; Tcl_FSFreeInternalRepProc *freeinternalrepproc; Tcl_FSInternalToNormalizedProc *internaltonormalizedproc; Tcl_FSCreateInternalRepProc *createinternalrepproc; Tcl_FSNormalizePathProc *normalizepathproc; Tcl_FSFilesystemPathTypeProc *filesystempathtypeproc; Tcl_FSFilesystemSeparatorProc *filesystemseparatorproc; Tcl_FSStatProc *statproc; Tcl_FSAccessProc *accessproc; Tcl_FSOpenFileChannelProc *openfilechannelproc; Tcl_FSMatchInDirectoryProc *matchindirectoryproc; Tcl_FSUtimeProc *utimeproc; Tcl_FSLinkProc *linkproc; Tcl_FSListVolumesProc *listvolumesproc; Tcl_FSFileAttrStringsProc *fileattrstringsproc; Tcl_FSFileAttrsGetProc *fileattrsgetproc; Tcl_FSFileAttrsSetProc *fileattrssetproc; Tcl_FSCreateDirectoryProc *createdirectoryproc; Tcl_FSRemoveDirectoryProc *removedirectoryproc; Tcl_FSDeleteFileProc *deletefileproc; Tcl_FSCopyFileProc *copyfileproc; Tcl_FSRenameFileProc *renamefileproc; Tcl_FSCopyDirectoryProc *copydirectoryproc; Tcl_FSLstatProc *lstatproc; Tcl_FSLoadFileProc *loadfileproc; Tcl_FSGetCwdProc *getcwdproc; Tcl_FSChdirProc *chdirproc; } Tcl_Filesystem;