summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoritz Kaspar Rudert (mortzu)2015-05-21 16:37:10 +0200
committerMoritz Kaspar Rudert (mortzu)2015-05-21 16:37:10 +0200
commita8078d0bdd81f90cd1aa3270c30e0277a42df844 (patch)
treeb338625c8f82968901b7ef00d6db733c666bf617
downloadaur-a8078d0bdd81f90cd1aa3270c30e0277a42df844.tar.gz
initial commit
-rw-r--r--.SRCINFO28
-rw-r--r--500_debian_fhs.patch113
-rw-r--r--PKGBUILD55
-rw-r--r--sks-db.service12
-rw-r--r--sks-recon.service12
-rw-r--r--sks.install40
6 files changed, 260 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..cab602cf566
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,28 @@
+pkgbase = sks
+ pkgdesc = Synchronizing OpenPGP Key Server
+ pkgver = 1.1.5
+ pkgrel = 1
+ url = https://bitbucket.org/skskeyserver/sks-keyserver/
+ install = sks.install
+ arch = i686
+ arch = x86_64
+ license = GPL
+ makedepends = ocaml
+ makedepends = db
+ backup = etc/sks/sksconf
+ backup = etc/sks/forward.exim
+ backup = etc/sks/forward.postfix
+ backup = etc/sks/mailsync
+ backup = etc/sks/membership
+ backup = etc/sks/procmail
+ source = https://bitbucket.org/skskeyserver/sks-keyserver/downloads/sks-1.1.5.tgz
+ source = 500_debian_fhs.patch
+ source = sks-db.service
+ source = sks-recon.service
+ md5sums = 60bb0ce429e5d223fd4662c286f46e7b
+ md5sums = 9cf5495b95e84ed91788c04c9ce1b8c1
+ md5sums = e8c7dcbb7db3ad879d391a7c0127a068
+ md5sums = f28a2d0b151996a99bb006b8e1d29408
+
+pkgname = sks
+
diff --git a/500_debian_fhs.patch b/500_debian_fhs.patch
new file mode 100644
index 00000000000..23ad4448057
--- /dev/null
+++ b/500_debian_fhs.patch
@@ -0,0 +1,113 @@
+diff -ru sks-1.1.4/common.ml sks-1.1.4.new/common.ml
+--- sks-1.1.4/common.ml 2012-10-07 19:59:39.000000000 +0000
++++ sks-1.1.4.new/common.ml 2013-02-05 14:58:40.000000000 +0000
+@@ -93,7 +93,7 @@
+
+ let set_logfile extension =
+ if !Settings.filelog then
+- let fname = (Filename.concat !Settings.basedir extension) ^ ".log" in
++ let fname = (Filename.concat !Settings.basedir "/var/log/sks/") ^ extension ^ ".log" in
+ stored_logfile_name := Some fname;
+ logfile := open_out_gen [ Open_wronly; Open_creat; Open_append; ]
+ 0o600 fname;
+@@ -221,8 +221,8 @@
+ let recon_address = !Settings.recon_address
+ let http_port = !Settings.hkp_port
+ let http_address = !Settings.hkp_address
+-let db_command_name = Filename.concat !Settings.basedir "db_com_sock"
+-let recon_command_name = Filename.concat !Settings.basedir "recon_com_sock"
++let db_command_name = Filename.concat !Settings.basedir "/var/run/sks/db_com_sock"
++let recon_command_name = Filename.concat !Settings.basedir "/var/run/sks/recon_com_sock"
+
+ let db_command_addr = Unix.ADDR_UNIX db_command_name
+ let recon_command_addr = Unix.ADDR_UNIX recon_command_name
+diff -ru sks-1.1.4/dbserver.ml sks-1.1.4.new/dbserver.ml
+--- sks-1.1.4/dbserver.ml 2012-10-07 19:59:39.000000000 +0000
++++ sks-1.1.4.new/dbserver.ml 2013-02-05 14:58:40.000000000 +0000
+@@ -406,7 +406,7 @@
+
+ let convert_web_fname fname =
+ if verify_web_fname fname then
+- Filename.concat !Settings.basedir (Filename.concat "web" fname)
++ Filename.concat !Settings.basedir (Filename.concat "/var/lib/sks/www" fname)
+ else raise (Wserver.Misc_error "Malformed requst")
+
+ let supported_extensions =
+diff -ru sks-1.1.4/getfileopts.ml sks-1.1.4.new/getfileopts.ml
+--- sks-1.1.4/getfileopts.ml 2012-10-07 19:59:39.000000000 +0000
++++ sks-1.1.4.new/getfileopts.ml 2013-02-05 14:58:40.000000000 +0000
+@@ -110,7 +110,7 @@
+ (**************************************************************)
+ (**************************************************************)
+
+-let config_fname = "sksconf"
++let config_fname = "/etc/sks/sksconf"
+
+ let parse args =
+ Arg.current := 0;
+diff -ru sks-1.1.4/reconserver.ml sks-1.1.4.new/reconserver.ml
+--- sks-1.1.4/reconserver.ml 2012-10-07 19:59:39.000000000 +0000
++++ sks-1.1.4.new/reconserver.ml 2013-02-05 14:58:40.000000000 +0000
+@@ -192,7 +192,7 @@
+ let elements = ZSet.elements results in
+ let hashes = hashconvert elements in
+ print_hashes (sockaddr_to_string http_addr) hashes;
+- log_diffs (sprintf "diff-%s.txt" (sockaddr_to_name http_addr)) hashes;
++ log_diffs (sprintf "/var/spool/sks/diff-%s.txt" (sockaddr_to_name http_addr)) hashes;
+ if List.length elements > 0
+ then
+ begin
+@@ -229,7 +229,7 @@
+ plerror 4 "Reconciliation complete";
+ let hashes = hashconvert results in
+ print_hashes (sockaddr_to_string http_addr) hashes;
+- log_diffs (sprintf "diff-%s.txt" (sockaddr_to_name http_addr)) hashes;
++ log_diffs (sprintf "/var/spool/sks/diff-%s.txt" (sockaddr_to_name http_addr)) hashes;
+ match results with
+ [] -> []
+ | _ ->
+diff -ru sks-1.1.4/settings.ml sks-1.1.4.new/settings.ml
+--- sks-1.1.4/settings.ml 2012-10-07 19:59:39.000000000 +0000
++++ sks-1.1.4.new/settings.ml 2013-02-05 14:58:40.000000000 +0000
+@@ -200,7 +200,7 @@
+ let command_timeout = ref 60
+ let set_command_timeout value = command_timeout := value
+
+-let sendmail_cmd = ref "sendmail -t -oi"
++let sendmail_cmd = ref "/usr/lib/sendmail -t -oi"
+ let set_sendmail_cmd value = sendmail_cmd := value
+
+ let membership_reload_time = ref (60. *. 60. *. 6.)
+@@ -226,15 +226,15 @@
+
+ let use_stdin = ref false
+
+-let basedir = ref "."
++let basedir = ref ""
+
+-let base_dbdir = "KDB"
+-let base_ptree_dbdir = "PTree"
+-let base_membership_file = "membership"
+-let base_mailsync_file = "mailsync"
+-let base_dumpdir = "dump"
+-let base_msgdir = "messages"
+-let base_failed_msgdir = "failed_messages"
++let base_dbdir = "/var/lib/sks/DB"
++let base_ptree_dbdir = "/var/lib/sks/PTree"
++let base_membership_file = "/etc/sks/membership"
++let base_mailsync_file = "/etc/sks/mailsync"
++let base_dumpdir = "/var/lib/sks/dump"
++let base_msgdir = "/var/spool/sks/messages"
++let base_failed_msgdir = "/var/spool/sks/failed_messages"
+
+ let dbdir = lazy (Filename.concat !basedir base_dbdir)
+ let ptree_dbdir = lazy (Filename.concat !basedir base_ptree_dbdir)
+@@ -290,7 +290,7 @@
+ ("-hkp_address",Arg.String set_hkp_address, " Set hkp binding address");
+ ("-use_port_80",Arg.Set use_port_80,
+ " Have the HKP interface listen on port 80, as well as the hkp_port");
+- ("-basedir", Arg.Set_string basedir, " Base directory");
++ ("-basedir", Arg.Set_string basedir, " Base directory (Take special care if running the Debian package!)");
+ ("-stdoutlog", Arg.Clear filelog,
+ " Send log messages to stdout instead of log file");
+ ("-diskptree", Arg.Set disk_ptree,
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..d159897142f
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,55 @@
+pkgname=sks
+pkgver=1.1.5
+pkgrel=1
+arch=('i686' 'x86_64')
+license=('GPL')
+pkgdesc='Synchronizing OpenPGP Key Server'
+makedepends=('ocaml' 'db')
+url='https://bitbucket.org/skskeyserver/sks-keyserver/'
+install='sks.install'
+backup=('etc/sks/sksconf'
+ 'etc/sks/forward.exim'
+ 'etc/sks/forward.postfix'
+ 'etc/sks/mailsync'
+ 'etc/sks/membership'
+ 'etc/sks/procmail')
+source=("https://bitbucket.org/skskeyserver/sks-keyserver/downloads/sks-${pkgver}.tgz"
+ '500_debian_fhs.patch'
+ 'sks-db.service'
+ 'sks-recon.service')
+md5sums=('60bb0ce429e5d223fd4662c286f46e7b'
+ '9cf5495b95e84ed91788c04c9ce1b8c1'
+ 'e8c7dcbb7db3ad879d391a7c0127a068'
+ 'f28a2d0b151996a99bb006b8e1d29408')
+
+build() {
+ cd "$pkgname-$pkgver"
+
+ # patch path
+ patch -Np1 -i "$srcdir/500_debian_fhs.patch"
+
+ cp Makefile.local.unused Makefile.local
+ sed -i -e 's#LIBDB=-ldb-4.6#LIBDB=-ldb-5.3#g' Makefile.local
+ sed -i -e "s#/usr/local#$pkgdir/usr#g" Makefile.local
+ sed -i -e "s#/usr/share/man#$pkgdir/usr/share/man#g" Makefile.local
+
+ unset MAKEFLAGS
+ make dep
+ make CFLAGS="$CFLAGS -I`ocamlc -where` -I ." all
+}
+
+package() {
+ cd "$pkgname-$pkgver"
+
+ make PREFIX="$pkgdir/usr" MANDIR="$pkgdir/usr/share/man" install
+
+ install -Dm644 "$srcdir/sks-db.service" "$pkgdir/usr/lib/systemd/system/sks-db.service"
+ install -Dm644 "$srcdir/sks-recon.service" "$pkgdir/usr/lib/systemd/system/sks-recon.service"
+
+ mkdir -p "$pkgdir/etc" "$pkgdir/var/lib/sks"
+
+ cp -r sampleWeb/OpenPKG "$pkgdir/var/lib/sks"
+ cp -r sampleConfig/debian "$pkgdir/etc/sks"
+
+ sed -i -e 's#/usr/lib/sendmail#/usr/sbin/sendmail#g' "$pkgdir/etc/sks/sksconf"
+}
diff --git a/sks-db.service b/sks-db.service
new file mode 100644
index 00000000000..a09aaaebd89
--- /dev/null
+++ b/sks-db.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Synchronizing key server db instance
+After=network.target remote-fs.target nss-lookup.target
+
+[Service]
+Type=simple
+User=sks
+PIDFile=/var/run/sks/sksdb.pid
+ExecStart=/usr/bin/sks db
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sks-recon.service b/sks-recon.service
new file mode 100644
index 00000000000..d4411de4b51
--- /dev/null
+++ b/sks-recon.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Synchronizing key server recon instance
+After=network.target remote-fs.target nss-lookup.target
+
+[Service]
+Type=simple
+User=sks
+PIDFile=/var/run/sks/sksrecon.pid
+ExecStart=/usr/bin/sks recon
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sks.install b/sks.install
new file mode 100644
index 00000000000..402f8930e82
--- /dev/null
+++ b/sks.install
@@ -0,0 +1,40 @@
+post_install() {
+ echo -n "adding sks system group... "
+ groupadd -r sks && echo -n "done."
+ echo
+
+ echo -n "adding sks system user... "
+ useradd -c "Synchronizing OpenPGP Key Server" -r -d /var/lib/sks -g sks -s /bin/bash sks && echo -n "done."
+ echo
+
+ mkdir -p /var/run/sks
+ chown sks:sks /var/run/sks
+ chmod 775 /var/run/sks
+
+ mkdir -p /var/log/sks
+ chown sks:sks /var/log/sks
+
+ mkdir -p /var/lib/sks
+ chown sks:sks /var/lib/sks
+
+ mkdir -p /var/spool/sks
+ chown sks:sks /var/spool/sks
+
+ echo ">> Place 'sks' in DAEMONS= in /etc/rc.conf to enable sks on system boot."
+}
+
+post_remove() {
+ echo -n -e "\nremoving sks system user... "
+ userdel sks && echo "done."
+
+ rm -r /var/run/sks
+
+ echo "Not removing tmp and log directories"
+}
+
+op=$1
+shift
+
+$op $*
+
+# vim: ft=sh ts=2 sw=2