From 61072f89959e5d276b90d2fe36a2142ade83fbe0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 15 Sep 2011 15:13:46 +0000 Subject: [PATCH] * Add a module for a Flash policy server. svn path=/nixos/trunk/; revision=29296 --- modules/module-list.nix | 1 + modules/services/networking/flashpolicyd.nix | 84 ++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 modules/services/networking/flashpolicyd.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index f4d593b52fa8..860922b5672b 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -108,6 +108,7 @@ ./services/networking/dnsmasq.nix ./services/networking/ejabberd.nix ./services/networking/firewall.nix + ./services/networking/flashpolicyd.nix ./services/networking/git-daemon.nix ./services/networking/gnunet.nix ./services/networking/gvpe.nix diff --git a/modules/services/networking/flashpolicyd.nix b/modules/services/networking/flashpolicyd.nix new file mode 100644 index 000000000000..f5bc550ab5f8 --- /dev/null +++ b/modules/services/networking/flashpolicyd.nix @@ -0,0 +1,84 @@ +{ config, pkgs, ... }: + +with pkgs.lib; + +let + + cfg = config.services.flashpolicyd; + + flashpolicyd = pkgs.stdenv.mkDerivation { + name = "flashpolicyd-0.6"; + + src = pkgs.fetchurl { + name = "flashpolicyd_v0.6.zip"; + url = "http://www.adobe.com/content/dotcom/en/devnet/flashplayer/articles/socket_policy_files/_jcr_content/articlePrerequistes/multiplefiles/node_1277808777771/file.res/flashpolicyd_v0.6%5B1%5D.zip"; + sha256 = "16zk237233npwfq1m4ksy4g5lzy1z9fp95w7pz0cdlpmv0fv9sm3"; + }; + + buildInputs = [ pkgs.unzip pkgs.perl ]; + + installPhase = "mkdir $out; cp -pr * $out/; chmod +x $out/*/*.pl"; + }; + + flashpolicydWrapper = pkgs.writeScriptBin "flashpolicyd" + '' + #! ${pkgs.stdenv.shell} + exec ${flashpolicyd}/Perl_xinetd/in.flashpolicyd.pl \ + --file=${pkgs.writeText "flashpolixy.xml" cfg.policy} \ + 2> /dev/null + ''; + +in + +{ + + ###### interface + + options = { + + services.flashpolicyd = { + + enable = mkOption { + default = false; + description = + '' + Whether to enable the Flash Policy server. This is + necessary if you want Flash applications to make + connections to your server. + ''; + }; + + policy = mkOption { + default = + '' + + + + + + + ''; + description = "The policy to be served. The default is to allow connections from any domain to any port."; + }; + + }; + + }; + + + ###### implementation + + config = mkIf cfg.enable { + + services.xinetd.enable = true; + + services.xinetd.services = singleton + { name = "flashpolicy"; + port = 843; + unlisted = true; + server = "${flashpolicydWrapper}/bin/flashpolicyd"; + }; + + }; + +}