Commit 8239ee74 authored by Steve Kemp's avatar Steve Kemp
Browse files

merge

parents 1bbdb317 e6c65be7
symbiosis-common (2014:1111) stable; urgency=low
[ Patrick J Cherry]
* Added Symbiosis::ConfigFile#mananaged? test to check for files Symbiosis
might have managed at one point in time.
* The default DKIM selector is now the first part of the hostname of the
box, rather than the whole thing.
* Added in new Swordfish range to the list of Bytemark ranges.
[ James Carter ]
* Fixed commands with paths in the maintainer scripts
-- Patrick J Cherry <patrick@bytemark.co.uk> Tue, 31 Mar 2015 13:01:11 +0100
symbiosis-common (2014:1110) stable; urgency=low
* Postinst now generates a 4096 bit key.
......
......@@ -43,6 +43,7 @@ module Symbiosis
@contents = nil
@template = nil
@domain = nil
@managed = nil
end
#
......@@ -207,6 +208,11 @@ module Symbiosis
#
snippet = File.readlines(self.filename)
#
# Set the managed parameter
#
@managed = false
#
# We expect the checksum to be the last line of the file
#
......@@ -214,9 +220,13 @@ module Symbiosis
#
# OK we've found the checksum
#
supposed_checksum = $1
#
# This file must have been managed at some point
#
@managed = true
#
# Pop off the last line, as this isn't part of the checksum
#
......@@ -228,11 +238,16 @@ module Symbiosis
return Digest::MD5.new.hexdigest(snippet.join) != supposed_checksum
#
# We're OK if the file has a big warning in it.
# If the file has a big warning in it, we ignore changes
#
elsif snippet.any?{|l| l.is_a?(String) and self.comment_char+" DO NOT EDIT THIS FILE - CHANGES WILL BE OVERWRITTEN" == l.chomp}
#
# So return true
# This file must have been managed at some point
#
@managed = true
#
# So return false
#
return false
......@@ -246,6 +261,18 @@ module Symbiosis
true
end
#
# This returns true if Symbiosis has managed this file at some point.
#
def managed?
#
# This uses the same checks as #changed?, so use that code instead.
#
self.changed?
@managed
end
end
#
......
......@@ -123,4 +123,45 @@ class TestConfigFile < Test::Unit::TestCase
assert_equal(true, x.changed?)
end
def test_is_managed?
x = ConfigFile.new(@config.path)
assert_nothing_raised{ x.template = @template.path }
#
# The config is an empty file. It is not managed
#
assert_equal(false, x.managed?)
#
# Generate a configuration using our template. Once written, managed?
# should return false.
#
original_config = x.generate_config
assert_nothing_raised { x.write(original_config) }
assert_equal(true, x.managed?)
#
# Change our config. managed? should still be true.
#
new_config = "New Directive.\n" + original_config
assert_nothing_raised { x.write(new_config) }
assert_equal(true, x.changed?)
#
# Now write a new config with ye olde BIG WARNING. A file with this in it
# is *always* managed.
#
ye_olde_config = "# DO NOT EDIT THIS FILE - CHANGES WILL BE OVERWRITTEN\n Stuff goes in here.\n Blah blah blah.\n"
assert_nothing_raised { x.write(ye_olde_config) }
assert_equal(true, x.managed?)
#
# Finally write a config with no checksum or big warning. This is never managed
#
custom_config = "# Hand-crafted by experts.\nBlah blah blah.\n"
assert_nothing_raised { x.write(custom_config) }
assert_equal(false, x.managed?)
end
end
symbiosis-email (2014:1018) stable; urgency=medium
[ James Carter ]
* Fix exim4 config for vacation messages (closes #8448).
[ Patrick J Cherry ]
* Accept mail from authenticated users for locally configured hosts that
have their mail elsewhere.
* Updated maintainer/uploaders.
* Avoid advertising PLAIN and LOGIN over unencrypted connections. Fixes
#8473
-- Patrick J Cherry <patrick@bytemark.co.uk> Tue, 31 Mar 2015 13:10:01 +0100
symbiosis-email (2014:1017) stable; urgency=medium
* Disable SSLv3 in Exim4 and Dovecot (CVE-2014-3566).
......
Source: symbiosis-email
Section: mail
Priority: extra
Maintainer: Patrick J Cherry <patrick@bytemark.co.uk>
Uploaders: John Hackett <john.hackett@bytemark.co.uk>
Maintainer: James Carter <jcarter@bytemark.co.uk>
Uploaders: Patrick J Cherry <patrick@bytemark.co.uk>, Steve Kemp <steve@bytemark.co.uk>
Build-Depends: debhelper (>= 7.0.0), txt2man, gem2deb
Standards-Version: 3.9.1
XS-Ruby-Versions: all
......
......@@ -7,5 +7,6 @@
PLAIN:
driver = dovecot
server_set_id = $auth1
server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
server_socket = /var/run/dovecot/auth-client
......@@ -6,5 +6,6 @@
LOGIN:
driver = dovecot
server_set_id = $auth1
server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
server_socket = /var/run/dovecot/auth-client
symbiosis-httpd (2014:1211) stable; urgency=high
[ Steve Kemp ]
* Updated the path-mangling in mod_vhost_bytemark.
* Added tests to the build process for vhost module.
* Fixed documentation in symbiosis-httpd-configure.
[ James Carter ]
* Fixed documentation links in Symbiosis "unconfigured site" page.
-- Steve Kemp <steve@bytemark.co.uk> Wed, 11 Dec 2014 17:55:35 +0000
[ Patrick J Cherry ]
* Rewrote how orphaned apache config snippets are handled.
* Added tests for symbiosis-httpd-configure, although more coveraged is
needed.
* Added testing domain for non-mass-hosted config snippets.
* Updated uploaders and matainers in debian/control.
* Now requires new version of symbiosis-common.
-- Steve Kemp <steve@bytemark.co.uk> Tue, 31 Mar 2015 12:57:22 +0100
symbiosis-httpd (2014:1210) stable; urgency=low
......
Source: symbiosis-httpd
Section: web
Priority: optional
Maintainer: Patrick J Cherry <patrick@bytemark.co.uk>
Uploaders: John Hackett <john.hackett@bytemark.co.uk>
Maintainer: James Carter <jcarter@bytemark.co.uk>
Uploaders: Patrick J Cherry <patrick@bytemark.co.uk>, Steve Kemp <steve@bytemark.co.uk>
Build-Depends: debhelper (>= 7.0.0), apache2-prefork-dev, libcap-dev, php5-common, txt2man, gem2deb, ruby
Standards-Version: 3.9.1
XS-Ruby-Versions: all
Package: symbiosis-httpd
Architecture: all
Depends: apache2, php5-mysql, php5-curl, php5-imagick, php5-mcrypt, php5-mhash, php5-xmlrpc, php5-gd, libapache2-mod-php5, webalizer, libapache2-mod-vhost-bytemark, ${misc:Depends}, symbiosis-httpd-static, symbiosis-common (>= 2014:0101), ruby | ruby-interpreter, ruby-eventmachine, geoip-database
Depends: apache2, php5-mysql, php5-curl, php5-imagick, php5-mcrypt, php5-mhash, php5-xmlrpc, php5-gd, libapache2-mod-php5, webalizer, libapache2-mod-vhost-bytemark, ${misc:Depends}, symbiosis-httpd-static, symbiosis-common (>= 2014:1111), ruby | ruby-interpreter, ruby-eventmachine, geoip-database
Replaces: bytemark-vhost-httpd, symbiosis-test, symbiosis-monit (<< 2011:1206), symbiosis-httpd-static
Breaks: symbiosis-monit (<< 2011:1206)
Provides: bytemark-vhost-httpd, symbiosis-httpd-static
......
......@@ -279,6 +279,11 @@ filenames_available = configurations.collect{|c| c.filename }
filenames_enabled = filenames_available.collect{|filename| filename.sub("sites-available","sites-enabled") }
Dir.foreach(File.join(apache2_dir, "sites-enabled")) do |filename|
#
# Prepend full path before the filename
#
filename = File.join(apache2_dir, "sites-enabled", filename)
#
# Make sure this isn't a file we're expecting to create/enable
#
......@@ -309,8 +314,8 @@ Dir.foreach(File.join(apache2_dir, "sites-enabled")) do |filename|
#
# If the configuration has changed, then remove it.
#
if config.changed? or !$FORCE
verbose "\tConfiguration #{filename_source} has been edited by hand -- skipping"
unless config.managed?
verbose "\tConfiguration #{filename_source} not managed by Symbiosis -- skipping"
next
end
......@@ -362,7 +367,7 @@ configurations.each do |config|
#
# This gets apache2 to check the configuration using a temporary file.
#
if config.ok?
if $FORCE or config.ok?
verbose "\tWriting configuration"
config.write
......@@ -372,7 +377,6 @@ configurations.each do |config|
else
verbose "\tApache has rejected the new configuration -- no changes have been made."
config.write
next
end
......
#!/usr/bin/ruby
#
#
require 'test/unit'
require 'tmpdir'
require 'tempfile'
require 'symbiosis/domain'
require 'symbiosis/domain/http'
require 'symbiosis/host'
require 'pp'
class TestSymbiosisHttpdConfigure < Test::Unit::TestCase
def setup
@root = Dir.mktmpdir()
@prefix = File.join(@root,"srv")
@apache2_dir = File.join(@root,"etc","apache2")
@ip = Symbiosis::Host.primary_ipv4
@verbose = (($VERBOSE or $DEBUG) ? " --verbose " : "")
testd = File.dirname(__FILE__)
@script = File.expand_path(File.join(testd,"..","sbin","symbiosis-httpd-configure"))
@script = '/usr/sbin/symbiosis-httpd-configure' unless File.exists?(@script)
@script += @verbose
ENV["RUBYLIB"] = $:.join(":")
FileUtils.mkdir_p(File.join(@root, "etc", "symbiosis", "apache.d"))
FileUtils.mkdir_p(File.join(@apache2_dir,"sites-available"))
FileUtils.mkdir_p(File.join(@apache2_dir,"sites-enabled"))
FileUtils.mkdir_p(@prefix)
#
# We don't want to use root for this test where poss.
#
if 0 == Process.uid
File.chown(1000,1000,@prefix)
end
%w(non_ssl.template.erb ssl.template.erb zz-mass-hosting.ssl.template.erb zz-mass-hosting.template.erb).each do |fn|
FileUtils.cp(File.join(testd,"..","apache.d",fn), File.join(@root, "etc", "symbiosis", "apache.d"))
end
end
def teardown
unless $DEBUG
#
# Remove the @prefix directory
#
FileUtils.remove_entry_secure @root
else
puts "Files left at #{@root}"
end
end
def test_new_site_with_and_without_mass_hosting
domain = Symbiosis::Domain.new(nil, @prefix)
domain.create
name = domain.name
FileUtils.mkdir_p(domain.htdocs_dir)
#
# These are the files we expect to be in place.
#
domain_conf_fn = File.join(@apache2_dir, "sites-enabled", domain.name+".conf")
mass_hosting_files = %w(zz-mass-hosting.ssl zz-mass-hosting).collect do |fn|
File.join(@apache2_dir,"sites-enabled",fn)
end
system("#{@script} --root-dir #{@root} --no-reload")
assert_equal($?,0,"#{@script} exited with a non-zero status")
mass_hosting_files.each do |fn|
assert(File.exist?(fn), "File #{fn} missing")
end
assert(!File.exist?(domain_conf_fn), "File #{domain_conf_fn} present when it should be covered by mass hosting.")
#
# Now disable mass hosting and try the same again.
#
FileUtils.touch("#{@root}/etc/symbiosis/apache.d/disabled.zz-mass-hosting")
system("#{@script} --root-dir #{@root} --no-reload")
assert_equal(0, $?.exitstatus, "#{@script} exited with a non-zero status")
mass_hosting_files.each do |fn|
assert(!File.exist?(fn), "File #{fn} still in place despite mass-hosting being disabled.")
end
assert(File.exist?(domain_conf_fn), "File #{domain_conf_fn} missing after mass hosting disabled")
end
def test_new_site_with_ip
domain = Symbiosis::Domain.new(nil, @prefix)
domain.create
name = domain.name
FileUtils.mkdir_p(domain.htdocs_dir)
Symbiosis::Utils.set_param( "ip", "10.0.0.1", domain.config_dir)
snippet_files = ["zz-mass-hosting.ssl", "zz-mass-hosting", domain.name + ".conf"].collect do |fn|
File.join(@apache2_dir,"sites-enabled",fn)
end
system("#{@script} --root-dir #{@root} --no-reload")
assert_equal(0, $?.exitstatus, "#{@script} exited with a non-zero status")
snippet_files.each do |fn|
assert(File.exist?(fn), "File #{fn} missing")
end
end
def test_site_pruning
#
# This is a standard file in sites-available. It should never be removed.
#
unmanaged_config = File.join(@apache2_dir,"sites-enabled","default")
FileUtils.touch(unmanaged_config)
#
# This is another site that has been symlinked in. Again shouldn't ever be removed.
#
symlinked_unmanaged_source = File.join(@apache2_dir, "sites-available", "other-domain.test.conf")
symlinked_unmanaged_config = symlinked_unmanaged_source.sub("-available","-enabled")
FileUtils.touch(symlinked_unmanaged_source)
FileUtils.ln_s(symlinked_unmanaged_source, symlinked_unmanaged_config)
[unmanaged_config, symlinked_unmanaged_config].each do |fn|
assert(File.exist?(fn), "Missing config #{fn} before we even start!")
end
domain = Symbiosis::Domain.new(nil, @prefix)
domain.create
name = domain.name
FileUtils.mkdir_p(domain.htdocs_dir)
Symbiosis::Utils.set_param( "ip", "10.0.0.1", domain.config_dir)
domain_conf_fn = File.join(@apache2_dir, "sites-enabled", domain.name+".conf")
system("#{@script} --root-dir #{@root} --no-reload")
assert_equal(0, $?.exitstatus, "#{@script} exited with a non-zero status")
[unmanaged_config, symlinked_unmanaged_config].each do |fn|
assert(File.exist?(fn), "Missing config #{fn} which should not have been removed")
end
assert(File.exist?(domain_conf_fn), "File #{domain_conf_fn} missing when it should have been generated.")
FileUtils.remove_entry_secure(domain.directory)
system("#{@script} --root-dir #{@root} --no-reload")
[unmanaged_config, symlinked_unmanaged_config].each do |fn|
assert(File.exist?(fn), "Missing config #{fn} which should not have been removed")
end
assert(!File.exist?(domain_conf_fn), "File #{domain_conf_fn} missing when it should have been generated.")
end
end
symbiosis-updater (2014:1111) stable; urgency=medium
* Email is only sent if the EMAIL parameter is set.
* Updated maintainers/uploaders.
-- Patrick J Cherry <patrick@bytemark.co.uk> Tue, 31 Mar 2015 13:16:24 +0100
symbiosis-updater (2014:1110) stable; urgency=low
* Re-jigged packaging (fixes #6686).
......
Source: symbiosis-updater
Section: web
Priority: extra
Maintainer: Patrick J Cherry <patrick@bytemark.co.uk>
Uploaders: John Hackett <john.hackett@bytemark.co.uk>
Maintainer: James Carter <jcarter@bytemark.co.uk>
Uploaders: Patrick J Cherry <patrick@bytemark.co.uk>, Steve Kemp <steve@bytemark.co.uk>
Build-Depends: debhelper (>= 7.0.0)
Standards-Version: 3.9.1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment