Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for more file types + archlinux packaging #9

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c88440a
rebase makefile with master (adding python3 variable)
neowutran Oct 30, 2020
afeedad
remove old gui option
neowutran Jul 16, 2020
9cbb457
add ci requirements for libreoffice api and mimetype detection
neowutran Jul 16, 2020
c2bbaf1
fix ci requirement file-magic
neowutran Jul 16, 2020
0e75965
first attempt to fix zenity progress bar
neowutran Jul 20, 2020
2391e16
attempt to fix zenity progress bar - 1 class for Zenity and 1 class f…
neowutran Jul 21, 2020
373ec90
use alternative way to create the UNO object 'PropertyValue'. It chan…
neowutran Jul 22, 2020
3d5a6fe
Try to fix CI build, missing libreoffice UNO dependency
neowutran Jul 22, 2020
85242ca
Try to fix CI build, missing libreoffice UNO dependency - Attempt 2
neowutran Jul 22, 2020
2387775
Try to fix CI build, missing libreoffice UNO dependency - Attempt 3
neowutran Jul 22, 2020
f5d22ec
Try to fix CI build, missing libreoffice UNO dependency - last attempt
neowutran Jul 22, 2020
c3b950e
add the gui option to the manpage
neowutran Jul 25, 2020
17afefc
fixes related to the second code review of pull request #9
neowutran Jul 31, 2020
6c617ea
replace os.rename/remove with Path
neowutran Aug 2, 2020
74d3704
Try to fix ci build, missing libreoffice UNO dependency
neowutran Aug 5, 2020
7a64d90
Try to fix ci build, missing libreoffice UNO dependency
neowutran Aug 5, 2020
a30a66a
Try to fix ci build, missing libreoffice UNO dependency - changing st…
neowutran Aug 5, 2020
b9c1f42
fix a logic issue for password protected pdf + pass the PATH env vari…
neowutran Mar 16, 2021
ee901a6
workaround for the libreoffice change of behavior when handling password
neowutran Mar 18, 2021
373c537
Merge remote-tracking branch 'qubes/master'
neowutran Mar 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import:
- source: QubesOS/qubes-continuous-integration:R4.1/travis-dom0-r4.1.yml
- source: QubesOS/qubes-continuous-integration:R4.0/travis-dom0-r4.0.yml
- source: QubesOS/qubes-continuous-integration:R4.1/travis-vms-r4.1.yml

jobs:
include:
- language: python
language: python
python:
- '3.7'
install:
Expand Down
21 changes: 15 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# The Qubes OS Project, http://www.qubes-os.org
# The Qubes OS Project, https://www.qubes-os.org
#
# Copyright (C) 2013 Joanna Rutkowska <[email protected]>
#
Expand All @@ -20,12 +20,12 @@
#

PYTHON ?= python3
PANDOC=pandoc -s -f markdown -t man
NAME := convert-pdf

build:
make manpages -C doc

install-vm:
make install -C doc
install-vm: build
install -d $(DESTDIR)/usr/share/man/man1
install -D qvm-$(NAME).1.gz $(DESTDIR)/usr/share/man/man1/
$(PYTHON) setup.py install -O1 $(PYTHON_PREFIX_ARG) --root $(DESTDIR)
install -d $(DESTDIR)/etc/qubes-rpc
ln -s ../../usr/lib/qubes/qpdf-convert-server $(DESTDIR)/etc/qubes-rpc/qubes.PdfConvert
Expand All @@ -41,6 +41,15 @@ install-dom0:
rm -f $(DESTDIR)/usr/bin/qvm-convert-pdf
rm -f $(DESTDIR)/usr/lib/qubes/qpdf-convert-server

qvm-$(NAME).1: README.md
$(PANDOC) $< > $@

qvm-$(NAME).1.gz: qvm-$(NAME).1
gzip -f $<

build: qvm-$(NAME).1.gz

clean:
rm -rf debian/changelog.*
rm -rf pkgs
rm -f qvm-$(NAME).1.gz
1 change: 1 addition & 0 deletions Makefile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ else ifeq ($(PACKAGE_SET),vm)
ifeq ($(filter $(DIST), stretch jessie centos7),)
DEBIAN_BUILD_DIRS := debian
RPM_SPEC_FILES := rpm_spec/qpdf-converter.spec
ARCH_BUILD_DIRS := archlinux
endif
endif

Expand Down
72 changes: 51 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,64 @@
Qubes PDF Converter
====================
% QVM-CONVERT-PDF(1) | User Commands

Qubes PDF converter is a [Qubes](https://qubes-os.org) Application that
utilizes Disposable VMs and Qubes' flexible qrexec (inter-VM communication)
infrastructure to securely convert potentially untrusted PDF files into
NAME
===============
qvm-convert-pdf - converts a potentially untrusted file to a safe-to-view pdf

SYNOPSIS
===============
**qvm-convert-pdf** [_OPTION_]... [_FILE_]...

DESCRIPTION
==============
Qubes PDF converter is a [Qubes](https://qubes-os.org) Application, which utilizes Qubes flexible qrexec
(inter-VM communication) infrastructure and Disposable VMs to perform conversion
of potentially untrusted (e.g. maliciously malformed) files into
safe-to-view PDF files.

This is done by having a Disposable VM render each page of a PDF file into a
very simple representation (RGB bitmap) that (presumably) leaves no room for
malicious code. This representation is then sent back to the client AppVM which
then constructs an entirely new PDF file out of the received bitmaps.
This is done by having the Disposable VM perform the complex (and potentially
buggy) rendering of the PDF in question) and sending the resulting RGB bitmap
(simple representation) to the client AppVM. The client AppVM can _trivially_
verify the received data are indeed the simple representation, and then
construct a new PDF out of the received bitmap. Of course the price we pay for
this conversion is loosing any structural information and text-based search in
the converted PDF.

More discussion and introduction of the concept has been described in the original article [here](https://blog.invisiblethings.org/2013/02/21/converting-untrusted-pdfs-into-trusted.html).

OPTIONS
=============
**-b** SIZE, **`--`batch**=SIZE
--------------------------------
Maximum number of conversion tasks

**-a** PATH, **`--`archive**=PATH
----------------------------------
Directory for storing archived files

**-i**, **`--`in-place**
-------------------------
Replace original files instead of archiving them

More discussion of the concept has been described in the original article
[here](http://blog.invisiblethings.org/2013/02/21/converting-untrusted-pdfs-into-trusted.html).
**-g**, **`--`gui**
---------------------
Use a progress bar output understandable by zenity.

Usage
------
**`--`help**
-------------
Show this message and exit.

[user@domU ~]$ qvm-convert-pdf file1.pdf file2.pdf file3.pdf
:: Sending files to Disposable VMs...

file1.pdf...done
file2.pdf...fail
file3.pdf...done
CONFIGURATION
===============
To use a custom DisposableVM instead of the default one:

Total Sanitized Files: 2/3
Let’s assume that this custom DisposableVM is called "web".
In dom0, add new line in "/etc/qubes-rpc/policy/qubes.PdfConvert":

Authors
---------
**YOUR_CLIENT_VM_NAME @dispvm allow,target=@dispvm:web**

AUTHOR
============
The original idea and implementation has been provided by Joanna Rutkowska. The
project has been subsequently incorporated into [Qubes OS](https://qubes-os.org)
and multiple other developers have contributed various fixes and improvements
Expand Down
18 changes: 18 additions & 0 deletions archlinux/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pkgname=(qubes-pdf-converter)
pkgver=$(cat version)
pkgrel=1
arch=(x86_64)
pkgdesc=$(grep "Summary:" ./rpm_spec/qpdf-converter.spec.in | sed 's/Summary://' | xargs)
url=$(git remote get-url origin)
license=(GPL)
makedepends=(git pandoc python-setuptools)
depends=(libreoffice graphicsmagick zenity poppler python-nautilus python-click python-pillow python-tqdm python-magic)

build() {
ln -s "$srcdir"/../ "$srcdir/src"
}
package() {
cd src
make install-vm DESTDIR="$pkgdir/"
}

1 change: 1 addition & 0 deletions ci/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ click
pillow
pylint
tqdm
file-magic
2 changes: 1 addition & 1 deletion debian/compat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9
10
22 changes: 10 additions & 12 deletions debian/control
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
Source: qubes-pdf-converter
Section: admin
Priority: extra
Priority: optional
Maintainer: Jason Mehring <[email protected]>
Build-Depends:
debhelper (>= 9~),
dh-python,
python3-setuptools,
pandoc,
quilt
X-Python-Version: 2.7
Standards-Version: 3.9.5
Homepage: http://www.qubes-os.org
Build-Depends: pandoc, python3-setuptools, debhelper (>= 9)
# For the futures version of debian, delete the "compat" file, and add the line below in "Build-Depends"
# debhelper-compat (= 12)
Standards-Version: 4.5.0
Homepage: https://github.com/QubesOS/qubes-app-linux-pdf-converter

Package: qubes-pdf-converter
Section: admin
Architecture: any
Depends:
Depends:
poppler-utils,
imagemagick,
libreoffice,
graphicsmagick,
python3 (>= 3.7.0),
python3-nautilus | python-nautilus,
python3-click,
python3-pillow,
python3-tqdm,
python3-magic,
${misc:Depends}
Description: The Qubes service for converting untrusted PDF files into trusted ones
8 changes: 4 additions & 4 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: qubes-pdf-converter
Source: <http://www.qubes-os.org/>
Source: <https://github.com/QubesOS/qubes-app-linux-pdf-converter>

Files: *
Copyright: 2014-2015 Qubes Developers
Expand All @@ -16,7 +16,7 @@ License: GPL-2+
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
along with this program. If not, see <https://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
Expand All @@ -34,7 +34,7 @@ Copyright: 2015 Jason Mehring <[email protected]> License: GPL-2+
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
along with this program. If not, see <https://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
Expand Down
23 changes: 0 additions & 23 deletions doc/Makefile

This file was deleted.

33 changes: 0 additions & 33 deletions doc/qvm-convert-pdf.rst

This file was deleted.

5 changes: 3 additions & 2 deletions qubes.PdfConvert.policy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Note that policy parsing stops at the first match,
## so adding anything below "$anyvm $anyvm action" line will have no effect
## so adding anything below "@anyvm @anyvm action" line will have no effect

## Please use a single # to start your custom comments

$anyvm $dispvm allow
@anyvm @dispvm allow
@anyvm @anyvm deny
Loading