2

Suppose I have an encrypted Makefile on hand, I want to write a Perl program to decrypt it and run make -f with it. Is this possible without writing the decrypted Makefile back to harddisk?

Jens
  • 69,818
  • 15
  • 125
  • 179
solotim
  • 1,826
  • 4
  • 24
  • 41

4 Answers4

8

Have your program write the decrypted Makefile to stdout and pipe it to make -.

See man make, the part that says:

If makefile is `-', the standard input is read.

Catalin Iacob
  • 644
  • 5
  • 18
0

You could try setting LD_PRELOAD when you run make to give make some fake fopen/fclose functions that read the makefile out of memory.

Community
  • 1
  • 1
Artelius
  • 48,337
  • 13
  • 89
  • 105
0
make -f <(decrypt file)

This will work on linux and some other systems. It does not rely on make supporting this functionality. It is done in the OS. See http://www.gnu.org/software/bash/manual/bashref.html#Process-Substitution

P.S. you will want to consider swap space, telling make not to swap.

Also this will not help with files included by the first.

ctrl-alt-delor
  • 7,506
  • 5
  • 40
  • 52
0

You could use an encrypted file system. A shell script could launch a key agent, for the file system then the make can run retrieving and saving everything to/from the encrypted file system. I have done successfully done this with sshfs (not an encrypted file system, but an encrypted connection to a remote file system locked in a room).

ctrl-alt-delor
  • 7,506
  • 5
  • 40
  • 52