Merge branch 'team_project' into team_project_merge

# Conflicts:
#	.gitignore
#	modules/services/unix/http/parameterised_website/secgen_metadata.xml
This commit is contained in:
ts
2018-02-07 15:47:48 +00:00
145 changed files with 22757 additions and 101 deletions

View File

@@ -749,6 +749,8 @@ If you start SecGen with the "build-project" (or "p") command it creates the abo
It is possible to copy the project directory to any compatible system with Vagrant, and simply run "vagrant up" to create the VMs.
The default root password for the base-boxes is 'puppet', but this may be modified by SecGen depending on the scenario used.
## Roadmap
- **More modules!** Including more CTF-style modules.
- Windows baseboxes and vulnerabilities.
@@ -772,3 +774,10 @@ This project is supported by a Higher Education Academy (HEA) learning and teach
We encourage contributions to the project, please see the wiki for guidance on how to contribute.
Briefly, please fork from http://github.com/cliffe/SecGen/, create a branch, make and commit your changes, then create a pull request.
## Resources
Paper: [Z.C. Schreuders, T. Shaw, M. Shan-A-Khuda, G. Ravichandran, J. Keighley, M. Ordean, “Security Scenario Generator (SecGen): A Framework for Generating Randomly Vulnerable Rich-scenario VMs for Learning Computer Security and Hosting CTF Events,” USENIX Workshop on Advances in Security Education (ASE'17), Vancouver, BC, Canada. USENIX Association, 2017.](https://www.usenix.org/conference/ase17/workshop-program/presentation/schreuders) (This paper provides a good overview of SecGen.)
Paper: [Z.C. Schreuders, and L. Ardern, "Generating randomised virtualised scenarios for ethical hacking and computer security education: SecGen implementation and deployment," in The first UK Workshop on Cybersecurity Training & Education (Vibrant Workshop 2015) Liverpool, UK, 2015.](http://z.cliffe.schreuders.org/publications/VibrantWorkshop2015%20-%20Generating%20randomised%20virtualised%20scenarios%20for%20ethical%20hacking%20and%20computer%20security%20education%20%28SecGen%29.pdf) (This paper describes the first prototype.)
Podcast interview: [Purple Squad Security Episode 011 Security Scenario Generator with Dr. Z. Cliffe Schreuders](https://purplesquadsec.com/podcast/episode-011-security-scenario-generator-dr-z-cliffe-schreuders/)

View File

@@ -0,0 +1,47 @@
{
"business_name": "Artisan Bakery",
"business_motto": "The loaves are in the oven.",
"business_address": "1080 Headingley Lane, Headingley, Leeds, LS6 1BN",
"domain": "artisan-bakery.co.uk",
"office_telephone": "0113 222 1080",
"office_email": "orders@artisan-bakery.co.uk",
"industry": "Bakers",
"manager": {
"name": "Maxie Durgan",
"address": "1080 Headingley Lane, Headingley, Leeds, LS6 1BN",
"phone_number": "0113 222 1080",
"email_address": "maxie@artisan-bakery.co.uk",
"username": "maxie",
"password": ""
},
"employees": [
{
"name": "Matthew Riley",
"address": "1080 Headingley Lane, Headingley, Leeds, LS6 1BN",
"phone_number": "0113 222 1080",
"email_address": "matt@artisan-bakery.co.uk",
"username": "matt",
"password": ""
},
{
"name": "Emelie Lowe",
"address": "1080 Headingley Lane, Headingley, Leeds, LS6 1BN",
"phone_number": "0113 222 1080",
"email_address": "emelie@artisan-bakery.co.uk",
"username": "emelie",
"password": ""
},
{
"name": "Antonio Durgan",
"address": "1080 Headingley Lane, Headingley, Leeds, LS6 1BN",
"phone_number": "0113 222 1080",
"email_address": "antonio@artisan-bakery.co.uk",
"username": "antonio",
"password": ""
}
],
"product_name": "Baked goods",
"intro_paragraph": [
"Finest bakery in Headingley since 1900. Baked fresh daily. Bread loaves, teacakes, sweet and savoury treats. We are open from 9 am til 6 pm, every day except for bank holidays."
]
}

View File

@@ -0,0 +1,47 @@
{
"business_name": "Northern Banking",
"business_motto": "We'll keep your money safe!",
"business_address": "123 The Headrow, Leeds, LS1 5RD",
"domain": "northernbanking.co.uk",
"office_telephone": "0113 000 0123",
"office_email": "enquiries@northernbanking.co.uk",
"industry": "Finance",
"manager": {
"name": "Heather Schmidt",
"address": "800 Bogisich Avenue, Oswaldohaven, Leeds, LS9 6NB",
"phone_number": "07836 581948",
"email_address": "h.schmidt@northernbanking.co.uk",
"username": "h_schmidt",
"password": ""
},
"employees": [
{
"name": "Zion Jacobson",
"address": "104 Cole Square, ",
"phone_number": "07880 057670",
"email_address": "z.jacobson@northernbanking.co.uk",
"username": "z_jacobson",
"password": ""
},
{
"name": "Jonathan Ray",
"address": "644 Jackson Path, Leeds, LS2 4AJ",
"phone_number": "07893 001623",
"email_address": "j.ray@northernbanking.co.uk",
"username": "j_ray",
"password": ""
},
{
"name": "Virginia Sullivan",
"address": "23 Jane Street, Harrogate, HG1 4DJ",
"phone_number": "07826 576277",
"email_address": "v.sullivan@northernbanking.co.uk",
"username": "v_sullivan",
"password": ""
}
],
"product_name": "Financial Services",
"intro_paragraph": [
"About Northern Bank","With roots back to its establishment in Huddersfield, West Yorkshire in 1805. Northern bank has a strong personal customer base and business banking capability though a UK-wide network. Northern Bank is a trading name of Big Bank PLC."
]
}

View File

@@ -0,0 +1,48 @@
{
"business_name": "The Yorkshire Fitness Company",
"business_motto": "Get thi sen down't gym!",
"business_address": "15 Sheepscar Court, Leeds LS7 2BB",
"domain": "yorkshirefitco.co.uk",
"office_telephone": "0113 026 9999",
"office_email": "office@yorkshirefitco.co.uk",
"industry": "Health and Fitness",
"manager": {
"name": "Jerry Rivera",
"address": "15 Sheepscar Court, Leeds LS7 2BB",
"phone_number": "0113 026 9999",
"email_address": "jerry.rivera@yorkshirefitco.co.uk",
"username": "jerry_rivera",
"password": ""
},
"employees": [
{
"name": "Immanuel Bahringer IV",
"address": "15 Sheepscar Court, Leeds LS7 2BB",
"phone_number": "07688 112479",
"email_address": "immanuel.bahringer.iv@yorkshirefitco.co.uk",
"username": "immanuel_bahringer_iv",
"password": ""
},
{
"name": "Anne Hunter",
"address": "15 Sheepscar Court, Leeds LS7 2BB",
"phone_number": "07791 179177",
"email_address": "anne.hunter@yorkshirefitco.co.uk",
"username": "anne_hunter",
"password": ""
},
{
"name": "Katelin Langworth",
"address": "15 Sheepscar Court, Leeds LS7 2BB",
"phone_number": "07550 561978",
"email_address": "katelin.langworth@yorkshirefitco.co.uk",
"username": "katelin_langworth",
"password": ""
}
],
"product_name": "",
"intro_paragraph": [
"Experience Yorkshire's leading health and fitness club in the not far from the city centre. Established in 1990 The Yorkshire Fitness Company is committed to getting you the results you want.",
"If you like classes, the gym or a combo of both, our dedicated professional team of coaches & teachers are always available to motivate you and guide you towards your goals."
]
}

View File

@@ -0,0 +1,47 @@
{
"business_name": "Abacus Technology Solutions",
"business_motto": "Solving your problems so you don't have to.",
"business_address": "Unit 12, Lincoln St, Huddersfield HD1 6RX",
"domain": "abacus-technology.co.uk",
"office_telephone": "01484 850963",
"office_email": "office@abacus-technology.co.uk",
"industry": "IT Services",
"manager": {
"name": "Ellie Bosco",
"address": "Office 1, Unit 12, Lincoln St, Huddersfield HD1 6RX",
"phone_number": "07528 347828",
"email_address": "e.bosco@abacus-technology.co.uk",
"username": "ebosco",
"password": ""
},
"employees": [
{
"name": "Keara Harris",
"address": "Office 2, Unit 12, Lincoln St, Huddersfield HD1 6RX",
"phone_number": "07674 358645",
"email_address": "k.harris@abacus-technology.co.uk",
"username": "kharris",
"password": ""
},
{
"name": "Janessa Rempel",
"address": "Office 2, Unit 12, Lincoln St, Huddersfield HD1 6RX",
"phone_number": "07644 118595",
"email_address": "j.rempel@abacus-technology.co.uk",
"username": "jrempel",
"password": ""
},
{
"name": "Russell Ramirez",
"address": "Office 3, Unit 12, Lincoln St, Huddersfield HD1 6RX",
"phone_number": "01484 850963",
"email_address": "r.ramirez@abacus-technology.co.uk",
"username": "rramirez",
"password": ""
}
],
"product_name": "IT Solutions",
"intro_paragraph": [
"Providers of cloud services, backups, data recovery, hardware, off-the-shelf and bespoke software. 24/7 technical support available. Custom design and installation based on your companies needs!"
]
}

View File

@@ -0,0 +1,9 @@
{"business_name":"Artisan Bakery","business_motto":"The loaves are in the oven.","business_address":"1080 Headingley Lane, Headingley, Leeds, LS6 1BN","domain":"artisan-bakery.co.uk","office_telephone":"0113 222 1080","office_email":"orders@artisan-bakery.co.uk","industry":"Bakers","manager":{"name":"Maxie Durgan","address":"1080 Headingley Lane, Headingley, Leeds, LS6 1BN","phone_number":"07645 289149","email_address":"maxie@artisan-bakery.co.uk","username":"maxie","password":""},"employees":[{"name":"Matthew Riley","address":"1080 Headingley Lane, Headingley, Leeds, LS6 1BN","phone_number":"07876 518651","email_address":"matt@artisan-bakery.co.uk","username":"matt","password":""},{"name":"Emelie Lowe","address":"1080 Headingley Lane, Headingley, Leeds, LS6 1BN","phone_number":"07560 246931","email_address":"emelie@artisan-bakery.co.uk","username":"emelie","password":""},{"name":"Antonio Durgan","address":"1080 Headingley Lane, Headingley, Leeds, LS6 1BN","phone_number":"07943 250930","email_address":"antonio@artisan-bakery.co.uk","username":"antonio","password":""}],"product_name":"Baked goods","intro_paragraph":["Finest bakery in Headingley since 1900. Baked fresh daily. Bread loaves, teacakes, sweet and savoury treats. We are open from 9 am til 6 pm, every day except for bank holidays."]}
{"business_name":"Northern Banking","business_motto":"We'll keep your money safe!","business_address":"123 The Headrow, Leeds, LS1 5RD","domain":"northernbanking.co.uk","office_telephone":"0113 000 0123","office_email":"enquiries@northernbanking.co.uk","industry":"Finance","manager":{"name":"Heather Schmidt","address":"800 Bogisich Avenue, Oswaldohaven, Leeds, LS9 6NB","phone_number":"07836 581948","email_address":"h.schmidt@northernbanking.co.uk","username":"h_schmidt","password":""},"employees":[{"name":"Zion Jacobson","address":"104 Cole Square, ","phone_number":"07880 057670","email_address":"z.jacobson@northernbanking.co.uk","username":"z_jacobson","password":""},{"name":"Jonathan Ray","address":"644 Jackson Path, Leeds, LS2 4AJ","phone_number":"07893 001623","email_address":"j.ray@northernbanking.co.uk","username":"j_ray","password":""},{"name":"Virginia Sullivan","address":"23 Jane Street, Harrogate, HG1 4DJ","phone_number":"07826 576277","email_address":"v.sullivan@northernbanking.co.uk","username":"v_sullivan","password":""}],"product_name":"Financial Services","intro_paragraph":["About Northern Bank","With roots back to its establishment in Huddersfield, West Yorkshire in 1805. Northern bank has a strong personal customer base and business banking capability though a UK-wide network. Northern Bank is a trading name of Big Bank PLC."]}
{"business_name":"The Yorkshire Fitness Company","business_motto":"Get thi sen down't gym!","business_address":"15 Sheepscar Court, Leeds LS7 2BB","domain":"yorkshirefitco.co.uk","office_telephone":"0113 026 9999","office_email":"office@yorkshirefitco.co.uk","industry":"Health and Fitness","manager":{"name":"Jerry Rivera","address":"15 Sheepscar Court, Leeds LS7 2BB","phone_number":"0113 026 9999","email_address":"jerry.rivera@yorkshirefitco.co.uk","username":"jerry_rivera","password":""},"employees":[{"name":"Immanuel Bahringer IV","address":"15 Sheepscar Court, Leeds LS7 2BB","phone_number":"07688 112479","email_address":"immanuel.bahringer.iv@yorkshirefitco.co.uk","username":"immanuel_bahringer_iv","password":""},{"name":"Anne Hunter","address":"15 Sheepscar Court, Leeds LS7 2BB","phone_number":"07791 179177","email_address":"anne.hunter@yorkshirefitco.co.uk","username":"anne_hunter","password":""},{"name":"Katelin Langworth","address":"15 Sheepscar Court, Leeds LS7 2BB","phone_number":"07550 561978","email_address":"katelin.langworth@yorkshirefitco.co.uk","username":"katelin_langworth","password":""}],"product_name":"","intro_paragraph":["Experience Yorkshire's leading health and fitness club in the not far from the city centre. Established in 1990 The Yorkshire Fitness Company is committed to getting you the results you want.","If you like classes, the gym or a combo of both, our dedicated professional team of coaches & teachers are always available to motivate you and guide you towards your goals."]}
{"business_name":"Abacus Technology Solutions","business_motto":"Solving your problems so you don't have to.","business_address":"Unit 12, Lincoln St, Huddersfield HD1 6RX","domain":"abacus-technology.co.uk","office_telephone":"01484 850963","office_email":"office@abacus-technology.co.uk","industry":"IT Services","manager":{"name":"Ellie Bosco","address":"Office 1, Unit 12, Lincoln St, Huddersfield HD1 6RX","phone_number":"07528 347828","email_address":"e.bosco@abacus-technology.co.uk","username":"ebosco","password":""},"employees":[{"name":"Keara Harris","address":"Office 2, Unit 12, Lincoln St, Huddersfield HD1 6RX","phone_number":"07674 358645","email_address":"k.harris@abacus-technology.co.uk","username":"kharris","password":""},{"name":"Janessa Rempel","address":"Office 2, Unit 12, Lincoln St, Huddersfield HD1 6RX","phone_number":"07644 118595","email_address":"j.rempel@abacus-technology.co.uk","username":"jrempel","password":""},{"name":"Russell Ramirez","address":"Office 3, Unit 12, Lincoln St, Huddersfield HD1 6RX","phone_number":"01484 850963","email_address":"r.ramirez@abacus-technology.co.uk","username":"rramirez","password":""}],"product_name":"IT Solutions","intro_paragraph":["Providers of cloud services, backups, data recovery, hardware, off-the-shelf and bespoke software. 24/7 technical support available. Custom design and installation based on your companies needs!"]}
{"business_name":"Leeds Beckett","business_motto":"Computer Forensics and Security","business_address":"43 Church Wood Ave, Leeds LS16 5LF","domain":"leedsbeckett.ac.uk","office_telephone":"0113 81 23000","office_email":"study@leedsbeckett.ac.uk","industry":"Higher Education","manager":{"name":"Emlyn Butterfield","address":"115, Caedmon Hall, Headingley Campus","phone_number":"0113 81 24440","email_address":"E.Butterfield@leedsbeckett.ac.uk","username":"ebutterfield","password":""},"employees":[{"name":"Dr. Z. Cliffe Schreuders","address":"105, Caedmon Hall, Headingley Campus","phone_number":"0113 81 28608","email_address":"C.Schreuders@leedsbeckett.ac.uk","username":"zschreuders","password":""},{"name":"Dr. Maurice Calvert","address":"117, Caedmon, Headingley Campus","phone_number":"0113 81 27429","email_address":"M.Calvert@leedsbeckett.ac.uk","username":"mcalvert","password":""},{"name":"Dr. John Elliott","address":"108, Caedmon, Headingley Campus","phone_number":"0113 81 27379","email_address":"J.Elliott@leedsbeckett.ac.uk","username":"jelliott","password":""}],"product_name":"University Education","intro_paragraph":["Computer forensics involves the analysis of digital devices such as hard drives to identify and investigate their contents. Computer security involves using knowledge of computer systems and networks to protect businesses and users from malicious attacks.","This course combines these two fields of national importance and will teach you practical investigative and 'hacking' techniques. You will develop the skills to undertake rigorous forensic analysis and implement robust security mechanisms.","This is a hands-on course where you will learn through doing, gaining an in-depth knowledge of how to hack a computer to be able to protect it. You will learn where a computer hides data and how to recover information from a device."]}
{"business_name":"Leeds Beckett","business_motto":"Leeds Law School","business_address":"City Campus, Leeds LS1 3HE","domain":"leedsbeckett.ac.uk","office_telephone":"0113 81 23000","office_email":"study@leedsbeckett.ac.uk","industry":"Higher Education","manager":{"name":"Deveral Capps","address":"306, Portland Building, City Campus","phone_number":"0113 81 26085","email_address":"d.capps@leedsbeckett.ac.uk","username":"d_capps","password":""},"employees":[{"name":"Dr. Simon Hale-Ross","address":"306, Portland Building, City Campus","phone_number":"0113 8129526","email_address":"S.Haleross@leedsbeckett.ac.uk","username":"s_haleross","password":""},{"name":"Professor Simon Gardiner","address":"204, Rose Bowl, City Campus","phone_number":"0113 81 26414","email_address":"S.Gardiner@leedsbeckett.ac.uk","username":"s_gardiner","password":""},{"name":"Dr. Jessica Guth","address":"306, Portland Building, City Campus","phone_number":"0113 81 26403","email_address":"J.Guth@leedsbeckett.ac.uk","username":"j_guth","password":""}],"product_name":"University Education","intro_paragraph":["Our Law School sits in the heart of the great city of Leeds, the most important legal centre outside London and home to over 180 law firms employing in excess of 8,000 professionals. It is perfectly placed to ensure all our undergraduate, postgraduate, full and part-time students are able to mine the wealth of practical experience and employment opportunities available on our doorstep.","With state-of-the-art facilities, mentoring and career development opportunities, placements and a courtroom, students who choose Leeds Law School can expect a successful career founded on high calibre, practical teaching. We offer a broad variety of courses including our LLB, LLM Legal Practice (incorporating the LPC), LLM Qualifying Law Degree (incorporating the GDL) and LLM International Business Law, and each aims to give our graduates the enthusiasm, sharpness of mind and practical tools to thrive in competitive and fast-paced professional environments."]}
{"business_name":"Leeds Beckett","business_motto":"Music and Performing Arts","business_address":"43 Church Wood Ave, Leeds LS16 5LF","domain":"leedsbeckett.ac.uk","office_telephone":"0113 81 23000","office_email":"study@leedsbeckett.ac.uk","industry":"Higher Education","manager":{"name":"Dr Richard Stevens","address":"209, Caedmon, Headingley Campus","phone_number":"0113 81 23690","email_address":"R.C.Stevens@leedsbeckett.ac.uk","username":"r_stevens","password":""},"employees":[{"name":"Dr. Laura Griffiths","address":"Reception, Priestley Hall, Headingley Campus","phone_number":"n/a","email_address":"Laura.Griffiths@leedsbeckett.ac.uk","username":"l_griffiths","password":""},{"name":"Carl Flattery","address":"104, Caedmon, Headingley Campus","phone_number":"0113 81 27372","email_address":"C.Flattery@leedsbeckett.ac.uk","username":"c_flattery","password":""},{"name":"Sam Nicholls","address":"212, Caedmon, Headingley Campus","phone_number":"0113 81 23726","email_address":"S.Nicholls@leedsbeckett.ac.uk","username":"s_nicholls","password":""}],"product_name":"University Education","intro_paragraph":["The School of Film, Music & Performing Arts fosters a culture of creation and participation. We are proud shapers of, and contributors to, the cultural life of this great Northern city a city that is the original birthplace of film. We nurture the arts pioneers of the future: influencers who will not just reflect the outside world, but impact upon it."]}
{"business_name":"Yorkshire Personal Health","business_motto":"We'll have you as good as new in no time.","business_address":"159 Longlands St, Bradford BD1 2PX","domain":"yorkspersonalhealth.co.uk","office_telephone":"01274 200700","office_email":"info@yorkspersonalhealth.co.uk","industry":"Medical Services","manager":{"name":"Angela Dickinson","address":"76103 Joshuah Path, Port Magali, Cambridgeshire, R1 1TR","phone_number":"01274 200700 ext 100","email_address":"a.dickinson@yorkspersonalhealth.co.uk","username":"dickinson_a","password":""},"employees":[{"name":"Abdullah Carroll","address":"Office A, 160 Longlands St, Bradford BD1 2PX","phone_number":"01274 200700 ext 101","email_address":"a.carroll@yorkspersonalhealth.co.uk","username":"carroll_a","password":""},{"name":"Annie Williamson","address":"Office B, 160 Longlands St, Bradford BD1 2PX","phone_number":"01274 200700 ext 103","email_address":"a.williamson@yorkspersonalhealth.co.uk","username":"williamson_a","password":""},{"name":"Jammie Marks","address":"Office B, 160 Longlands St, Bradford BD1 2PX","phone_number":"01274 200700 ext 110","email_address":"j.marks@yorkspersonalhealth.co.uk","username":"marks_j","password":""}],"product_name":"Check up","intro_paragraph":["A health assessment is more than a check up. It can be the start of a journey towards better health.","We use our health expertise to build a clear picture of where your current health is and identify potential future health risks. After your health assessment, well give you guidance and support to help you become healthier today and in the future."]}
{"business_name":"Speedy Pizzas","business_motto":"Pizza done quick.","business_address":"195 Headingley Lane, Headingley, Leeds, LS6 1BN","domain":"speedypizzas.co.uk","office_telephone":"0113 123 3214","office_email":"info@speedypizzas.co.uk","industry":"Food","manager":{"name":"David Sand","address":"195 Headingley Lane, Headingley, Leeds, LS6 1BN","phone_number":"07879 635412","email_address":"dave@speedypizzas.co.uk","username":"d_sand","password":""},"employees":[{"name":"Cydney Hermann","address":"195 Headingley Lane, Headingley, Leeds, LS6 1BN","phone_number":"0113 123 3214","email_address":"cydney@speedypizzas.co.uk","username":"c_hermann","password":""},{"name":"Lori Marshall","address":"195 Headingley Lane, Headingley, Leeds, LS6 1BN","phone_number":"0113 123 3214","email_address":"lori@speedypizzas.co.uk","username":"l_marshall","password":""},{"name":"Andrea Martinez","address":"195 Headingley Lane, Headingley, Leeds, LS6 1BN","phone_number":"0113 123 3214","email_address":"andrea@speedypizzas.co.uk","username":"a_martinez","password":""}],"product_name":"Pizza","intro_paragraph":["Welcome to speedy pizzas. Piping hot food either in store or delivered to your door. Pizza takeaway, parmesan, kebabs and much more.","We are based in the centre of Headingley on Headingley lane and will deliver up to 3 miles for free, 1 quid per additional mile. Red hot pizza on delivery or your money back."]}

View File

@@ -0,0 +1,49 @@
{
"business_name": "Leeds Beckett- Computer Forensics and Security",
"business_motto": "",
"business_address": "43 Church Wood Ave, Leeds LS16 5LF",
"domain": "leedsbeckett.ac.uk",
"office_telephone": "0113 81 23000",
"office_email": "study@leedsbeckett.ac.uk",
"industry": "Higher Education",
"manager": {
"name": "Emlyn Butterfield",
"address": "115, Caedmon Hall, Headingley Campus",
"phone_number": "0113 81 24440",
"email_address": "E.Butterfield@leedsbeckett.ac.uk",
"username": "ebutterfield",
"password": ""
},
"employees": [
{
"name": "Dr. Z. Cliffe Schreuders",
"address": "105, Caedmon Hall, Headingley Campus",
"phone_number": "0113 81 28608",
"email_address": "C.Schreuders@leedsbeckett.ac.uk",
"username": "zschreuders",
"password": ""
},
{
"name": "Dr. Maurice Calvert",
"address": "117, Caedmon, Headingley Campus",
"phone_number": "0113 81 27429",
"email_address": "M.Calvert@leedsbeckett.ac.uk",
"username": "mcalvert",
"password": ""
},
{
"name": "Dr. John Elliott",
"address": "108, Caedmon, Headingley Campus",
"phone_number": "0113 81 27379",
"email_address": "J.Elliott@leedsbeckett.ac.uk",
"username": "jelliott",
"password": ""
}
],
"product_name": "University Education",
"intro_paragraph": [
"Computer forensics involves the analysis of digital devices such as hard drives to identify and investigate their contents. Computer security involves using knowledge of computer systems and networks to protect businesses and users from malicious attacks.",
"This course combines these two fields of national importance and will teach you practical investigative and 'hacking' techniques. You will develop the skills to undertake rigorous forensic analysis and implement robust security mechanisms.",
"This is a hands-on course where you will learn through doing, gaining an in-depth knowledge of how to hack a computer to be able to protect it. You will learn where a computer hides data and how to recover information from a device."
]
}

View File

@@ -0,0 +1,48 @@
{
"business_name": "Leeds Beckett- Leeds Law School",
"business_motto": "",
"business_address": "City Campus, Leeds LS1 3HE",
"domain": "leedsbeckett.ac.uk",
"office_telephone": "0113 81 23000",
"office_email": "study@leedsbeckett.ac.uk",
"industry": "Higher Education",
"manager": {
"name": "Deveral Capps",
"address": "306, Portland Building, City Campus",
"phone_number": "0113 81 26085",
"email_address": "d.capps@leedsbeckett.ac.uk",
"username": "d_capps",
"password": ""
},
"employees": [
{
"name": "Dr. Simon Hale-Ross",
"address": "306, Portland Building, City Campus",
"phone_number": "0113 8129526",
"email_address": "S.Haleross@leedsbeckett.ac.uk",
"username": "s_haleross",
"password": ""
},
{
"name": "Professor Simon Gardiner",
"address": "204, Rose Bowl, City Campus",
"phone_number": "0113 81 26414",
"email_address": "S.Gardiner@leedsbeckett.ac.uk",
"username": "s_gardiner",
"password": ""
},
{
"name": "Dr. Jessica Guth",
"address": "306, Portland Building, City Campus",
"phone_number": "0113 81 26403",
"email_address": "J.Guth@leedsbeckett.ac.uk",
"username": "j_guth",
"password": ""
}
],
"product_name": "University Education",
"intro_paragraph": [
"Our Law School sits in the heart of the great city of Leeds, the most important legal centre outside London and home to over 180 law firms employing in excess of 8,000 professionals. It is perfectly placed to ensure all our undergraduate, postgraduate, full and part-time students are able to mine the wealth of practical experience and employment opportunities available on our doorstep.",
"With state-of-the-art facilities, mentoring and career development opportunities, placements and a courtroom, students who choose Leeds Law School can expect a successful career founded on high calibre, practical teaching. We offer a broad variety of courses including our LLB, LLM Legal Practice (incorporating the LPC), LLM Qualifying Law Degree (incorporating the GDL) and LLM International Business Law, and each aims to give our graduates the enthusiasm, sharpness of mind and practical tools to thrive in competitive and fast-paced professional environments."
]
}

View File

@@ -0,0 +1,47 @@
{
"business_name": "Leeds Beckett- Music and Performing Arts",
"business_motto": "",
"business_address": "43 Church Wood Ave, Leeds LS16 5LF",
"domain": "leedsbeckett.ac.uk",
"office_telephone": "0113 81 23000",
"office_email": "study@leedsbeckett.ac.uk",
"industry": "Higher Education",
"manager": {
"name": "Dr Richard Stevens",
"address": "209, Caedmon, Headingley Campus",
"phone_number": "0113 81 23690",
"email_address": "R.C.Stevens@leedsbeckett.ac.uk",
"username": "r_stevens",
"password": ""
},
"employees": [
{
"name": "Dr. Laura Griffiths",
"address": "Reception, Priestley Hall, Headingley Campus",
"phone_number": "n/a",
"email_address": "Laura.Griffiths@leedsbeckett.ac.uk",
"username": "l_griffiths",
"password": ""
},
{
"name": "Carl Flattery",
"address": "104, Caedmon, Headingley Campus",
"phone_number": "0113 81 27372",
"email_address": "C.Flattery@leedsbeckett.ac.uk",
"username": "c_flattery",
"password": ""
},
{
"name": "Sam Nicholls",
"address": "212, Caedmon, Headingley Campus",
"phone_number": "0113 81 23726",
"email_address": "S.Nicholls@leedsbeckett.ac.uk",
"username": "s_nicholls",
"password": ""
}
],
"product_name": "University Education",
"intro_paragraph": [
"The School of Film, Music & Performing Arts fosters a culture of creation and participation. We are proud shapers of, and contributors to, the cultural life of this great Northern city a city that is the original birthplace of film. We nurture the arts pioneers of the future: influencers who will not just reflect the outside world, but impact upon it."
]
}

View File

@@ -0,0 +1,48 @@
{
"business_name": "Yorkshire Personal Health",
"business_motto": "We'll have you as good as new in no time.",
"business_address": "159 Longlands St, Bradford BD1 2PX",
"domain": "yorkspersonalhealth.co.uk",
"office_telephone": "01274 200700",
"office_email": "info@yorkspersonalhealth.co.uk",
"industry": "Medical Services",
"manager": {
"name": "Angela Dickinson",
"address": "76103 Joshuah Path, Port Magali, Cambridgeshire, R1 1TR",
"phone_number": "01274 200700 ext 100",
"email_address": "a.dickinson@yorkspersonalhealth.co.uk",
"username": "dickinson_a",
"password": ""
},
"employees": [
{
"name": "Abdullah Carroll",
"address": "Office A, 160 Longlands St, Bradford BD1 2PX",
"phone_number": "01274 200700 ext 101",
"email_address": "a.carroll@yorkspersonalhealth.co.uk",
"username": "carroll_a",
"password": ""
},
{
"name": "Annie Williamson",
"address": "Office B, 160 Longlands St, Bradford BD1 2PX",
"phone_number": "01274 200700 ext 103",
"email_address": "a.williamson@yorkspersonalhealth.co.uk",
"username": "williamson_a",
"password": ""
},
{
"name": "Jammie Marks",
"address": "Office B, 160 Longlands St, Bradford BD1 2PX",
"phone_number": "01274 200700 ext 110",
"email_address": "j.marks@yorkspersonalhealth.co.uk",
"username": "marks_j",
"password": ""
}
],
"product_name": "Check up",
"intro_paragraph": [
"A health assessment is more than a check up. It can be the start of a journey towards better health.",
"We use our health expertise to build a clear picture of where your current health is and identify potential future health risks. After your health assessment, well give you guidance and support to help you become healthier today and in the future."
]
}

View File

@@ -0,0 +1,47 @@
{
"business_name": "",
"business_motto": "",
"business_address": "",
"domain": "",
"office_telephone": "",
"office_email": "",
"industry": "",
"manager": {
"name": "",
"address": "",
"phone_number": "",
"email_address": "",
"username": "",
"password": ""
},
"employees": [
{
"name": "",
"address": "",
"phone_number": "",
"email_address": "",
"username": "",
"password": ""
},
{
"name": "",
"address": "",
"phone_number": "",
"email_address": "",
"username": "",
"password": ""
},
{
"name": "",
"address": "",
"phone_number": "",
"email_address": "",
"username": "",
"password": ""
}
],
"product_name": "",
"intro_paragraph": [
""
]
}

View File

@@ -0,0 +1,48 @@
{
"business_name": "Speedy Pizzas",
"business_motto": "Pizza done quick.",
"business_address": "195 Headingley Lane, Headingley, Leeds, LS6 1BN",
"domain": "speedypizzas.co.uk",
"office_telephone": "0113 123 3214",
"office_email": "info@speedypizzas.co.uk",
"industry": "Food",
"manager": {
"name": "David Sand",
"address": "195 Headingley Lane, Headingley, Leeds, LS6 1BN",
"phone_number": "07879 635412",
"email_address": "dave@speedypizzas.co.uk",
"username": "d_sand",
"password": ""
},
"employees": [
{
"name": "Cydney Hermann",
"address": "195 Headingley Lane, Headingley, Leeds, LS6 1BN",
"phone_number": "0113 123 3214",
"email_address": "cydney@speedypizzas.co.uk",
"username": "c_hermann",
"password": ""
},
{
"name": "Lori Marshall",
"address": "195 Headingley Lane, Headingley, Leeds, LS6 1BN",
"phone_number": "0113 123 3214",
"email_address": "lori@speedypizzas.co.uk",
"username": "l_marshall",
"password": ""
},
{
"name": "Andrea Martinez",
"address": "195 Headingley Lane, Headingley, Leeds, LS6 1BN",
"phone_number": "0113 123 3214",
"email_address": "andrea@speedypizzas.co.uk",
"username": "a_martinez",
"password": ""
}
],
"product_name": "Pizza",
"intro_paragraph": [
"Welcome to speedy pizzas. Piping hot food either in store or delivered to your door. Pizza takeaway, parmesan, kebabs and much more.",
"We are based in the centre of Headingley on Headingley lane and will deliver up to 3 miles for free, £1 per additional mile. Red hot pizza on delivery or your money back."
]
}

View File

@@ -23,6 +23,7 @@
<xs:restriction base="xs:string">
<xs:enumeration value="remote"/>
<xs:enumeration value="local"/>
<xs:enumeration value="physical"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="platformOptions">
@@ -276,4 +277,4 @@
</xs:complexType>
</xs:element>
</xs:schema>
</xs:schema>

View File

@@ -0,0 +1,61 @@
#!/usr/bin/ruby
require_relative '../../../../../lib/objects/local_string_encoder.rb'
class RandomSelectorEncoder < StringEncoder
attr_accessor :position
attr_accessor :file_path
def initialize
super
self.module_name = 'Random Line Selector'
self.file_path = ''
self.position = ''
end
# @return [Array[string]] containing selected string from file
def encode_all
selected_string = ''
unless file_path.include? '..'
path = "#{ROOT_DIR}/#{file_path}"
file_lines = File.readlines(path)
selected_string = if !position.nil? && (position != '')
file_lines[position.to_i - 1]
else
file_lines.sample
end
end
outputs << selected_string.chomp
end
def process_options(opt, arg)
super
case opt
# Removes any non-alphabet characters
when '--position'
position << arg
when '--file_path'
file_path << arg
else
# do nothing
end
end
def get_options_array
super + [['--position', GetoptLong::OPTIONAL_ARGUMENT],
['--file_path', GetoptLong::OPTIONAL_ARGUMENT]]
end
def encoding_print_string
string = "file_path: #{file_path}"
unless position.to_s.empty?
string += print_string_padding + "position: #{position}"
end
string
end
end
RandomSelectorEncoder.new.run

View File

@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<encoder xmlns="http://www.github/cliffe/SecGen/encoder"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.github/cliffe/SecGen/encoder">
<name>Random Line Selector</name>
<author>Thomas Shaw</author>
<module_license>MIT</module_license>
<description>Randomly selects one of the lines from a file and discards the rest.
Optionally pick position in a list (indexed from 1 - in the list [a,b,c] a is in pos 1, b is in pos 2, etc.)
</description>
<type>line_selector</type>
<platform>linux</platform>
<platform>windows</platform>
<read_fact>file_path</read_fact>
<read_fact>position</read_fact>
<output_type>selected_string</output_type>
</encoder>

View File

@@ -6,7 +6,7 @@ class RandomSelectorEncoder < StringEncoder
def initialize
super
self.module_name = 'Random String Selector'
self.position = 'test'
self.position = ''
end
def encode_all

View File

@@ -0,0 +1,20 @@
#!/usr/bin/ruby
require_relative '../../../../../lib/objects/local_string_encoder.rb'
require 'faker'
class WebsiteThemeSelector < StringEncoder
def initialize
super
self.module_name = 'Website Theme Selector'
end
# Selects one of the parameterised_website css themes and returns it
def encode_all
filenames = Dir.entries("#{ROOT_DIR}/modules/services/unix/http/parameterised_website/files/themes/").reject {|f| File.directory?(f) || f[0].include?('.')}
self.outputs << filenames.sample
end
end
WebsiteThemeSelector.new.run

View File

@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<generator xmlns="http://www.github/cliffe/SecGen/generator"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.github/cliffe/SecGen/generator">
<name>Website Theme Generator</name>
<author>Thomas Shaw</author>
<module_license>MIT</module_license>
<description>Theme selector for parameterised_website module.</description>
<type>website_theme</type>
<platform>linux</platform>
<platform>windows</platform>
<output_type>string</output_type>
</generator>

View File

@@ -12,6 +12,7 @@ class RandomOrganisationGenerator < StringEncoder
attr_accessor :manager
attr_accessor :employees
attr_accessor :product_name
attr_accessor :intro_paragraph
def initialize
super
@@ -26,6 +27,7 @@ class RandomOrganisationGenerator < StringEncoder
self.manager = {}
self.employees = []
self.product_name = ''
self.intro_paragraph = []
end
def encode_all
@@ -40,6 +42,7 @@ class RandomOrganisationGenerator < StringEncoder
organisation_hash['manager'] = self.manager
organisation_hash['employees'] = self.employees
organisation_hash['product_name'] = self.product_name
organisation_hash['intro_paragraph'] = self.intro_paragraph
self.outputs << organisation_hash.to_json
end
@@ -54,7 +57,8 @@ class RandomOrganisationGenerator < StringEncoder
['--industry', GetoptLong::REQUIRED_ARGUMENT],
['--manager', GetoptLong::REQUIRED_ARGUMENT],
['--employees', GetoptLong::REQUIRED_ARGUMENT],
['--product_name', GetoptLong::REQUIRED_ARGUMENT]]
['--product_name', GetoptLong::REQUIRED_ARGUMENT],
['--intro_paragraph', GetoptLong::REQUIRED_ARGUMENT]]
end
def process_options(opt, arg)
@@ -80,6 +84,8 @@ class RandomOrganisationGenerator < StringEncoder
self.employees << JSON.parse(arg);
when '--product_name'
self.product_name << arg;
when '--intro_paragraph'
self.intro_paragraph << arg;
end
end
@@ -93,7 +99,8 @@ class RandomOrganisationGenerator < StringEncoder
'industry: ' + self.industry.to_s + print_string_padding +
'manager: ' + self.manager.to_s + print_string_padding +
'employees: ' + self.employees.to_s + print_string_padding +
'product_name: ' + self.product_name.to_s
'product_name: ' + self.product_name.to_s +
'intro_paragraph: ' + self.intro_paragraph.to_s
end
end

View File

@@ -25,6 +25,7 @@
<read_fact>manager</read_fact>
<read_fact>employees</read_fact>
<read_fact>product_name</read_fact>
<read_fact>intro_paragraph</read_fact>
<default_input into="business_name">
<generator type="business_name"/>
@@ -58,6 +59,9 @@
<default_input into="product_name">
<generator type="product"/>
</default_input>
<default_input into="intro_paragraph">
<generator type="paragraph_generator"/>
</default_input>
<output_type>account</output_type>
</generator>

View File

@@ -12,6 +12,7 @@ class RealOrganisationGenerator < StringEncoder
attr_accessor :manager
attr_accessor :employees
attr_accessor :product_name
attr_accessor :intro_paragraph
attr_accessor :filler_char
def initialize
@@ -27,6 +28,7 @@ class RealOrganisationGenerator < StringEncoder
self.manager = {}
self.employees = []
self.product_name = ''
self.intro_paragraph = []
self.filler_char = %w(_ -).sample
end
@@ -59,6 +61,7 @@ class RealOrganisationGenerator < StringEncoder
organisation_hash['manager'] = self.manager
organisation_hash['employees'] = self.employees
organisation_hash['product_name'] = self.product_name
organisation_hash['intro_paragraph'] = self.intro_paragraph
self.outputs << organisation_hash.to_json
end
@@ -88,7 +91,8 @@ class RealOrganisationGenerator < StringEncoder
['--industry', GetoptLong::REQUIRED_ARGUMENT],
['--manager', GetoptLong::REQUIRED_ARGUMENT],
['--employees', GetoptLong::REQUIRED_ARGUMENT],
['--product_name', GetoptLong::REQUIRED_ARGUMENT]]
['--product_name', GetoptLong::REQUIRED_ARGUMENT],
['--intro_paragraph', GetoptLong::REQUIRED_ARGUMENT]]
end
def process_options(opt, arg)
@@ -114,6 +118,8 @@ class RealOrganisationGenerator < StringEncoder
self.employees << JSON.parse(arg);
when '--product_name'
self.product_name << arg;
when '--intro_paragraph'
self.intro_paragraph << arg;
end
end
@@ -127,7 +133,8 @@ class RealOrganisationGenerator < StringEncoder
'industry: ' + self.industry.to_s + print_string_padding +
'manager: ' + self.manager.to_s + print_string_padding +
'employees: ' + self.employees.to_s + print_string_padding +
'product_name: ' + self.product_name.to_s
'product_name: ' + self.product_name.to_s +
'intro_paragraph: ' + self.intro_paragraph.to_s
end
end

View File

@@ -27,6 +27,7 @@
<read_fact>manager</read_fact>
<read_fact>employees</read_fact>
<read_fact>product_name</read_fact>
<read_fact>intro_paragraph</read_fact>
<default_input into="business_name">
<generator type="business_name"/>
@@ -60,6 +61,10 @@
<default_input into="product_name">
<generator type="product"/>
</default_input>
<default_input into="intro_paragraph">
<generator type="paragraph_generator"/>
</default_input>
<output_type>account</output_type>
</generator>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,7 @@
class parameterised_website::install {
$secgen_parameters = secgen_functions::get_parameters($::base64_inputs_file)
$theme = $secgen_parameters['theme'][0]
$raw_org = $secgen_parameters['organisation'][0]
if $raw_org and $raw_org != '' {
$organisation = parsejson($raw_org)
@@ -16,6 +17,7 @@ class parameterised_website::install {
$industry = $organisation['industry']
$product_name = $organisation['product_name']
$employees = $organisation['employees']
$intro_paragraph = $organisation['intro_paragraph']
} else {
$business_name = ''
$business_motto = ''
@@ -26,10 +28,10 @@ class parameterised_website::install {
$industry = ''
$product_name = ''
$employees = []
$intro_paragraph = []
}
$strings_to_leak = $secgen_parameters['strings_to_leak']
$main_page_paragraph_content = $secgen_parameters['main_page_paragraph_content']
$images_to_leak = $secgen_parameters['images_to_leak']
$security_audit = $secgen_parameters['security_audit']
@@ -40,6 +42,12 @@ class parameterised_website::install {
$white_text = $secgen_parameters['white_text']
if $intro_paragraph != '' {
$main_page_paragraph_content = $intro_paragraph
} else {
$main_page_paragraph_content = $secgen_parameters['main_page_paragraph_content']
}
# Additional Pages
$additional_pages = $secgen_parameters['additional_pages']
$additional_page_filenames = $secgen_parameters['additional_page_filenames']
@@ -77,6 +85,13 @@ class parameterised_website::install {
require => File["$docroot/css"],
}
# Add randomly selected CSS theme
file { "$docroot/css/$theme":
ensure => file,
source => "puppet:///modules/parameterised_website/themes/$theme",
require => File[$docroot],
}
# Apply index page template
file { "$docroot/index.html":
ensure => file,

View File

@@ -11,6 +11,7 @@
<type>http</type>
<platform>linux</platform>
<!-- Strings are leaked in index.html source code comments -->
<read_fact>strings_to_leak</read_fact>
<read_fact>images_to_leak</read_fact>
<read_fact>organisation</read_fact>
@@ -28,6 +29,7 @@
<read_fact>hidden_tabs</read_fact>
<read_fact>port</read_fact>
<read_fact>theme</read_fact>
<default_input into="port">
<value>80</value>
@@ -35,6 +37,7 @@
<default_input into="strings_to_leak">
<generator type="message_generator"/>
<generator type="message_generator"/>
</default_input>
<default_input into="organisation">
@@ -49,6 +52,10 @@
<value>false</value>
</default_input>
<default_input into="theme">
<generator type="website_theme"/>
</default_input>
<requires>
<module_path>.*apache</module_path>
<type>httpd</type>

View File

@@ -4,6 +4,6 @@
<body>
<%= scope.function_template(['parameterised_website/subtemplates/navbar.html.erb']) %>
<%= scope.function_template(['parameterised_website/subtemplates/acceptable_use_policy.html.erb']) %>
<%= scope.function_template(['parameterised_website/subtemplates/scripts.html.erb']) %>
</body>
<%= scope.function_template(['parameterised_website/subtemplates/footer.html.erb']) %>
</html>

View File

@@ -2,42 +2,48 @@
<html>
<%= scope.function_template(['parameterised_website/subtemplates/header.html.erb']) %>
<body>
<%= scope.function_template(['parameterised_website/subtemplates/navbar.html.erb']) %>
<div id="main_container" class="container">
<div class="row">
<div class="col-lg-12">
<div class="intro-text">
<h1 class="name"><%= @business_name %></h1>
<hr class="star-light">
<h3> <%= @business_motto %></h3>
<%= scope.function_template(['parameterised_website/subtemplates/navbar.html.erb']) %>
<div id="main_container" class="container">
<div class="row">
<div class="col-lg-12">
<div class="intro-text">
<h1 class="name"><%= @business_name %></h1>
<hr class="star-light">
<h3> <%= @business_motto %></h3>
</div>
</div>
<div id="business_address">
<p><strong>Contact <%= @business_name %></strong></p>
<p>Address: <%= @business_address %></p>
<p>Telephone: <%= @office_telephone %></p>
<p>Email: <%= @office_email %></p>
<div class="col-lg-12" id="contact">
<div>
<h2>Contact <%= @business_name %></h2>
<p>Address: <%= @business_address %></p>
<p>Telephone: <%= @office_telephone %></p>
<p>Email: <%= @office_email %></p>
</div>
</div>
<div id="manager">
<h4>Manager</h4>
<p><%= @manager_profile['name'] %></p>
<p><%= @manager_profile['phone_number'] %></p>
<p><%= @manager_profile['email_address'] %></p>
<div class="col-lg-12">
<div class="employee">
<h2>Manager</h2>
<p><%= @manager_profile['name'] %></p>
<p><%= @manager_profile['phone_number'] %></p>
<p><%= @manager_profile['email_address'] %></p>
</div>
</div>
<h4>Employees</h4>
<% @employees.each do |employee| -%>
<p><strong><%= employee['name'] %></strong></p>
<p><%= employee['phone_number'] %></p>
<p><%= employee['email_address'] %></p>
<p/>
<% end %>
<div class="col-lg-12" id="employees">
<h2>Employees</h2>
<% @employees.each do |employee| -%>
<div class="col-lg-4">
<div class="employee">
<p><strong><%= employee['name'] %></strong></p>
<p><%= employee['phone_number'] %></p>
<p><%= employee['email_address'] %></p>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
<%= scope.function_template(['parameterised_website/subtemplates/scripts.html.erb']) %>
</body>
<%= scope.function_template(['parameterised_website/subtemplates/footer.html.erb']) %>
</html>

View File

@@ -1,13 +1,31 @@
body {
background: #f8f8f8;
color: #666;
padding-top: 70px;
padding-top:120px;
font-size: 2rem;
}
body p {
align-content: center
h1 {
font-size: 4rem;
}
.navbar-brand {
font-size: 2.25rem;
}
.lead {
font-size: 2.5rem;
}
.employee {
font-size: 1.75rem;
padding-top: 20px;
}
#contact, #employees {
padding-top: 20px;
}
<% if @white_text -%>
#white_text {
color: white;

View File

@@ -8,6 +8,7 @@
<body>
<%= scope.function_template(['parameterised_website/subtemplates/navbar.html.erb']) %>
<%= scope.function_template(['parameterised_website/subtemplates/main_container.html.erb']) %>
<%= scope.function_template(['parameterised_website/subtemplates/scripts.html.erb']) %>
<%= scope.function_template(['parameterised_website/subtemplates/scripts.html.erb']) %>
</body>
<%= scope.function_template(['parameterised_website/subtemplates/footer.html.erb']) %>
</html>

View File

@@ -4,6 +4,6 @@
<body>
<%= scope.function_template(['parameterised_website/subtemplates/navbar.html.erb']) %>
<%= scope.function_template(['parameterised_website/subtemplates/main_container.html.erb']) %>
<%= scope.function_template(['parameterised_website/subtemplates/scripts.html.erb']) %>
</body>
<%= scope.function_template(['parameterised_website/subtemplates/footer.html.erb']) %>
</html>

View File

@@ -10,6 +10,6 @@
</div>
</div>
</div>
<%= scope.function_template(['parameterised_website/subtemplates/scripts.html.erb']) %>
</body>
<%= scope.function_template(['parameterised_website/subtemplates/footer.html.erb']) %>
</html>

View File

@@ -1,7 +0,0 @@
<footer>
<!-- Latest compiled JavaScript -->
<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/default.js"></script>
</footer>

View File

@@ -7,7 +7,8 @@
<title><%= $page_title %></title>
<!-- Default stylesheet -->
<link rel="stylesheet" type="text/css" href="css/default.css"/>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/bootstrap.min.css" media="screen"/>
<link rel="stylesheet" href="css/<%= @theme %>" />
<link rel="stylesheet" href="css/default.css"/>
</head>

View File

@@ -1,37 +1,48 @@
<div id="main_container" class="container">
<div class="row">
<div class="main_page_content">
<% # Intranet style -%>
<% if @security_audit or @acceptable_use_policy -%>
<p class="lead">Welcome to the internal intranet server for <%=@business_name%>.</p>
<% if @security_audit -%>
<p>Find your Security Audit Remit <a href="security_audit_remit.html">here</a>.</p>
<% end -%>
<% if @acceptable_use_policy -%>
<p>Find the Acceptable Use Policy <a href="acceptable_use_policy.html">here</a>.</p>
<% end -%>
<% # Externally input / default style -%>
<% elsif @manager_profile != '' or @employees[0] != '' or @business_address != ''-%>
<h1><%= @business_name %></h1>
<h2><%= @product_name %></h2>
<p><%= @main_page_paragraph_content.join %></p>
<% elsif @main_page_paragraph_content-%>
<p><%= @main_page_paragraph_content.join %></p>
<% end -%>
<br/>
<div class="container">
<% if @business_name != ''-%>
<div class="page-header" id="banner">
<div class="row">
<div class="col-lg-8 col-md-7 col-sm-6">
<h1><%= @business_name %></h1>
<% if @business_motto != ''-%>
<p class="lead"><%= @business_motto %></p>
<% end -%>
</div>
</div>
</div>
<% end -%>
<% if @visible_tabs and @visible_tabs[0] != '' -%>
<%= scope.function_template(['parameterised_website/subtemplates/tab_panel.html.erb']) %>
<% end -%>
<div class="bs-docs-section clearfix">
<div class="row">
<div class="main_page_content">
<% # Intranet style -%>
<% if @security_audit or @acceptable_use_policy -%>
<p class="lead">Welcome to the internal intranet server for <%= @business_name %>.</p>
<% if @security_audit -%>
<p>Find your Security Audit Remit <a href="security_audit_remit.html">here</a>.</p>
<% end -%>
<% if @acceptable_use_policy -%>
<p>Find the Acceptable Use Policy <a href="acceptable_use_policy.html">here</a>.</p>
<% end -%>
<% end -%>
<% @main_page_paragraph_content.each do |pg| -%>
<p> <%= pg %></p>
<% end -%>
<br/>
<br/>
<% if @images_to_leak -%>
<% @images_to_leak.each_with_index{ |img, counter| -%>
<% unless img == '' -%>
<img src="image<%=counter + 1 %>.png" height="128" width="128">
<% end -%>
<% } -%>
<% end -%>
<% if @visible_tabs and @visible_tabs[0] != '' -%>
<%= scope.function_template(['parameterised_website/subtemplates/tab_panel.html.erb']) %>
<% end -%>
<br/>
<% if @images_to_leak -%>
<% @images_to_leak.each_with_index {|img, counter| -%>
<% unless img == '' -%>
<img src="image<%= counter + 1 %>.png" height="128" width="128">
<% end -%>
<% } -%>
<% end -%>
</div>
</div>
</div>
</div>

View File

@@ -1,16 +1,17 @@
<nav class="navbar navbar-inverse navbar-fixed-top">
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
<div class="container">
<div id="navbar" class="collapse navbar-collapse">
<div class="navbar-brand"><%= @business_name %></div>
<div class="collapse navbar-collapse" id="navbarResponsive" >
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
<li class="nav-item"><a class="nav-link" href="index.html">Home</a></li>
<% if @organisation and @organisation != '' -%>
<li><a href="contact.html">Contact Us</a></li>
<li class="nav-item"><a class="nav-link" href="contact.html">Contact Us</a></li>
<% end -%>
<% if @security_audit -%>
<li><a href="security_audit_remit.html">Security Audit Remit</a></li>
<li class="nav-item"><a class="nav-link" href="security_audit_remit.html">Security Audit Remit</a></li>
<% end -%>
<% if @acceptable_use_policy -%>
<li><a href="acceptable_use_policy.html">Acceptable Use Policy</a></li>
<li class="nav-item"><a class="nav-link" href="acceptable_use_policy.html">Acceptable Use Policy</a></li>
<% end -%>
</ul>
</div><!--/.nav-collapse -->

View File

@@ -0,0 +1,5 @@
<!-- Latest compiled JavaScript -->
<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/default.js"></script>

View File

@@ -0,0 +1,231 @@
## Supported Release 1.7.0
### Summary
This release adds support for internationalization of the module. It also contains Japanese translations for the README, summary and description of the metadata.json and major cleanups in the README. Additional folders have been introduced called locales and readmes where translation files can be found. A number of features and bug fixes are also included in this release.
#### Features
- Addition of POT file for metadata translation for i18n.
- Readme update and edit in preparation for localization.
- Environment can now be passed through to staging, so we can set a proxy to download tomcat.
- Add optional `$type` parameter to globalnamingresources that allows the definition of the element to be used. Use "Environment" to set an environment.
- Allow the resource name to be overridden with a new `$resource_name` parameter.
- Added Ubuntu Xenial support to metadata.
- Bump in puppet-staging module dependancy for allowing newer versions.
- Ability to not manage catalina.properties.
#### Bugfixes
- (MODULES-4003) Adds a 'require => Tomcat::Install[$name]' to the ensure_resource function.
- (MODULES-4003) Removes logic that checks to see if catalina_base and catalina_home are the same.
- (MODULES-1986) Added newline to the inline template assigned to $_content.
- (MODULES-3224) Added mode attribute to concat resource that sets the executable bit for all permission levels.
- Fix for fixtures.yml, was pointing to nanliu-staging instead of puppet-staging.
- Fix duplicate resources in host/realm/valve.
- Fix faulty header and link in ToC.
- (MODULES-4528) Replace Puppet.version.to_f version comparison from spec_helper.rb.
- Puppet lint warning fix.
- (FM-6166) Updating tomcat tar mirror and test failure message.
- (FM-6166) Removing concat-fragment 'ensure'
## Supported Release 1.6.1
### Summary
This release removes an attempted bugfix made in 1.6.0 for working around strict
umasks. The previous change caused duplicate resource declarations when
downloading a tomcat tarball from `puppet://` or local paths. The umask bug
remains (it is actually present in staging, not tomcat).
#### Bugfixes
- Fix duplicate resource declarations when using local source paths
## Supported Release 1.6.0
### Summary
This release adds two new defines for managing environment variables and manager elements, enhances multi-instance multi-user support, allows valves to be nested in contexts, fixes an issue with installing directly to NFS mounted directories, fixes installation on systems with a strict root umask,
#### Features
- Add `tomcat::config::context::environment` define
- Add `tomcat::config::context::manager` define
- Add `owner` and `group` to `tomcat::config::server::tomcat_users`
- Add `parent_context` to `tomcat::config::server::valve`
- Add `manage_home` and `manage_base` to `tomcat` class
- Add `manage_home` to `tomcat::install`
- Add `manage_base` to `tomcat::instance`
- Add `doexport` (MODULES-3436), `user`, and `group` to `tomcat::setenv::entry`
- Change from `nanliu/staging` to `puppet/staging`
- Allow `role` to be set for user elements in `tomcat::config::server::tomcat_users`
#### Bugfixes
- Fix globalresource missing (MODULES-3353)
- Fix strict vars for `tomcat::config::server::service` (MODULES-3742)
- Work around duplicate user resources (PUP-5971)
## Supported Release 1.5.0
### Summary
General rewrite of the installation and instance management code, and better
service management. Plus a handful of new configuration defined types and actual
resource dependency ordering.
The primary improvement is that you may now use `tomcat::install` for installing
various versions of tomcat into various directories (`CATALINA_HOME`), then use
`tomcat::instance` to create instances from those installs (`CATALINA_BASE`).
Previously `tomcat::instance` treated both `CATALINA_HOME` and `CATALINA_BASE` as identical and thus only allowed a single tomcat instance per tomcat installation.
Additionally, `tomcat::service` allows `use_init => true, use_jsvc => true` to
create an init script for service management of source-based installs. And
`tomcat::instance` can declare a `tomcat::service` resource for your instance to
make life easier.
#### Features
- Added `tomcat::config::properties::property` define
- Added `tomcat::config::server::globalnamingresource` define
- Added `tomcat::config::context` define
- Added `tomcat::config::context::resource` define
- Added `tomcat::config::context::resourcelink` define
- Added `tomcat::install` define
- Added `tomcat::config::server::host::aliases` parameter
- Added `tomcat::service::user` parameter
- Added `tomcat::setenv::entry` parameters:
- `catalina_home`
- `addto`
- Added `tomcat::instance` parameters for multi-instance management:
- `user`
- `group`
- `manage_user`
- `manage_group`
- `manage_service`
- `java_home`
- `use_jsvc`
- `use_init`
- Added Debian 8 compatibility
#### Bugfixes
- Fixed conflating `CATALINA_BASE` with `CATALINA_HOME`
- Made `tomcat::config::server::connector` protocol default to `$name`
- Lots of additional validation
- Added resource dependency declaration (so no more `<-` `->` needed)
- Undeprecated `tomcat::setenv::entry::order` parameter
## Supported Release 1.4.1
### Summary
Small release for bug with multiple Realms in the same parent path.
#### Features
- Improved documentation for purging connectors.
- Improved documentation for purging realms.
- Added package_options to tomcat::instance
#### Bugfixes
- Fixed bug where multiple Realms in the same parent would corrupt data.
- Added work-around for Augeas bug when purging Realms.
## Supported Release 1.3.3
###Summary
Small release for support of newer PE versions. This increments the version of PE in the metadata.json file.
## 2015-08-11 - Supported Release 1.3.2
### Summary
This release fixes username quoting and metadata.
#### Bugfixes
- Allow username values that contain non-string characters like whitespace
- Validate $catalina\_base
- Correct pe/puppet compatibility metadata
## 2015-07-16 - Supported Release 1.3.1
### Summary
This release fixes metadata because it supports puppet 4.
## 2015-06-09 - Supported Release 1.3.0
### Summary
This is a feature release, with a couple of bugfixes and readme changes.
#### Features
- Update additional_attributes to support values with spaces
- Documentation changes
- Add a manifest for Context Containers in Tomcat configuration
- Manage User and Roles in Realms
- New manifests for context.xml configuration
- Added manifest for managing Realm elements in server.xml
- Ordering of setenv entries
- Adds parameter for enabling Tomcat service on boot
- Add ability to specify server_config location
- Allow configuration of location of server.xml
#### Bugfixes
- Make sure setenv entries have export
- Test improvements
- version pinning for acceptance tests
## 2014-11-11 - Supported Release 1.2.0
### Summary
This is primarily a feature release, with a couple of bugfixes for tests and metadata.
#### Features
- Add `install_from_source` parameter to class `tomcat`
- Add `purge_connectors` parameter to class `tomcat` and define `tomcat::server::connector`
#### Bugfixes
- Fix dependencies to remove missing dependency warnings with the PMT
- Use `curl -k` in the tests
## 2014-10-28 - Supported Release 1.1.0
### Summary
This release includes documentation and test updates, strict variable support, metadata bugs, and added support for multiple connectors with the same protocol.
### Features
- Strict variable support
- Support multiple connectors with the same protocol
- Update tests to not break when tomcat releases happen
- Update README based on QA feedback
### Bugfixes
- Update stdlib requirement to 4.2.0
- Fix illegal version range in metadata.json
- Fix typo in README
## 2014-09-04 - Supported Release 1.0.1
### Summary
This is a bugfix release.
### Bugfixes
- Fix typo in tomcat::instance
- Update acceptance tests for new tomcat releases
## 2014-08-27 - Supported Release 1.0.0
### Summary
This release has added support for installation from packages, improved WAR management, and updates to testing and documentation.
### Features
- Updated tomcat::setenv::entry to better support installations from package
- Added the ability to purge auto-exploded WAR directories when removing WARs. Defaults to purging these directories
- Added warnings for unused variables when installing from package
- Updated acceptance tests and nodesets
- Updated README
### Deprecations
- $tomcat::setenv::entry::base_path is being deprecated in favor of $tomcat::setenv::entry::config_file
## 2014-08-20 - Release 0.1.2
### Summary
This release adds compatibility information and updates the README with information on the requirement of augeas >= 1.0.0.
## 2014-08-14 - Release 0.1.1
### Summary
This is a bugfix release.
### Bugfixes
- Update 'warn' to correct 'warning' function.
- Update README for use_init.
- Test updates and fixes.
## 2014-08-06 - Release 0.1.0
### Summary
Initial release of the tomcat module.

View File

@@ -0,0 +1,217 @@
Checklist (and a short version for the impatient)
=================================================
* Commits:
- Make commits of logical units.
- Check for unnecessary whitespace with "git diff --check" before
committing.
- Commit using Unix line endings (check the settings around "crlf" in
git-config(1)).
- Do not check in commented out code or unneeded files.
- The first line of the commit message should be a short
description (50 characters is the soft limit, excluding ticket
number(s)), and should skip the full stop.
- Associate the issue in the message. The first line should include
the issue number in the form "(#XXXX) Rest of message".
- The body should provide a meaningful commit message, which:
- uses the imperative, present tense: "change", not "changed" or
"changes".
- includes motivation for the change, and contrasts its
implementation with the previous behavior.
- Make sure that you have tests for the bug you are fixing, or
feature you are adding.
- Make sure the test suites passes after your commit:
`bundle exec rspec spec/acceptance` More information on [testing](#Testing) below
- When introducing a new feature, make sure it is properly
documented in the README.md
* Submission:
* Pre-requisites:
- Make sure you have a [GitHub account](https://github.com/join)
- [Create a ticket](https://tickets.puppet.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppet.com/browse/) you are patching for.
* Preferred method:
- Fork the repository on GitHub.
- Push your changes to a topic branch in your fork of the
repository. (the format ticket/1234-short_description_of_change is
usually preferred for this project).
- Submit a pull request to the repository in the puppetlabs
organization.
The long version
================
1. Make separate commits for logically separate changes.
Please break your commits down into logically consistent units
which include new or changed tests relevant to the rest of the
change. The goal of doing this is to make the diff easier to
read for whoever is reviewing your code. In general, the easier
your diff is to read, the more likely someone will be happy to
review it and get it into the code base.
If you are going to refactor a piece of code, please do so as a
separate commit from your feature or bug fix changes.
We also really appreciate changes that include tests to make
sure the bug is not re-introduced, and that the feature is not
accidentally broken.
Describe the technical detail of the change(s). If your
description starts to get too long, that is a good sign that you
probably need to split up your commit into more finely grained
pieces.
Commits which plainly describe the things which help
reviewers check the patch and future developers understand the
code are much more likely to be merged in with a minimum of
bike-shedding or requested changes. Ideally, the commit message
would include information, and be in a form suitable for
inclusion in the release notes for the version of Puppet that
includes them.
Please also check that you are not introducing any trailing
whitespace or other "whitespace errors". You can do this by
running "git diff --check" on your changes before you commit.
2. Sending your patches
To submit your changes via a GitHub pull request, we _highly_
recommend that you have them on a topic branch, instead of
directly on "master".
It makes things much easier to keep track of, especially if
you decide to work on another thing before your first change
is merged in.
GitHub has some pretty good
[general documentation](http://help.github.com/) on using
their site. They also have documentation on
[creating pull requests](http://help.github.com/send-pull-requests/).
In general, after pushing your topic branch up to your
repository on GitHub, you can switch to the branch in the
GitHub UI and click "Pull Request" towards the top of the page
in order to open a pull request.
3. Update the related GitHub issue.
If there is a GitHub issue associated with the change you
submitted, then you should update the ticket to include the
location of your branch, along with any other commentary you
may wish to make.
Testing
=======
Getting Started
---------------
Our puppet modules provide [`Gemfile`](./Gemfile)s which can tell a ruby
package manager such as [bundler](http://bundler.io/) what Ruby packages,
or Gems, are required to build, develop, and test this software.
Please make sure you have [bundler installed](http://bundler.io/#getting-started)
on your system, then use it to install all dependencies needed for this project,
by running
```shell
% bundle install
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.0)
Using builder (3.2.2)
-- 8><-- many more --><8 --
Using rspec-system-puppet (2.2.0)
Using serverspec (0.6.3)
Using rspec-system-serverspec (1.0.0)
Using bundler (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
```
NOTE some systems may require you to run this command with sudo.
If you already have those gems installed, make sure they are up-to-date:
```shell
% bundle update
```
With all dependencies in place and up-to-date we can now run the tests:
```shell
% bundle exec rake spec
```
This will execute all the [rspec tests](http://rspec-puppet.com/) tests
under [spec/defines](./spec/defines), [spec/classes](./spec/classes),
and so on. rspec tests may have the same kind of dependencies as the
module they are testing. While the module defines in its [Modulefile](./Modulefile),
rspec tests define them in [.fixtures.yml](./fixtures.yml).
Some puppet modules also come with [beaker](https://github.com/puppetlabs/beaker)
tests. These tests spin up a virtual machine under
[VirtualBox](https://www.virtualbox.org/)) with, controlling it with
[Vagrant](http://www.vagrantup.com/) to actually simulate scripted test
scenarios. In order to run these, you will need both of those tools
installed on your system.
You can run them by issuing the following command
```shell
% bundle exec rake spec_clean
% bundle exec rspec spec/acceptance
```
This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml),
install puppet, copy this module and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb)
and then run all the tests under [spec/acceptance](./spec/acceptance).
Writing Tests
-------------
XXX getting started writing tests.
If you have commit access to the repository
===========================================
Even if you have commit access to the repository, you will still need to
go through the process above, and have someone else review and merge
in your changes. The rule is that all changes must be reviewed by a
developer on the project (that did not write the code) to ensure that
all changes go through a code review process.
Having someone other than the author of the topic branch recorded as
performing the merge is the record that they performed the code
review.
Additional Resources
====================
* [Getting additional help](http://puppet.com/community/get-help)
* [Writing tests](https://docs.puppet.com/guides/module_guides/bgtm.html#step-three-module-testing)
* [General GitHub documentation](http://help.github.com/)
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)

View File

@@ -0,0 +1,75 @@
#This file is generated by ModuleSync, do not edit.
source ENV['GEM_SOURCE'] || "https://rubygems.org"
# Determines what type of gem is requested based on place_or_version.
def gem_type(place_or_version)
if place_or_version =~ /^git:/
:git
elsif place_or_version =~ /^file:/
:file
else
:gem
end
end
# Find a location or specific version for a gem. place_or_version can be a
# version, which is most often used. It can also be git, which is specified as
# `git://somewhere.git#branch`. You can also use a file source location, which
# is specified as `file://some/location/on/disk`.
def location_for(place_or_version, fake_version = nil)
if place_or_version =~ /^(git[:@][^#]*)#(.*)/
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
elsif place_or_version =~ /^file:\/\/(.*)/
['>= 0', { :path => File.expand_path($1), :require => false }]
else
[place_or_version, { :require => false }]
end
end
# Used for gem conditionals
supports_windows = false
ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
minor_version = "#{ruby_version_segments[0]}.#{ruby_version_segments[1]}"
group :development do
gem "puppet-module-posix-default-r#{minor_version}", :require => false, :platforms => "ruby"
gem "puppet-module-win-default-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "puppet-module-posix-dev-r#{minor_version}", :require => false, :platforms => "ruby"
gem "puppet-module-win-dev-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "json_pure", '<= 2.0.1', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "fast_gettext", '1.1.0', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
end
group :system_tests do
gem "puppet-module-posix-system-r#{minor_version}", :require => false, :platforms => "ruby"
gem "puppet-module-win-system-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"]
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '>= 3')
gem "beaker-pe", :require => false
gem "beaker-rspec", *location_for(ENV['BEAKER_RSPEC_VERSION'])
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'])
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
end
gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'])
# Only explicitly specify Facter/Hiera if a version has been specified.
# Otherwise it can lead to strange bundler behavior. If you are seeing weird
# gem resolution behavior, try setting `DEBUG_RESOLVER` environment variable
# to `1` and then run bundle install.
gem 'facter', *location_for(ENV['FACTER_GEM_VERSION']) if ENV['FACTER_GEM_VERSION']
gem 'hiera', *location_for(ENV['HIERA_GEM_VERSION']) if ENV['HIERA_GEM_VERSION']
# Evaluate Gemfile.local if it exists
if File.exists? "#{__FILE__}.local"
eval(File.read("#{__FILE__}.local"), binding)
end
# Evaluate ~/.gemfile if it exists
if File.exists?(File.join(Dir.home, '.gemfile'))
eval(File.read(File.join(Dir.home, '.gemfile')), binding)
end
# vim:ft=ruby

View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,6 @@
## Maintenance
Maintainers:
- Puppet Forge Modules Team `forge-modules |at| puppet |dot| com`
Tickets: https://tickets.puppet.com/browse/MODULES. Make sure to set component to `tomcat`.

View File

@@ -0,0 +1,15 @@
Puppet Module - puppetlabs-tomcat
Copyright 2017 Puppet, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.send('relative')
desc 'Generate pooler nodesets'
task :gen_nodeset do
require 'beaker-hostgenerator'
require 'securerandom'
require 'fileutils'
agent_target = ENV['TEST_TARGET']
if ! agent_target
STDERR.puts 'TEST_TARGET environment variable is not set'
STDERR.puts 'setting to default value of "redhat-64default."'
agent_target = 'redhat-64default.'
end
master_target = ENV['MASTER_TEST_TARGET']
if ! master_target
STDERR.puts 'MASTER_TEST_TARGET environment variable is not set'
STDERR.puts 'setting to default value of "redhat7-64mdcl"'
master_target = 'redhat7-64mdcl'
end
targets = "#{master_target}-#{agent_target}"
cli = BeakerHostGenerator::CLI.new([targets])
nodeset_dir = "tmp/nodesets"
nodeset = "#{nodeset_dir}/#{targets}-#{SecureRandom.uuid}.yaml"
FileUtils.mkdir_p(nodeset_dir)
File.open(nodeset, 'w') do |fh|
fh.print(cli.execute)
end
puts nodeset
end

View File

@@ -0,0 +1,91 @@
{
"CHANGELOG.md": "0111310ab2f61aa9b4ba1067d4192c8a",
"CONTRIBUTING.md": "77d0440d7cd4206497f99065c60bed46",
"Gemfile": "bedf635025b279d7c7732adcc8ae9a29",
"LICENSE": "3b83ef96387f14655fc854ddc3c6bd57",
"MAINTAINERS.md": "9934bc3a62164ef18e331f9d26a48910",
"NOTICE": "85212f921145f98696bcb0984a4ebf5e",
"README.md": "11775b474bf23fb38972d42833f0cea0",
"Rakefile": "3851f083966b9bbd6d46e50dba5aa52a",
"examples/default_install_from_package.pp": "830b34981f61e2576276fd7e774f18b1",
"examples/default_install_from_source.pp": "f434508f387e4c70e4988fc5a9ee7eff",
"examples/instance_with_context.pp": "c1606bd1c083f562f6225e9fd789eaa9",
"examples/instance_with_listener.pp": "be9e654defd35f0cec689cf4a2370daf",
"examples/instance_with_realm.pp": "882db8128c3f0d41a602534cc3833bc3",
"examples/instance_with_role_and_user.pp": "c4f536bd8f19b86f778acdf1c0fc3f42",
"examples/jsvc_install_from_source.pp": "7c20e06925a61d38aa678703bc870322",
"examples/multiple_instances.pp": "4a48b03fc81d814c803decf08138ca4e",
"locales/config.yaml": "ae4fa570fb69fe0db92ddaf7533fe1ec",
"locales/ja/puppetlabs-tomcat.po": "e35c7927ccb27df41f371af1ddeea99e",
"locales/puppetlabs-tomcat.pot": "c624f0337acee9c0195fcee039a97075",
"manifests/config/context/environment.pp": "df0ba084471bbf429eb5f5fa15c21665",
"manifests/config/context/manager.pp": "9e349546264aaaed037bb729ce07d58a",
"manifests/config/context/resource.pp": "48983e209e068280e09bbd41239b83fc",
"manifests/config/context/resourcelink.pp": "dc5b41a52b5dd8a9bd542319ae63c4bc",
"manifests/config/context.pp": "065c9f70d855cef4b634bc1f562d734c",
"manifests/config/properties/property.pp": "a891555475b670cfa980131692f21b49",
"manifests/config/properties.pp": "203540525ebbf65cbcb10b879166bef8",
"manifests/config/server/connector.pp": "258b71d9164723385ab319f4fb0ebfba",
"manifests/config/server/context.pp": "4a00f32132ae766c35c345c7010d0dd8",
"manifests/config/server/engine.pp": "a6ac9c710c25c4ec986dbe19243e5d82",
"manifests/config/server/globalnamingresource.pp": "294f04ea3985f291e379010901358dbd",
"manifests/config/server/host.pp": "a7bd045c5cf49abdfc428367272ba57e",
"manifests/config/server/listener.pp": "445ee08285c09b366bf2c0845438483d",
"manifests/config/server/realm.pp": "a1484332e8676a0878bbb9c9720f0f8d",
"manifests/config/server/service.pp": "9ebceb39c785424f197d87ea66e4fb6a",
"manifests/config/server/tomcat_users.pp": "981c9f1ee5ba1cca6f2360e333dea777",
"manifests/config/server/valve.pp": "309f49a518a3ad4140842a66bbe12d0e",
"manifests/config/server.pp": "a7f1107e8d94382efb617910c5af92c2",
"manifests/init.pp": "bf6f6dc95480c068ebb81f170320dbde",
"manifests/install/package.pp": "3c60edc249c96d9978dca2fd381bb53b",
"manifests/install/source.pp": "ca8d119d8261c0eb23cbfbcecb657652",
"manifests/install.pp": "c275083c1554d5421d7fdfe5bd096260",
"manifests/instance/copy_from_home.pp": "9e2ca14fa8abdbe19e6b81b22483837c",
"manifests/instance/dependencies.pp": "5e3380372a1f639e7924c974ca6be7a5",
"manifests/instance.pp": "9eb9aed23a15a10694bff3af45b5f731",
"manifests/params.pp": "fc1975a1d4c5e6e6936187f06c0ab88d",
"manifests/service.pp": "1f5570207bfb37d7acaa1e72ccec7e58",
"manifests/setenv/entry.pp": "14562e8ab3e5400b5863684f8bcdb36c",
"manifests/war.pp": "f52a05c77070f16cc5f488d1c7873af5",
"metadata.json": "ea62848dd3edf60e3518e13c4f3fa1ce",
"readmes/README_ja_JP.md": "44f434658a48b77c6c9dac62bcdc93ca",
"spec/acceptance/acceptance_1a_spec.rb": "bc60b9326b7322800c37514ea98ae6cc",
"spec/acceptance/acceptance_1b_spec.rb": "11d7e3006b2cf0866d3a346d09e3e5ac",
"spec/acceptance/acceptance_2a_spec.rb": "08c02584fca96dd8af5743294273a4de",
"spec/acceptance/acceptance_2b_spec.rb": "1ebd729f7ed53a2b3942a6f3c4ec9851",
"spec/acceptance/acceptance_3a_spec.rb": "7f9a40edbcb2d19e0abc6583247bd9b2",
"spec/acceptance/acceptance_3b_spec.rb": "7dd99edd2fdaece73a39e91dbb1c9b91",
"spec/acceptance/acceptance_4a_spec.rb": "b790a9b1417d3e97b32db6434f19aea5",
"spec/acceptance/acceptance_4b_spec.rb": "edd34954cba8e16477a53c8abf36f7d8",
"spec/acceptance/nodesets/centos-7-x64.yml": "a713f3abd3657f0ae2878829badd23cd",
"spec/acceptance/nodesets/debian-8-x64.yml": "d2d2977900989f30086ad251a14a1f39",
"spec/acceptance/nodesets/default.yml": "b42da5a1ea0c964567ba7495574b8808",
"spec/acceptance/nodesets/docker/centos-7.yml": "8a3892807bdd62306ae4774f41ba11ae",
"spec/acceptance/nodesets/docker/debian-8.yml": "ac8e871d1068c96de5e85a89daaec6df",
"spec/acceptance/nodesets/docker/ubuntu-14.04.yml": "dc42ee922a96908d85b8f0f08203ce58",
"spec/acceptance/readme_spec.rb": "7207da433af39149d6fa9674e99b0f22",
"spec/classes/init_spec.rb": "d4b65c6bf7d467c62e950592091eaff3",
"spec/classes/tomcat_spec.rb": "71824d52acbced24df30c4e38ca38925",
"spec/defines/config/context/environment_spec.rb": "b2ae57cc8e07beeaf597ad5958d25ba2",
"spec/defines/config/context/manager_spec.rb": "133cfec1c3ccd0493c69b600b0d031aa",
"spec/defines/config/context/resource_spec.rb": "493cdd6384f75783b214c9032b15d471",
"spec/defines/config/context/resourcelink_spec.rb": "e581ff7eba88179d03fa9c6750f7f59e",
"spec/defines/config/context_spec.rb": "500719e48d80c970097b6fe49b39ec67",
"spec/defines/config/server/connector_spec.rb": "20802e2c672e2113c677557423fb67b2",
"spec/defines/config/server/context_spec.rb": "c9bb51200b14c50d4c50a674f73d298f",
"spec/defines/config/server/engine_spec.rb": "a40216312a305438f9f3440c792564e1",
"spec/defines/config/server/host_spec.rb": "bc19c54a600667789cd0667de8708079",
"spec/defines/config/server/listener_spec.rb": "46452341dd436b215eca7fa5b35432f3",
"spec/defines/config/server/realm_spec.rb": "06cd485fa339a9c6663f5b175fdda1dc",
"spec/defines/config/server/service_spec.rb": "6b8bdce1aae2ae3b5ab29d06cec195c7",
"spec/defines/config/server/tomcat_users_spec.rb": "a7c7f75a5ea928346f6c4f798574fd0f",
"spec/defines/config/server/valve_spec.rb": "e72c71694971f423d3823ef28c367fc1",
"spec/defines/config/server_spec.rb": "35e3720521a9dd086f5482316f86feb1",
"spec/defines/instance_spec.rb": "c212846c51c30c783b3c173ac21b5031",
"spec/defines/service_spec.rb": "04e434800afa66ea4d266b84f7791a4e",
"spec/defines/setenv/entry_spec.rb": "04a341ec601533c1fa17b9cd3a3fe93f",
"spec/defines/war_spec.rb": "f0ca6d7d6a42c39fee9fd5545651a858",
"spec/spec_helper.rb": "b2db3bc02b4ac2fd5142a6621c641b07",
"spec/spec_helper_acceptance.rb": "758a57f252ce0d4875c88cfb2ee76e7e",
"templates/jsvc-init.erb": "fd5de8fb7fc23de31c00d2343535c77a"
}

View File

@@ -0,0 +1,13 @@
# This code fragment will install the tomcat package from EPEL and start the service
#
class { 'tomcat': }
class { 'epel': }
-> tomcat::instance { 'default':
install_from_source => false,
package_name => 'tomcat',
}
-> tomcat::service { 'default':
use_jsvc => false,
use_init => true,
service_name => 'tomcat',
}

View File

@@ -0,0 +1,9 @@
# This code fragment downloads tomcat 8.0 then starts the service
#
class { 'tomcat': }
class { 'java': }
tomcat::instance { 'test':
source_url => 'http://mirror.nexcess.net/apache/tomcat/tomcat-8/v8.0.8/bin/apache-tomcat-8.0.8.tar.gz'
}
-> tomcat::service { 'default': }

View File

@@ -0,0 +1,20 @@
# This code fragment downloads tomcat 7.0.53, creates an instance and adds a context to localhost
#
class { 'tomcat': }
class { 'java': }
tomcat::instance { 'mycat':
catalina_base => '/opt/apache-tomcat/mycat',
source_url => 'http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.53/bin/apache-tomcat-7.0.53.tar.gz',
}
-> tomcat::config::server::context { 'mycat-test':
catalina_base => '/opt/apache-tomcat/mycat',
context_ensure => present,
doc_base => 'test.war',
parent_service => 'Catalina',
parent_engine => 'Catalina',
parent_host => 'localhost',
additional_attributes => {
'path' => '/test',
},
}

View File

@@ -0,0 +1,18 @@
# This code fragment downloads tomcat 7.0.53, creates an instance and adds a listener
#
class { 'tomcat': }
class { 'java': }
tomcat::instance { 'mycat':
catalina_base => '/opt/apache-tomcat/mycat',
source_url => 'http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.53/bin/apache-tomcat-7.0.53.tar.gz',
}
-> tomcat::config::server::listener { 'mycat-jmx':
catalina_base => '/opt/apache-tomcat/mycat',
listener_ensure => present,
class_name => 'org.apache.catalina.mbeans.JmxRemoteLifecycleListener',
additional_attributes => {
'rmiRegistryPortPlatform' => '10001',
'rmiServerPortPlatform' => '10002',
},
}

View File

@@ -0,0 +1,20 @@
# This code fragment downloads Tomcat 8.0.15, configures an instance, and adds a JNDIRealm nested under a LockOutRealm.
class { 'tomcat': }
class { 'java': }
tomcat::instance { 'tomcat8':
source_url => 'http://mirror.reverse.net/pub/apache/tomcat/tomcat-8/v8.0.15/bin/apache-tomcat-8.0.15.tar.gz',
purge_realms => true,
}
-> tomcat::config::server::realm { 'org.apache.catalina.realm.LockOutRealm':
realm_ensure => 'present',
}
-> tomcat::config::server::realm { 'org.apache.catalina.realm.JNDIRealm':
realm_ensure => 'present',
parent_realm => 'org.apache.catalina.realm.LockOutRealm',
additional_attributes => {
'connectionURL' => 'ldap://localhost'
},
}

View File

@@ -0,0 +1,23 @@
# This code fragment downloads tomcat 7.0.53, creates an instance and adds a role and user
#
class { 'tomcat': }
class { 'java': }
tomcat::instance { 'mycat':
catalina_base => '/opt/apache-tomcat/mycat',
source_url => 'http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.53/bin/apache-tomcat-7.0.53.tar.gz',
}
-> tomcat::config::server::tomcat_users {
'mycat-role-tester':
ensure => present,
catalina_base => '/opt/apache-tomcat/mycat',
element => 'role',
element_name => 'tester';
'mycat-user-example':
ensure => present,
catalina_base => '/opt/apache-tomcat/mycat',
element => 'user',
element_name => 'example',
password => 'very-secret-password',
roles => ['tester'];
}

View File

@@ -0,0 +1,37 @@
# This code fragment downloads tomcat 8.0, compiles jsvc, then starts the service
#
class { 'tomcat': }
class { 'gcc': }
class { 'java': }
tomcat::instance { 'test':
source_url => 'http://mirror.nexcess.net/apache/tomcat/tomcat-8/v8.0.8/bin/apache-tomcat-8.0.8.tar.gz'
}
-> staging::extract { 'commons-daemon-native.tar.gz':
source => "${::tomcat::catalina_home}/bin/commons-daemon-native.tar.gz",
target => "${::tomcat::catalina_home}/bin",
unless => "test -d ${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src",
}
-> exec { 'configure jsvc':
command => 'JAVA_HOME=/etc/alternatives/java_sdk configure',
creates => "${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix/Makefile",
cwd => "${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix",
require => [ Class['gcc'], Class['java'] ],
provider => shell,
}
-> exec { 'make jsvc':
command => 'make',
creates => "${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix/jsvc",
cwd => "${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix",
provider => shell,
}
-> file { 'jsvc':
ensure => link,
path => "${::tomcat::catalina_home}/bin/jsvc",
target => "${::tomcat::catalina_home}/bin/commons-daemon-1.0.15-native-src/unix/jsvc",
}
-> tomcat::service { 'default':
use_jsvc => true,
}

View File

@@ -0,0 +1,38 @@
class { 'tomcat': }
class { 'java': }
tomcat::instance { 'tomcat8':
catalina_base => '/opt/apache-tomcat/tomcat8',
source_url => 'http://mirror.nexcess.net/apache/tomcat/tomcat-8/v8.0.8/bin/apache-tomcat-8.0.8.tar.gz'
}
-> tomcat::service { 'default':
catalina_base => '/opt/apache-tomcat/tomcat8',
}
tomcat::instance { 'tomcat6':
source_url => 'http://apache.mirror.quintex.com/tomcat/tomcat-6/v6.0.41/bin/apache-tomcat-6.0.41.tar.gz',
catalina_base => '/opt/apache-tomcat/tomcat6',
}
-> tomcat::config::server { 'tomcat6':
catalina_base => '/opt/apache-tomcat/tomcat6',
port => '8105',
}
-> tomcat::config::server::connector { 'tomcat6-http':
catalina_base => '/opt/apache-tomcat/tomcat6',
port => '8180',
protocol => 'HTTP/1.1',
additional_attributes => {
'redirectPort' => '8543'
},
}
-> tomcat::config::server::connector { 'tomcat6-ajp':
catalina_base => '/opt/apache-tomcat/tomcat6',
port => '8109',
protocol => 'AJP/1.3',
additional_attributes => {
'redirectPort' => '8543'
},
}
-> tomcat::service { 'tomcat6':
catalina_base => '/opt/apache-tomcat/tomcat6'
}

View File

@@ -0,0 +1,25 @@
---
# This is the project-specific configuration file for setting up
# fast_gettext for your project.
gettext:
# This is used for the name of the .pot and .po files; they will be
# called <project_name>.pot?
project_name: puppetlabs-tomcat
# This is used in comments in the .pot and .po files to indicate what
# project the files belong to and should bea little more desctiptive than
# <project_name>
package_name: puppetlabs-tomcat
# The locale that the default messages in the .pot file are in
default_locale: en
# The email used for sending bug reports.
bugs_address: docs@puppet.com
# The holder of the copyright.
copyright_holder: Puppet, Inc.
# This determines which comments in code should be eligible for translation.
# Any comments that start with this string will be externalized. (Leave
# empty to include all.)
comments_tag: TRANSLATOR
# Patterns for +Dir.glob+ used to find all files that might contain
# translatable content, relative to the project root directory
source_files:

View File

@@ -0,0 +1,21 @@
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-21 14:19+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Eriko Kashiwagi <eriko.55@d5.dion.ne.jp>, 2017\n"
"Language-Team: Japanese (Japan) (https://www.transifex.com/puppet/teams/29089/ja_JP/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ja_JP\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Translate Toolkit 2.0.0\n"
#. metadata.json
#: .summary
msgid "Installs, deploys, and configures Apache Tomcat web services."
msgstr "Apache Tomcat Webサービスをインストールし、デプロイし、構成します。"

View File

@@ -0,0 +1,18 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-21 14:19+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 2.0.0\n"
#. metadata.json
#: .summary
msgid "Installs, deploys, and configures Apache Tomcat web services."
msgstr ""

View File

@@ -0,0 +1,32 @@
# Definition: tomcat::config::context
#
# Configure attributes for the Context element in $CATALINA_BASE/conf/context.xml
#
# Parameters
# - $catalina_base is the base directory for the Tomcat installation.
define tomcat::config::context (
$catalina_base = undef,
) {
include tomcat
$_catalina_base = pick($catalina_base, $::tomcat::catalina_home)
tag(sha1($_catalina_base))
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
$_watched_resource = 'set Context/WatchedResource/#text "WEB-INF/web.xml"'
$changes = delete_undef_values([$_watched_resource])
if ! empty($changes) {
augeas { "context-${_catalina_base}":
lens => 'Xml.lns',
incl => "${_catalina_base}/conf/context.xml",
changes => $changes,
}
}
}

View File

@@ -0,0 +1,115 @@
# Definition: tomcat::config::context::environment
#
# Configure Environment elements in $CATALINA_BASE/conf/context.xml
#
# Parameters:
# - $ensure specifies whether you are trying to add or remove the
# Environment element. Valid values are 'true', 'false', 'present', and
# 'absent'. Defaults to 'present'.
# - $catalina_base is the base directory for the Tomcat installation.
# - $environment_name is the name of the Environment to be created, relative to
# the java:comp/env context.
# - $type is the fully qualified Java class name expected by the web application
# for this environment entry.
# - $value that will be presented to the application when requested from
# the JNDI context.
# - $description is an optional string for a human-readable description
# of this environment entry.
# - Set $override to false if you do not want an <env-entry> for
# the same environment entry name to override the value specified here.
# - An optional hash of $additional_attributes to add to the Environment. Should
# be of the format 'attribute' => 'value'.
# - An optional array of $attributes_to_remove from the Environment.
define tomcat::config::context::environment (
$ensure = 'present',
$catalina_base = $::tomcat::catalina_home,
$environment_name = $name,
$type = undef,
$value = undef,
$description = undef,
$override = undef,
$additional_attributes = {},
$attributes_to_remove = [],
) {
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
if is_bool($override) {
$_override = bool2str($override)
} else {
$_override = $override
}
validate_re($ensure, '^(present|absent|true|false)$')
validate_absolute_path($catalina_base)
validate_string(
$environment_name,
$type,
$value,
$description,
)
validate_hash($additional_attributes)
validate_array($attributes_to_remove)
$base_path = "Context/Environment[#attribute/name='${environment_name}']"
if $ensure =~ /^(absent|false)$/ {
$changes = "rm ${base_path}"
} else {
if empty($type) {
fail('$type must be specified')
}
if empty($value) {
fail('$value must be specified')
}
$set_name = "set ${base_path}/#attribute/name ${environment_name}"
$set_type = "set ${base_path}/#attribute/type ${type}"
$set_value = "set ${base_path}/#attribute/value ${value}"
if ! empty($_override) {
validate_re($_override, '(true|false)', '$override must be true or false')
$set_override = "set ${base_path}/#attribute/override ${_override}"
} else {
$set_override = "rm ${base_path}/#attribute/override"
}
if ! empty($description) {
$set_description = "set ${base_path}/#attribute/description \'${description}\'"
} else {
$set_description = "rm ${base_path}/#attribute/description"
}
if ! empty($additional_attributes) {
$set_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), "set ${base_path}/#attribute/"), "'")
} else {
$set_additional_attributes = undef
}
if ! empty(any2array($attributes_to_remove)) {
$rm_attributes_to_remove = prefix(any2array($attributes_to_remove), "rm ${base_path}/#attribute/")
} else {
$rm_attributes_to_remove = undef
}
$changes = delete_undef_values(flatten([
$set_name,
$set_type,
$set_value,
$set_override,
$set_description,
$set_additional_attributes,
$rm_attributes_to_remove,
]))
}
augeas { "context-${catalina_base}-environment-${name}":
lens => 'Xml.lns',
incl => "${catalina_base}/conf/context.xml",
changes => $changes,
}
}

View File

@@ -0,0 +1,69 @@
# Definition: tomcat::config::context::manager
#
# Configure Manager elements in $CATALINA_BASE/conf/context.xml
#
# Parameters:
# - $catalina_base is the base directory for the Tomcat installation.
# - $ensure specifies whether you are trying to add or remove the
# Manager element. Valid values are 'true', 'false', 'present', and
# 'absent'. Defaults to 'present'.
# - $manager_name is the name of the Manager to be created, relative to
# the java:comp/env context.
# - $type is the fully qualified Java class name expected by the web application
# when it performs a lookup for this manager
# - An optional hash of $additional_attributes to add to the Manager. Should
# be of the format 'attribute' => 'value'.
# - An optional array of $attributes_to_remove from the Manager.
define tomcat::config::context::manager (
$ensure = 'present',
$catalina_base = $::tomcat::catalina_home,
$manager_classname = $name,
$additional_attributes = {},
$attributes_to_remove = [],
) {
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
validate_re($ensure, '^(present|absent|true|false)$')
if $manager_classname {
$_manager_classname = $manager_classname
} else {
$_manager_classname = $name
}
$base_path = "Context/Manager[#attribute/className='${_manager_classname}']"
if $ensure =~ /^(absent|false)$/ {
$changes = "rm ${base_path}"
} else {
$set_name = "set ${base_path}/#attribute/className '${_manager_classname}'"
if ! empty($additional_attributes) {
$set_additional_attributes =
suffix(prefix(join_keys_to_values($additional_attributes, " '"),
"set ${base_path}/#attribute/"), "'")
} else {
$set_additional_attributes = undef
}
if ! empty(any2array($attributes_to_remove)) {
$rm_attributes_to_remove =
prefix(any2array($attributes_to_remove), "rm ${base_path}/#attribute/")
} else {
$rm_attributes_to_remove = undef
}
$changes = delete_undef_values(flatten([
$set_name,
$set_additional_attributes,
$rm_attributes_to_remove,
]))
}
augeas { "context-${catalina_base}-manager-${name}":
lens => 'Xml.lns',
incl => "${catalina_base}/conf/context.xml",
changes => $changes,
}
}

View File

@@ -0,0 +1,75 @@
# Definition: tomcat::config::context::resource
#
# Configure Resource elements in $CATALINA_BASE/conf/context.xml
#
# Parameters:
# - $catalina_base is the base directory for the Tomcat installation.
# - $ensure specifies whether you are trying to add or remove the
# Resource element. Valid values are 'true', 'false', 'present', and
# 'absent'. Defaults to 'present'.
# - $resource_name is the name of the Resource to be created, relative to
# the java:comp/env context.
# - $type is the fully qualified Java class name expected by the web application
# when it performs a lookup for this resource
# - An optional hash of $additional_attributes to add to the Resource. Should
# be of the format 'attribute' => 'value'.
# - An optional array of $attributes_to_remove from the Connector.
define tomcat::config::context::resource (
$ensure = 'present',
$resource_name = $name,
$resource_type = undef,
$catalina_base = $::tomcat::catalina_home,
$additional_attributes = {},
$attributes_to_remove = [],
) {
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
validate_re($ensure, '^(present|absent|true|false)$')
if $resource_name {
$_resource_name = $resource_name
} else {
$_resource_name = $name
}
$base_path = "Context/Resource[#attribute/name='${_resource_name}']"
if $ensure =~ /^(absent|false)$/ {
$changes = "rm ${base_path}"
} else {
# (MODULES-3353) does this need to be quoted?
$set_name = "set ${base_path}/#attribute/name ${_resource_name}"
if $resource_type {
$set_type = "set ${base_path}/#attribute/type ${resource_type}"
} else {
$set_type = undef
}
if ! empty($additional_attributes) {
$set_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), "set ${base_path}/#attribute/"), "'")
} else {
$set_additional_attributes = undef
}
if ! empty(any2array($attributes_to_remove)) {
$rm_attributes_to_remove = prefix(any2array($attributes_to_remove), "rm ${base_path}/#attribute/")
} else {
$rm_attributes_to_remove = undef
}
$changes = delete_undef_values(flatten([
$set_name,
$set_type,
$set_additional_attributes,
$rm_attributes_to_remove,
]))
}
augeas { "context-${catalina_base}-resource-${name}":
lens => 'Xml.lns',
incl => "${catalina_base}/conf/context.xml",
changes => $changes,
}
}

View File

@@ -0,0 +1,64 @@
# Definition: tomcat::config::server::resourcelink
#
# Configure a ResourceLink element in the designated xml config.
#
# Parameters:
# - $ensure specifies whether you are trying to add or remove the
# ResourceLink element. Valid values are 'true', 'false', 'present', and
# 'absent'. Defaults to 'present'.
# - $catalina_base is the base directory for the Tomcat instance.
# - $resourcelink_name is the name of the resource link to be created, relative
# to the java:comp/env context. Defaults to $name
# - $resourcelink_type is the fully qualified Java class name expected by the web
# application when it performs a lookup for this resource link. Required
define tomcat::config::context::resourcelink (
$ensure = 'present',
$catalina_base = $::tomcat::catalina_home,
$resourcelink_name = $name,
$resourcelink_type = undef,
$additional_attributes = {},
$attributes_to_remove = [],
) {
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Context configurations require Augeas >= 1.0.0')
}
validate_re($ensure, '^(present|absent|true|false)$')
$base_path = "Context/ResourceLink[#attribute/name='${resourcelink_name}']"
if $ensure =~ /^(absent|false)$/ {
$augeaschanges = "rm ${base_path}"
} else {
$set_name = "set ${base_path}/#attribute/name ${resourcelink_name}"
if $resourcelink_type {
$set_type = "set ${base_path}/#attribute/type ${resourcelink_type}"
} else {
$set_type = undef
}
if ! empty($additional_attributes) {
$set_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), "set ${base_path}/#attribute/"), "'")
} else {
$set_additional_attributes = undef
}
if ! empty(any2array($attributes_to_remove)) {
$rm_attributes_to_remove = prefix(any2array($attributes_to_remove), "rm ${base_path}/#attribute/")
} else {
$rm_attributes_to_remove = undef
}
$augeaschanges = delete_undef_values(flatten([
$set_name,
$set_type,
$set_additional_attributes,
$rm_attributes_to_remove,
]))
}
augeas { "context-${catalina_base}-resourcelink-${name}":
lens => 'Xml.lns',
incl => "${catalina_base}/conf/context.xml",
changes => $augeaschanges,
}
}

View File

@@ -0,0 +1,22 @@
## manage the catalina.properties file
# private
define tomcat::config::properties (
$catalina_base,
$catalina_home,
$user,
$group,
) {
tag(sha1($catalina_base))
tag(sha1($catalina_home))
concat { "${catalina_base}/conf/catalina.properties":
ensure_newline => true,
owner => $user,
group => $group,
mode => '0640',
}
concat::fragment { "${catalina_base} properties base file from catalina_home ${$catalina_home}/conf/catalina.properties":
target => "${catalina_base}/conf/catalina.properties",
source => "${catalina_home}/conf/catalina.properties",
order => '01',
}
}

View File

@@ -0,0 +1,11 @@
## manage additional entries for the properties file, typically catalina.properties
define tomcat::config::properties::property (
$catalina_base,
$value,
$property = $name,
) {
concat::fragment { "${catalina_base}/conf/catalina.properties property ${property}":
target => "${catalina_base}/conf/catalina.properties",
content => "${property}=${value}",
}
}

View File

@@ -0,0 +1,81 @@
# Definition: tomcat::config::server
#
# Configure attributes for the Server element in $CATALINA_BASE/conf/server.xml
#
# Parameters
# - $catalina_base is the base directory for the Tomcat installation.
# - $class_name is the optional className attribute.
# - $class_name_ensure specifies whether you are trying to set or remove the
# className attribute. Valid values are 'true', 'false', 'present', or
# 'absent'. Defaults to 'present'.
# - $address is the optional address attribute.
# - $address_ensure specifies whether you are trying to set of remove the
# address attribute. Valid values are 'true', 'false', 'present', or
# 'absent'. Defaults to 'present'.
# - The $port to wait for shutdown commands on.
# - The $shutdown command that must be sent to $port.
define tomcat::config::server (
$catalina_base = undef,
$class_name = undef,
$class_name_ensure = 'present',
$address = undef,
$address_ensure = 'present',
$port = undef,
$shutdown = undef,
$server_config = undef,
) {
include tomcat
$_catalina_base = pick($catalina_base, $::tomcat::catalina_home)
tag(sha1($_catalina_base))
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
validate_re($class_name_ensure, '^(present|absent|true|false)$')
validate_re($address_ensure, '^(present|absent|true|false)$')
if $class_name_ensure =~ /^(absent|false)$/ {
$_class_name = 'rm Server/#attribute/className'
} elsif $class_name {
$_class_name = "set Server/#attribute/className ${class_name}"
} else {
$_class_name = undef
}
if $address_ensure =~ /^(absent|false)$/ {
$_address = 'rm Server/#attribute/address'
} elsif $address {
$_address = "set Server/#attribute/address ${address}"
} else {
$_address = undef
}
if $port {
$_port = "set Server/#attribute/port ${port}"
} else {
$_port = undef
}
if $shutdown {
$_shutdown = "set Server/#attribute/shutdown ${shutdown}"
} else {
$_shutdown = undef
}
if $server_config {
$_server_config = $server_config
} else {
$_server_config = "${_catalina_base}/conf/server.xml"
}
$changes = delete_undef_values([$_class_name, $_address, $_port, $_shutdown])
if ! empty($changes) {
augeas { "server-${_catalina_base}":
lens => 'Xml.lns',
incl => $_server_config,
changes => $changes,
}
}
}

View File

@@ -0,0 +1,94 @@
# Definition: tomcat::config::server::connector
#
# Configure Connector elements in $CATALINA_BASE/conf/server.xml
#
# Parameters:
# - $catalina_base is the base directory for the Tomcat installation.
# - $connector_ensure specifies whether you are trying to add or remove the
# Connector element. Valid values are 'true', 'false', 'present', and
# 'absent'. Defaults to 'present'.
# - The $port attribute. This attribute is required unless $connector_ensure
# is set to false.
# - The $protocol attribute. Defaults to $name when not specified.
# - $parent_service is the Service element this Connector should be nested
# beneath. Defaults to 'Catalina'.
# - An optional hash of $additional_attributes to add to the Connector. Should
# be of the format 'attribute' => 'value'.
# - An optional array of $attributes_to_remove from the Connector.
define tomcat::config::server::connector (
$catalina_base = undef,
$connector_ensure = 'present',
$port = undef,
$protocol = $name,
$parent_service = 'Catalina',
$additional_attributes = {},
$attributes_to_remove = [],
$purge_connectors = undef,
$server_config = undef,
) {
include tomcat
$_catalina_base = pick($catalina_base, $::tomcat::catalina_home)
tag(sha1($_catalina_base))
$_purge_connectors = pick($purge_connectors, $::tomcat::purge_connectors)
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
validate_re($connector_ensure, '^(present|absent|true|false)$')
validate_hash($additional_attributes)
validate_bool($_purge_connectors)
validate_re($_catalina_base, '^.*[^/]$', '$catalina_base must not end in a /!')
$path = "Server/Service[#attribute/name='${parent_service}']"
if $_purge_connectors {
$__purge_connectors = "rm Server//Connector[#attribute/protocol='${protocol}'][#attribute/port!='${port}']"
} else {
$__purge_connectors = undef
}
if $_purge_connectors and ($connector_ensure =~ /^(absent|false)$/) {
fail('$connector_ensure must be set to \'true\' or \'present\' to use $purge_connectors')
}
if $server_config {
$_server_config = $server_config
} else {
$_server_config = "${_catalina_base}/conf/server.xml"
}
if $connector_ensure =~ /^(absent|false)$/ {
if ! $port {
$base_path = "${path}/Connector[#attribute/protocol='${protocol}']"
} else {
$base_path = "${path}/Connector[#attribute/port='${port}']"
}
$changes = "rm ${base_path}"
} else {
if ! $port {
fail('$port must be specified unless $connector_ensure is set to \'absent\' or \'false\'')
}
$base_path = "${path}/Connector[#attribute/port='${port}']"
$_port = "set ${base_path}/#attribute/port ${port}"
$_protocol_change = "set ${base_path}/#attribute/protocol ${protocol}"
if ! empty($additional_attributes) {
$_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), "set ${base_path}/#attribute/"), "'")
} else {
$_additional_attributes = undef
}
if ! empty(any2array($attributes_to_remove)) {
$_attributes_to_remove = prefix(any2array($attributes_to_remove), "rm ${base_path}/#attribute/")
} else {
$_attributes_to_remove = undef
}
$changes = delete_undef_values(flatten([ $__purge_connectors, $_port, $_protocol_change, $_additional_attributes, $_attributes_to_remove ]))
}
augeas { "server-${_catalina_base}-${parent_service}-connector-${port}":
lens => 'Xml.lns',
incl => $_server_config,
changes => $changes,
}
}

View File

@@ -0,0 +1,106 @@
# Definition tomcat::config::server::context
#
# Configure a Context element in $CATALINA_BASE/conf/server.xml
#
# Parameters:
# - $catalina_base is the root of the Tomcat installation
# - $context_ensure specifies whether you are trying to add or remove the Context
# element. Valid values are 'true', 'false', 'present', or 'absent'. Defaults
# to 'present'.
# - $doc_base is the docBase attribute of the Context.
# If not specified, defaults to $name.
# - $parent_service is the Service element this Context should be nested beneath.
# Defaults to 'Catalina'.
# - $parent_engine is the `name` attribute to the Engine element the Host of this Context
# should be nested beneath. Only valid if $parent_host is specified.
# - $parent_host is the `name` attribute to the Host element this Context
# should be nested beneath.
# - An optional hash of $additional_attributes to add to the Context. Should be of
# the format 'attribute' => 'value'.
# - An optional array of $attributes_to_remove from the Context.
#
define tomcat::config::server::context (
$catalina_base = undef,
$context_ensure = 'present',
$doc_base = undef,
$parent_service = undef,
$parent_engine = undef,
$parent_host = undef,
$additional_attributes = {},
$attributes_to_remove = [],
$server_config = undef,
) {
include tomcat
$_catalina_base = pick($catalina_base, $::tomcat::catalina_home)
tag(sha1($_catalina_base))
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
validate_re($context_ensure, '^(present|absent|true|false)$')
validate_hash($additional_attributes)
validate_array($attributes_to_remove)
if $doc_base {
$_doc_base = $doc_base
} else {
$_doc_base = $name
}
if $parent_service {
$_parent_service = $parent_service
} else {
$_parent_service = 'Catalina'
}
if $parent_engine and ! $parent_host {
warning('context elements cannot be nested directly under engine elements, ignoring $parent_engine')
}
if $parent_engine and $parent_host {
$_parent_engine = $parent_engine
} else {
$_parent_engine = undef
}
if $server_config {
$_server_config = $server_config
} else {
$_server_config = "${_catalina_base}/conf/server.xml"
}
if $parent_host and ! $_parent_engine {
$path = "Server/Service[#attribute/name='${_parent_service}']/Engine/Host[#attribute/name='${parent_host}']/Context[#attribute/docBase='${_doc_base}']"
} elsif $parent_host and $_parent_engine {
$path = "Server/Service[#attribute/name='${_parent_service}']/Engine[#attribute/name='${_parent_engine}']/Host[#attribute/name='${parent_host}']/Context[#attribute/docBase='${_doc_base}']"
} else {
$path = "Server/Service[#attribute/name='${_parent_service}']/Engine/Host/Context[#attribute/docBase='${_doc_base}']"
}
if $context_ensure =~ /^(absent|false)$/ {
$augeaschanges = "rm ${path}"
} else {
$context = "set ${path}/#attribute/docBase ${_doc_base}"
if ! empty($additional_attributes) {
$_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), "set ${path}/#attribute/"), "'")
} else {
$_additional_attributes = undef
}
if ! empty(any2array($attributes_to_remove)) {
$_attributes_to_remove = prefix(any2array($attributes_to_remove), "rm ${path}/#attribute/")
} else {
$_attributes_to_remove = undef
}
$augeaschanges = delete_undef_values(flatten([$context, $_additional_attributes, $_attributes_to_remove]))
}
augeas { "${_catalina_base}-${_parent_service}-${_parent_engine}-${parent_host}-context-${name}":
lens => 'Xml.lns',
incl => $_server_config,
changes => $augeaschanges,
}
}

View File

@@ -0,0 +1,113 @@
# Definition: tomcat::config::server::engine
#
# Configure Engine elements in $CATALINA_BASE/conf/server.xml
#
# Parameters:
# - $default_host is the defaultHost attribute for the Engine. This parameter is
# required.
# - $catalina_base is the base directory for the Tomcat installation.
# - $background_processor_delay is the optional backgroundProcessorDelay
# attribute.
# - $background_processor_delay_ensure specifies whether you are trying to add
# or remove the backgroundProcessorDelay attribute. Valid values are 'true',
# 'false', 'present', and 'absent'. Defaults to 'present'.
# - $class_name is the optional className attribute.
# - $class_name_ensure specifies whether you are trying to add or remove the
# className attribute. Valid values are 'true', 'false', 'present', and
# 'absent'. Defaults to 'present'.
# - $engine_name is the name attribute. Defaults to $name.
# - $jvm_route is the optional jvmRoute attribute.
# - $jvm_route_ensure specifies whether you are trying to add or remove the
# jvmRoute attribute. Valid values are 'true', 'false', 'present', and
# 'absent'. Defaults to 'present'.
# - $parent_service is the Service element this Engine should be nested beneath.
# Defaults to 'Catalina'.
# - $start_stop_threads is the optional startStopThreads attribute
# - $start_stop_threads_ensure specifies whether you are trying to add or remove
# the startStopThreads attribute. Valid values are 'true', 'false', 'present'
# and 'absent'. Defaults to 'present'.
define tomcat::config::server::engine (
$default_host,
$catalina_base = undef,
$background_processor_delay = undef,
$background_processor_delay_ensure = 'present',
$class_name = undef,
$class_name_ensure = 'present',
$engine_name = undef,
$jvm_route = undef,
$jvm_route_ensure = 'present',
$parent_service = 'Catalina',
$start_stop_threads = undef,
$start_stop_threads_ensure = 'present',
$server_config = undef,
) {
include tomcat
$_catalina_base = pick($catalina_base, $::tomcat::catalina_home)
tag(sha1($_catalina_base))
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
validate_re($background_processor_delay_ensure, '^(present|absent|true|false)$')
validate_re($class_name_ensure, '^(present|absent|true|false)$')
validate_re($jvm_route_ensure, '^(present|absent|true|false)$')
validate_re($start_stop_threads_ensure, '^(present|absent|true|false)$')
if $engine_name {
$_name = $engine_name
} else {
$_name = $name
}
$base_path = "Server/Service[#attribute/name='${parent_service}']/Engine"
$_name_change = "set ${base_path}/#attribute/name ${_name}"
$_default_host = "set ${base_path}/#attribute/defaultHost ${default_host}"
if $background_processor_delay_ensure =~ /^(absent|false)$/ {
$_background_processor_delay = "rm ${base_path}/#attribute/backgroundProcessorDelay"
} elsif $background_processor_delay {
$_background_processor_delay = "set ${base_path}/#attribute/backgroundProcessorDelay ${background_processor_delay}"
} else {
$_background_processor_delay = undef
}
if $class_name_ensure =~ /^(absent|false)$/ {
$_class_name = "rm ${base_path}/#attribute/className"
} elsif $class_name {
$_class_name = "set ${base_path}/#attribute/className ${class_name}"
} else {
$_class_name = undef
}
if $jvm_route_ensure =~ /^(absent|false)$/ {
$_jvm_route = "rm ${base_path}/#attribute/jvmRoute"
} elsif $jvm_route {
$_jvm_route = "set ${base_path}/#attribute/jvmRoute ${jvm_route}"
} else {
$_jvm_route = undef
}
if $start_stop_threads_ensure =~ /^(absent|false)$/ {
$_start_stop_threads = "rm ${base_path}/#attribute/startStopThreads"
} elsif $start_stop_threads {
$_start_stop_threads = "set ${base_path}/#attribute/startStopThreads ${start_stop_threads}"
} else {
$_start_stop_threads = undef
}
if $server_config {
$_server_config = $server_config
} else {
$_server_config = "${_catalina_base}/conf/server.xml"
}
$changes = delete_undef_values([$_name_change, $_default_host, $_background_processor_delay, $_class_name, $_jvm_route, $_start_stop_threads])
augeas { "${_catalina_base}-${parent_service}-engine":
lens => 'Xml.lns',
incl => $_server_config,
changes => $changes,
}
}

View File

@@ -0,0 +1,83 @@
# Definition: tomcat::config::server::globalnamingresource
#
# Configure GlobalNamingResources Resource elements in $CATALINA_BASE/conf/server.xml
#
# Parameters:
# - $catalina_base is the base directory for the Tomcat installation.
# - $resource_ensure specifies whether you are trying to add or remove the
# Resource element. Valid values are 'true', 'false', 'present', and
# 'absent'. Defaults to 'present'.
# - An optional $resource_name that replaces the $name from the resource.
# - An optional string containing the $type of the element. Used verbatim
# to create a <GlobalNamingResources><${type} /></GlobalNamingResources>
# node. Should be used for "Environment" entries, for example.
# - An optional hash of $additional_attributes to add to the Resource. Should
# be of the format 'attribute' => 'value'.
# - An optional array of $attributes_to_remove from the Resource.
define tomcat::config::server::globalnamingresource (
$catalina_base = $::tomcat::catalina_home,
$resource_name = undef,
$type = 'Resource',
$ensure = 'present',
$additional_attributes = {},
$attributes_to_remove = [],
$server_config = undef,
) {
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
validate_re($ensure, '^(present|absent|true|false)$')
validate_hash($additional_attributes)
validate_re($catalina_base, '^.*[^/]$', '$catalina_base must not end in a /!')
if $resource_name {
$_resource_name = $resource_name
} else {
$_resource_name = $name
}
$base_path = "Server/GlobalNamingResources/${type}[#attribute/name='${_resource_name}']"
if $server_config {
$_server_config = $server_config
} else {
$_server_config = "${catalina_base}/conf/server.xml"
}
if $ensure =~ /^(absent|false)$/ {
$changes = "rm ${base_path}"
} else {
if ! empty($additional_attributes) {
$set_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), "set ${base_path}/#attribute/"), "'")
} else {
$set_additional_attributes = undef
}
if ! empty(any2array($attributes_to_remove)) {
$rm_attributes_to_remove = prefix(any2array($attributes_to_remove), "rm ${base_path}/#attribute/")
} else {
$rm_attributes_to_remove = undef
}
$changes = delete_undef_values(flatten([
$set_additional_attributes,
$rm_attributes_to_remove,
]))
}
# (MODULES-3353) This should use $set_name in $changes like
# t:config::context::resource and others instead of an additional augeas
# resource
augeas { "server-${catalina_base}-globalresource-${name}-definition":
lens => 'Xml.lns',
incl => $_server_config,
changes => "set ${base_path}/#attribute/name '${_resource_name}'",
before => Augeas["server-${catalina_base}-globalresource-${name}"],
}
augeas { "server-${catalina_base}-globalresource-${name}":
lens => 'Xml.lns',
incl => $_server_config,
changes => $changes,
}
}

View File

@@ -0,0 +1,98 @@
# Definition: tomcat::config::server::host
#
# Configure Host elements in $CATALINA_BASE/conf/server.xml
#
# Parameters:
# - $app_base is the appBase attribute for the Host. This parameter is required
# unless $host_ensure is set to 'false' or 'absent'.
# - $catalina_base is the base directory for the Tomcat installation.
# - $host_ensure specifies whether you are trying to add or remove the Host
# element. Valid values are 'true', 'false', 'present', and 'absent'. Defaults
# to 'present'.
# - $host_name is the name attribute for the Host. Defaults to $name.
# - $parent_service is the Service element this Host should be nested beneath.
# Defaults to 'Catalina'
# - An optional hash of $additional_attributes to add to the Host. Should be of
# the format 'attribute' => 'value'.
# - An optional array of $attributes_to_remove from the Host.
# - $aliases is an optional array of aliases for the Host. If omitted, the
# set of Alias elements within the Host element will not be altered.
# Otherwise, the set of Alias elements will be set to exactly match the
# contents of this array. An empty array can be used to ensure that there
# are no Alias elements within the Host element.
define tomcat::config::server::host (
$app_base = undef,
$catalina_base = undef,
$host_ensure = 'present',
$host_name = undef,
$parent_service = 'Catalina',
$additional_attributes = {},
$attributes_to_remove = [],
$server_config = undef,
$aliases = undef,
) {
include tomcat
$_catalina_base = pick($catalina_base, $::tomcat::catalina_home)
tag(sha1($_catalina_base))
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
validate_re($host_ensure, '^(present|absent|true|false)$')
validate_hash($additional_attributes)
if $host_name {
$_host_name = $host_name
} else {
$_host_name = $name
}
$base_path = "Server/Service[#attribute/name='${parent_service}']/Engine/Host[#attribute/name='${_host_name}']"
if $server_config {
$_server_config = $server_config
} else {
$_server_config = "${_catalina_base}/conf/server.xml"
}
if $host_ensure =~ /^(absent|false)$/ {
$changes = "rm ${base_path}"
} else {
if ! $app_base {
fail('$app_base must be specified if you aren\'t removing the host')
}
$_host_name_change = "set ${base_path}/#attribute/name ${_host_name}"
$_app_base = "set ${base_path}/#attribute/appBase ${app_base}"
if ! empty($additional_attributes) {
$_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), "set ${base_path}/#attribute/"), "'")
} else {
$_additional_attributes = undef
}
if ! empty(any2array($attributes_to_remove)) {
$_attributes_to_remove = prefix(any2array($attributes_to_remove), "rm ${base_path}/#attribute/")
} else {
$_attributes_to_remove = undef
}
if $aliases {
validate_array($aliases)
$_clear_aliases = "rm ${base_path}/Alias"
$_add_aliases = suffix(prefix($aliases, "set ${base_path}/Alias[last()+1]/#text '"), "'")
} else {
$_clear_aliases = undef
$_add_aliases = undef
}
$changes = delete_undef_values(flatten([$_host_name_change, $_app_base, $_additional_attributes, $_attributes_to_remove, $_clear_aliases, $_add_aliases]))
}
augeas { "${_catalina_base}-${parent_service}-host-${name}":
lens => 'Xml.lns',
incl => $_server_config,
changes => $changes,
}
}

View File

@@ -0,0 +1,98 @@
# Definition: tomcat::config::server::listener
#
# Configure Listener elements in $CATALINA_BASE/conf/server.xml
#
# Parameters:
# - $catalina_base is the base directory for the Tomcat installation.
# - $listener_ensure specifies whether you are trying to add or remove the
# Listener element. Valid values are 'true', 'false', 'present', and
# 'absent'. Defaults to 'present'.
# - $class_name is the Java class name of the implementation to use.
# Defaults to $name.
# - $parent_service is the Service element this Listener should be nested
# beneath. Only valid if $parent_host or $parent_engine is specified. Defaults
# to 'Catalina' if $parent_host or $parent_engine was specified.
# - $parent_engine is the `name` attribute to the Engine element this Listener
# should be nested beneath.
# - $parent_host is the `name` attribute to the Engine element this Listener
# should be nested beneath.
# - An optional hash of $additional_attributes to add to the Listener. Should
# be of the format 'attribute' => 'value'.
# - An optional array of $attributes_to_remove from the Listener.
define tomcat::config::server::listener (
$catalina_base = $::tomcat::catalina_home,
$listener_ensure = 'present',
$class_name = undef,
$parent_service = undef,
$parent_engine = undef,
$parent_host = undef,
$additional_attributes = {},
$attributes_to_remove = [],
$server_config = undef,
) {
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
validate_re($listener_ensure, '^(present|absent|true|false)$')
validate_hash($additional_attributes)
validate_array($attributes_to_remove)
if $parent_service and ! ($parent_host or $parent_engine) {
warning('listener elements cannot be nested directly under service elements, ignoring $parent_service')
}
if ! $parent_service and ($parent_engine or $parent_host) {
$_parent_service = 'Catalina'
} else {
$_parent_service = $parent_service
}
if $class_name {
$_class_name = $class_name
} else {
$_class_name = $name
}
if $parent_engine and ! $parent_host {
$path = "Server/Service[#attribute/name='${_parent_service}']/Engine[#attribute/name='${parent_engine}']/Listener[#attribute/className='${_class_name}']"
} elsif $parent_engine and $parent_host {
$path = "Server/Service[#attribute/name='${_parent_service}']/Engine[#attribute/name='${parent_engine}']/Host[#attribute/name='${parent_host}']/Listener[#attribute/className='${_class_name}']"
} elsif $parent_host {
$path = "Server/Service[#attribute/name='${_parent_service}']/Engine/Host[#attribute/name='${parent_host}']/Listener[#attribute/className='${_class_name}']"
} else {
$path = "Server/Listener[#attribute/className='${_class_name}']"
}
if $server_config {
$_server_config = $server_config
} else {
$_server_config = "${catalina_base}/conf/server.xml"
}
if $listener_ensure =~ /^(absent|false)$/ {
$augeaschanges = "rm ${path}"
} else {
$listener = "set ${path}/#attribute/className ${_class_name}"
if ! empty($additional_attributes) {
$_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), "set ${path}/#attribute/"), "'")
} else {
$_additional_attributes = undef
}
if ! empty(any2array($attributes_to_remove)) {
$_attributes_to_remove = prefix(any2array($attributes_to_remove), "rm ${path}/#attribute/")
} else {
$_attributes_to_remove = undef
}
$augeaschanges = delete_undef_values(flatten([$listener, $_additional_attributes, $_attributes_to_remove]))
}
augeas { "${catalina_base}-${_parent_service}-${parent_engine}-${parent_host}-listener-${name}":
lens => 'Xml.lns',
incl => $_server_config,
changes => $augeaschanges,
}
}

View File

@@ -0,0 +1,116 @@
# Definition: tomcat::config::server::realm
#
# Configure Realm elements in $CATALINA_BASE/conf/server.xml
#
# Parameters:
# - $catalina_base is the base directory for the Tomcat installation.
# - $class_name is the Java class name of the Realm implementation to use.
# - $realm_ensure specifies whether you are adding or removing a
# Realm element. Valid values are 'true', 'false', 'present', and
# 'absent'. Defaults to 'present'.
# - $parent_service is the `name` attribute for the Service element this Realm
# should be nested beneath. Defaults to 'Catalina'.
# - $parent_engine is the `name` attribute for the Engine element this Realm
# should be nested beneath. Defaults to 'Catalina'.
# - $parent_host is the `name` attribute for the Host element this Realm
# should be nested beneath.
# - $parent_realm is the `name` attribute for the Realm element this Realm
# should be nested beneath.
# - An optional hash of $additional_attributes to add to the Realm. Should
# be of the format 'attribute' => 'value'.
# - An optional array of $attributes_to_remove from the Realm.
define tomcat::config::server::realm (
$catalina_base = undef,
$class_name = $name,
$realm_ensure = 'present',
$parent_service = 'Catalina',
$parent_engine = 'Catalina',
$parent_host = undef,
$parent_realm = undef,
$additional_attributes = {},
$attributes_to_remove = [],
$purge_realms = undef,
$server_config = undef,
) {
include tomcat
$_catalina_base = pick($catalina_base, $::tomcat::catalina_home)
tag(sha1($_catalina_base))
$_purge_realms = pick($purge_realms, $::tomcat::purge_realms)
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
validate_re($realm_ensure, '^(present|absent|true|false)$')
validate_hash($additional_attributes)
validate_array($attributes_to_remove)
validate_bool($_purge_realms)
if $_purge_realms and ($realm_ensure =~ /^(absent|false)$/) {
fail('$realm_ensure must be set to \'true\' or \'present\' to use $purge_realms')
}
if $_purge_realms {
# Perform deletions in reverse depth order as workaround for
# https://github.com/hercules-team/augeas/issues/319
$__purge_realms = [
'rm //Realm//Realm',
'rm //Context//Realm',
'rm //Host//Realm',
'rm //Engine//Realm',
'rm //Server//Realm',
]
} else {
$__purge_realms = undef
}
$engine_path = "Server/Service[#attribute/name='${parent_service}']/Engine[#attribute/name='${parent_engine}']"
# The Realm may be nested under a Host element.
if $parent_host {
$host_path = "${engine_path}/Host[#attribute/name='${parent_host}']"
} else {
$host_path = $engine_path
}
# The Realm could also be nested under another Realm element if the parent realm is a CombinedRealm.
if $parent_realm {
$path = "${host_path}/Realm[#attribute/className='${parent_realm}']/Realm"
}
else {
$path = "${host_path}/Realm"
}
if $server_config {
$_server_config = $server_config
} else {
$_server_config = "${_catalina_base}/conf/server.xml"
}
if $realm_ensure =~ /^(absent|false)$/ {
$changes = "rm ${path}[#attribute/className='${class_name}']"
}
else {
$_class_name = "set ${path}[#attribute/className='${class_name}']/#attribute/className ${class_name}"
if ! empty($additional_attributes) {
$_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), "set ${path}[#attribute/className='${class_name}']/#attribute/"), "'")
} else {
$_additional_attributes = undef
}
if ! empty(any2array($attributes_to_remove)) {
$_attributes_to_remove = prefix(any2array($attributes_to_remove), "rm ${path}[#attribute/className='${class_name}']/#attribute/")
} else {
$_attributes_to_remove = undef
}
$changes = delete_undef_values(flatten([ $__purge_realms, $_class_name, $_additional_attributes, $_attributes_to_remove ]))
}
augeas { "${_catalina_base}-${parent_service}-${parent_engine}-${parent_host}-${parent_realm}-realm-${name}":
lens => 'Xml.lns',
incl => $_server_config,
changes => $changes,
}
}

View File

@@ -0,0 +1,60 @@
# Definition: tomcat::config::server::service
#
# Configure a Service element nested in the Server element in
# $CATALINA_BASE/conf/server.xml
#
# Parameters:
# - $catalina_base is the root of the Tomcat installation.
# - $class_name is the optional className attribute
# - $class_name_ensure specifies whether you are trying to set or remove the
# className attribute. Valid values are 'true', 'false', 'present', or
# 'absent'. Defaults to 'present'.
# - $service_ensure specifies whether you are trying to add or remove the
# service element. Valid values are 'true', 'false', 'present', or 'absent'.
# Defaults to 'present'.
define tomcat::config::server::service (
$catalina_base = undef,
$class_name = undef,
$class_name_ensure = 'present',
$service_ensure = 'present',
$server_config = undef,
) {
include tomcat
$_catalina_base = pick($catalina_base, $::tomcat::catalina_home)
tag(sha1($_catalina_base))
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
validate_re($service_ensure, '^(present|absent|true|false)$')
validate_re($class_name_ensure, '^(present|absent|true|false)$')
if $server_config {
$_server_config = $server_config
} else {
$_server_config = "${_catalina_base}/conf/server.xml"
}
if $service_ensure =~ /^(absent|false)$/ {
$changes = "rm Server/Service[#attribute/name='${name}']"
} else {
if $class_name_ensure =~ /^(absent|false)$/ {
$_class_name = "rm Server/Service[#attribute/name='${name}']/#attribute/className"
} elsif $class_name {
$_class_name = "set Server/Service[#attribute/name='${name}']/#attribute/className ${class_name}"
} else {
$_class_name = undef
}
$_service = "set Server/Service[#attribute/name='${name}']/#attribute/name ${name}"
$changes = delete_undef_values([$_service, $_class_name])
}
if ! empty($changes) {
augeas { "server-${_catalina_base}-service-${name}":
lens => 'Xml.lns',
incl => $_server_config,
changes => $changes,
}
}
}

View File

@@ -0,0 +1,111 @@
# Definition tomcat::config::server::tomcat_users
#
# Configures roles and users in $CATALINA_BASE/conf/tomcat-users.xml
# or any other specified file
#
# Parameters:
# - $catalina_base is the base directory for the Tomcat installation
# - $element specifies the element type. Valid values are 'user' or 'role'.
# Defaults to 'user'.
# - $element_name sets the 'username' or 'rolename'. Depends on the $element.
# Defaults to $name.
# - $ensure specifies whether you are trying to add or remove the element.
# Valid values are 'present', 'absent', 'true', and 'false'. Defaults to
# 'present'.
# - $file: The path to the file to manage. Must be fully qualified.
# Defaults to $CATALINA_BASE/conf/tomcat-users.xml.
# - Set $manage_file to true for managing the file. It sets file permission,
# owner, group and create a basic tomcat-users XML if file does not exist yet.
# - $owner specifies the owner of the file if $manage_file is true. Default: $tomcat::user
# - $group specifies the group of the file if $manage_file is true. Default: $tomcat::group
# - $password specifies the password for a user ($element = 'user').
# - $roles specifies the roles for a user ($element = 'user').
#
define tomcat::config::server::tomcat_users (
$catalina_base = $::tomcat::catalina_home,
$element = 'user',
$element_name = undef,
$ensure = present,
$file = undef,
$manage_file = true,
$owner = undef,
$group = undef,
$password = undef,
$roles = [],
) {
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
$_owner = pick($owner, $::tomcat::user)
$_group = pick($group, $::tomcat::group)
validate_re($element, '^(user|role)$')
validate_re($ensure, '^(present|absent|true|false)$')
validate_array($roles)
validate_bool($manage_file)
if $element == 'role' and ( $password or ! empty($roles) ) {
warning('$password and $roles are useless when $element is set to \'role\'')
}
if $element == 'user' {
$element_identifier = 'username'
} else {
$element_identifier = 'rolename'
}
if $element_name {
$_element_name = $element_name
} else {
$_element_name = $name
}
if $file {
$_file = $file
} else {
$_file = "${catalina_base}/conf/tomcat-users.xml"
}
if $manage_file {
ensure_resource('file', $_file, {
ensure => file,
path => $_file,
replace => false,
content => '<?xml version=\'1.0\' encoding=\'utf-8\'?><tomcat-users></tomcat-users>',
owner => $_owner,
group => $_group,
mode => '0640',
})
}
$path = "tomcat-users/${element}[#attribute/${element_identifier}='${_element_name}']"
if $ensure =~ /^(absent|false)$/ {
$add_entry = undef
$remove_entry = "rm ${path}"
$add_password = undef
$add_roles = undef
} else {
$add_entry = "set ${path}/#attribute/${element_identifier} '${_element_name}'"
$remove_entry = undef
if $element == 'user' {
$add_password = "set ${path}/#attribute/password '${password}'"
$add_roles = join(["set ${path}/#attribute/roles '",join($roles, ','),"'"])
} else {
$add_password = undef
$add_roles = undef
}
}
$changes = delete_undef_values([$remove_entry, $add_entry, $add_password, $add_roles])
augeas { "${catalina_base}-tomcat_users-${element}-${_element_name}-${name}":
lens => 'Xml.lns',
incl => $_file,
changes => $changes,
require => File[$_file],
}
}

View File

@@ -0,0 +1,89 @@
# Definition tomcat::config::server::valve
#
# Configure a Valve element in $CATALINA_BASE/conf/server.xml
#
# Parameters:
# - $catalina_base is the root of the Tomcat installation
# - $class_name is the className attribute. If not specified, defaults to $name.
# - $parent_host is the Host element this Valve should be nested beneath. If not
# specified, the Valve will be nested beneath the Engine under
# $parent_service.
# - $parent_context is the Context element this Valve should be nested beneath
# under the host element. If not specified, the Valve will be nested beneath
# the parent host
# - $parent_service is the Service element this Valve should be nested beneath.
# Defaults to 'Catalina'.
# - $valve_ensure specifies whether you are trying to add or remove the Vavle
# element. Valid values are 'true', 'false', 'present', or 'absent'. Defaults
# to 'present'.
# - An optional hash of $additional_attributes to add to the Valve. Should be of
# the format 'attribute' => 'value'.
# - An optional array of $attributes_to_remove from the Valve.
define tomcat::config::server::valve (
$catalina_base = undef,
$class_name = undef,
$parent_host = undef,
$parent_service = 'Catalina',
$parent_context = undef,
$valve_ensure = 'present',
$additional_attributes = {},
$attributes_to_remove = [],
$server_config = undef,
) {
include tomcat
$_catalina_base = pick($catalina_base, $::tomcat::catalina_home)
tag(sha1($_catalina_base))
if versioncmp($::augeasversion, '1.0.0') < 0 {
fail('Server configurations require Augeas >= 1.0.0')
}
validate_re($valve_ensure, '^(present|absent|true|false)$')
validate_hash($additional_attributes)
if $class_name {
$_class_name = $class_name
} else {
$_class_name = $name
}
if $parent_host {
if $parent_context {
$base_path = "Server/Service[#attribute/name='${parent_service}']/Engine/Host[#attribute/name='${parent_host}']/Context[#attribute/docBase='${parent_context}']/Valve[#attribute/className='${_class_name}']"
} else {
$base_path = "Server/Service[#attribute/name='${parent_service}']/Engine/Host[#attribute/name='${parent_host}']/Valve[#attribute/className='${_class_name}']"
}
} else {
$base_path = "Server/Service[#attribute/name='${parent_service}']/Engine/Valve[#attribute/className='${_class_name}']"
}
if $server_config {
$_server_config = $server_config
} else {
$_server_config = "${_catalina_base}/conf/server.xml"
}
if $valve_ensure =~ /^(absent|false)$/ {
$changes = "rm ${base_path}"
} else {
$_class_name_change = "set ${base_path}/#attribute/className ${_class_name}"
if ! empty($additional_attributes) {
$_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), "set ${base_path}/#attribute/"), "'")
} else {
$_additional_attributes = undef
}
if ! empty(any2array($attributes_to_remove)) {
$_attributes_to_remove = prefix(any2array($attributes_to_remove), "rm ${base_path}/#attribute/")
} else {
$_attributes_to_remove = undef
}
$changes = delete_undef_values(flatten([$_class_name_change, $_additional_attributes, $_attributes_to_remove]))
}
augeas { "${_catalina_base}-${parent_service}-${parent_host}-valve-${name}":
lens => 'Xml.lns',
incl => $_server_config,
changes => $changes,
}
}

View File

@@ -0,0 +1,57 @@
# == Class: tomcat
#
# Class to manage installation and configuration of Tomcat.
#
# === Parameters
#
# [*catalina_home*]
# The base directory for the Tomcat installation. Default: /opt/apache-tomcat
#
# [*user*]
# The user to run Tomcat as. Default: tomcat
#
# [*group*]
# The group to run Tomcat as. Default: tomcat
#
# [*manage_user*]
# Boolean specifying whether or not to manage the user. Defaults to true.
#
# [*purge_connectors*]
# Boolean specifying whether to purge all Connector elements from server.xml. Defaults to false.
#
# [*purge_realms*]
# Boolean specifying whether to purge all Realm elements from server.xml. Defaults to false.
#
# [*manage_group*]
# Boolean specifying whether or not to manage the group. Defaults to true.
#
# [*manage_properties*]
# Boolean specifying whether or not to manage the catalina.properties file. Defaults to true.
class tomcat (
$catalina_home = $::tomcat::params::catalina_home,
$user = $::tomcat::params::user,
$group = $::tomcat::params::group,
$install_from_source = true,
$purge_connectors = false,
$purge_realms = false,
$manage_user = true,
$manage_group = true,
$manage_home = true,
$manage_base = true,
$manage_properties = true,
) inherits ::tomcat::params {
validate_bool($install_from_source)
validate_bool($purge_connectors)
validate_bool($purge_realms)
validate_bool($manage_user)
validate_bool($manage_group)
validate_bool($manage_home)
validate_bool($manage_base)
case $::osfamily {
'windows','Solaris','Darwin': {
fail("Unsupported osfamily: ${::osfamily}")
}
default: { }
}
}

View File

@@ -0,0 +1,58 @@
#
define tomcat::install (
$catalina_home = $name,
$install_from_source = undef,
# source options
$source_url = undef,
$source_strip_first_dir = true,
$environment = undef,
$user = undef,
$group = undef,
$manage_user = undef,
$manage_group = undef,
$manage_home = undef,
# package options
$package_ensure = undef,
$package_name = undef,
$package_options = undef,
) {
include ::tomcat
$_install_from_source = pick($install_from_source, $::tomcat::install_from_source)
$_user = pick($user, $::tomcat::user)
$_group = pick($group, $::tomcat::group)
$_manage_user = pick($manage_user, $::tomcat::manage_user)
$_manage_group = pick($manage_group, $::tomcat::manage_group)
$_manage_home = pick($manage_home, $::tomcat::manage_home)
validate_bool($_install_from_source, $source_strip_first_dir)
tag(sha1($catalina_home))
if $_install_from_source {
if $_manage_user {
ensure_resource('user', $_user, {
ensure => present,
gid => $_group,
})
}
if $_manage_group {
ensure_resource('group', $_group, {
ensure => present,
})
}
tomcat::install::source { $name:
catalina_home => $catalina_home,
manage_home => $_manage_home,
source_url => $source_url,
source_strip_first_dir => $source_strip_first_dir,
environment => $environment,
user => $_user,
group => $_group,
}
} else {
tomcat::install::package { $package_name:
package_ensure => $package_ensure,
package_options => $package_options,
}
}
}

View File

@@ -0,0 +1,22 @@
# Definition: tomcat::install::package
#
# Private define to install Tomcat from a package.
#
# Parameters:
# - $package_ensure is the ensure passed to the package resource.
# - The $package_name you want to install.
# - $package_options to pass extra options to the package resource.
define tomcat::install::package (
$package_ensure,
$package_options,
$package_name = $name,
) {
if $caller_module_name != $module_name {
fail("Use of private class ${name} by ${caller_module_name}")
}
package { $package_name:
ensure => $package_ensure,
install_options => $package_options,
}
}

View File

@@ -0,0 +1,58 @@
# Definition: tomcat::install::source
#
# Private define to install Tomcat from source.
#
# Parameters:
# - $catalina_home is the root of the Tomcat installation.
# - The $source_url to install from.
# - $source_strip_first_dir is a boolean specifying whether or not to strip
# the first directory when unpacking the source tarball. Defaults to true
# when installing from source on non-Solaris systems. Requires puppet/staging
# > 0.4.0
# - $environment is variables for settings such as http_proxy, https_proxy, or ftp_proxy
define tomcat::install::source (
$catalina_home,
$manage_home,
$source_url,
$source_strip_first_dir,
$user,
$group,
$environment = undef,
) {
tag(sha1($catalina_home))
include ::staging
if $caller_module_name != $module_name {
fail("Use of private class ${name} by ${caller_module_name}")
}
if $source_strip_first_dir {
$_strip = 1
}
$filename = regsubst($source_url, '.*/(.*)', '\1')
if $manage_home {
file { $catalina_home:
ensure => directory,
owner => $user,
group => $group,
}
}
ensure_resource('staging::file',$filename, {
'source' => $source_url,
'environment' => $environment,
})
staging::extract { "${name}-${filename}":
source => "${::staging::path}/tomcat/${filename}",
target => $catalina_home,
require => Staging::File[$filename],
unless => "test -f ${catalina_home}/NOTICE",
user => $user,
group => $group,
environment => $environment,
strip => $_strip,
}
}

View File

@@ -0,0 +1,176 @@
# Definition: tomcat::instance
#
# This define installs an instance of Tomcat.
#
# Parameters:
# - $catalina_home is the root of the Tomcat installation. This parameter only
# affects the instance when $install_from_source is true. Default:
# $tomcat::catalina_home
# - $catalina_base is the base directory for the Tomcat instance if different
# from $catalina_home. This parameter only affects the instance when
# $install_from_source is true. Default: $catalina_home
# - $install_from_source is a boolean specifying whether or not to install from
# source. Defaults to true.
# - The $source_url to install from. Required if $install_from_source is true.
# - $source_strip_first_dir is a boolean specifying whether or not to strip
# the first directory when unpacking the source tarball. Defaults to true
# when installing from source. Requires puppet/staging > 0.4.0
# - $package_ensure when installing from package, what the ensure should be set
# to in the package resource.
# - $package_name is the name of the package you want to install. Required if
# $install_from_source is false.
# - $package_options to pass extra options to the package resource.
# - $user is the owner of the tomcat home and base. Default: $tomcat::user
# - $group is the group of the tomcat home and base. Default: $tomcat::group
define tomcat::instance (
$catalina_home = undef,
$catalina_base = undef,
$user = undef,
$group = undef,
$manage_user = undef,
$manage_group = undef,
$manage_service = undef,
$manage_base = undef,
$manage_properties = undef,
$java_home = undef,
$use_jsvc = undef,
$use_init = undef,
#used for single installs. Deprecated?
$install_from_source = undef,
$source_url = undef,
$source_strip_first_dir = undef,
$package_ensure = undef,
$package_name = undef,
$package_options = undef,
) {
include tomcat
$_catalina_home = pick($catalina_home, $::tomcat::catalina_home)
$_catalina_base = pick($catalina_base, $_catalina_home) #default to home
tag(sha1($_catalina_home))
tag(sha1($_catalina_base))
$_user = pick($user, $::tomcat::user)
$_group = pick($group, $::tomcat::group)
$_manage_user = pick($manage_user, $::tomcat::manage_user)
$_manage_group = pick($manage_group, $::tomcat::manage_group)
$_manage_base = pick($manage_base, $::tomcat::manage_base)
$_manage_properties = pick($manage_properties, $::tomcat::manage_properties)
if $source_url and $install_from_source == undef {
# XXX Backwards compatibility mode enabled; install_from_source used to default
# to true.
$_install_from_source = true
} else {
# XXX If install_from_source is undef, then we're in multi-instance mode. If
# it's true or false, then we're in backwards-compatible mode.
$_install_from_source = $install_from_source
}
tomcat::instance::dependencies { $name:
catalina_home => $_catalina_home,
catalina_base => $_catalina_base,
}
if $_install_from_source != undef {
# XXX This file resource is for backwards compatibility. Previously the base
# class created this directory for source installs, even though it may never
# be used. Users may have created source installs under this directory, so
# it must exist. tomcat::install::source will take care of creating base.
if $_catalina_base != $_catalina_home and $_manage_base {
ensure_resource('file',$_catalina_home, {
ensure => directory,
owner => $_user,
group => $_group,
})
}
# XXX This is for backwards compatibility. Declare a tomcat install, but install
# the software into the base instead of the home.
tomcat::install { $name:
catalina_home => $_catalina_base,
install_from_source => $_install_from_source,
source_url => $source_url,
source_strip_first_dir => $source_strip_first_dir,
user => $_user,
group => $_group,
manage_user => $_manage_user,
manage_group => $_manage_group,
manage_home => $_manage_base,
package_ensure => $package_ensure,
package_name => $package_name,
package_options => $package_options,
}
$_manage_service = pick($manage_service, false)
} else {
if $_catalina_home != $_catalina_base {
if $_manage_user {
ensure_resource('user', $_user, {
ensure => present,
gid => $_group,
})
}
if $_manage_group {
ensure_resource('group', $_group, {
ensure => present,
})
}
if $_manage_base {
# Configure additional instances in custom catalina_base
file { $_catalina_base:
ensure => directory,
owner => $_user,
group => $_group,
}
}
$dir_list = [
"${_catalina_base}/bin",
"${_catalina_base}/conf",
"${_catalina_base}/lib",
"${_catalina_base}/logs",
"${_catalina_base}/temp",
"${_catalina_base}/webapps",
"${_catalina_base}/work",
]
# Ensure install finishes before creating instances from it.
$home_sha = sha1($_catalina_home)
Tomcat::Install <| tag == $home_sha |> -> File[$dir_list]
file { $dir_list:
ensure => directory,
owner => $_user,
group => $_group,
mode => '2770',
}
$copy_to_base_list = [
"${_catalina_base}/conf/catalina.policy",
"${_catalina_base}/conf/context.xml",
"${_catalina_base}/conf/logging.properties",
"${_catalina_base}/conf/server.xml",
"${_catalina_base}/conf/web.xml",
]
tomcat::instance::copy_from_home { $copy_to_base_list:
catalina_home => $_catalina_home,
user => $_user,
group => $_group,
}
if $_manage_properties {
tomcat::config::properties { "${_catalina_base} catalina.properties":
catalina_home => $_catalina_home,
catalina_base => $_catalina_base,
user => $_user,
group => $_group,
}
}
}
$_manage_service = pick($manage_service, true)
}
if $_manage_service {
tomcat::service { $name:
catalina_home => $_catalina_home,
catalina_base => $_catalina_base,
java_home => $java_home,
use_jsvc => $use_jsvc,
use_init => $use_init,
user => $_user,
}
}
}

View File

@@ -0,0 +1,25 @@
# Definition: tomcat::instance::copy_from_home
#
# Private define to copy a conf file from catalina_home to catalina_base
#
define tomcat::instance::copy_from_home (
$catalina_home,
$user,
$group,
) {
tag(sha1($catalina_home))
$filename = basename($name)
if $caller_module_name != $module_name {
fail("Use of private class ${name} by ${caller_module_name}")
}
file { $name:
ensure => file,
mode => '0660',
owner => $user,
group => $group,
source => "${catalina_home}/conf/${filename}",
replace => false,
}
}

View File

@@ -0,0 +1,47 @@
# private
define tomcat::instance::dependencies (
$catalina_home,
$catalina_base,
) {
$home_sha = sha1($catalina_home)
$base_sha = sha1($catalina_base)
Tomcat::Install <| tag == $base_sha or tag == $home_sha |>
-> Tomcat::Service <| tag == $base_sha |>
Tomcat::Install <| tag == $base_sha or tag == $home_sha |>
-> Tomcat::Instance::Copy_from_home <| tag == $base_sha |>
-> Tomcat::Service <| tag == $base_sha |>
Tomcat::Install <| tag == $base_sha or tag == $home_sha |>
-> Tomcat::Service <| tag == $base_sha |>
-> Tomcat::Config::Properties <| tag == $base_sha |>
Tomcat::Instance::Copy_from_home <| tag == $base_sha |>
-> Tomcat::Config::Properties <| tag == $base_sha |>
Tomcat::Install <| tag == $base_sha or tag == $home_sha |>
-> Tomcat::Config::Server <| tag == $base_sha |>
~> Tomcat::Service <| tag == $base_sha |>
Tomcat::Instance::Copy_from_home <| tag == $base_sha |>
-> Tomcat::Config::Server <| tag == $base_sha |>
Tomcat::Install <| tag == $base_sha or tag == $home_sha |>
-> Tomcat::Config::Server::Realm <| tag == $base_sha |>
~> Tomcat::Service <| tag == $base_sha |>
Tomcat::Instance::Copy_from_home <| tag == $base_sha |>
-> Tomcat::Config::Server::Realm <| tag == $base_sha |>
Tomcat::Install <| tag == $base_sha or tag == $home_sha |>
-> Tomcat::Config::Server::Connector <| tag == $base_sha |>
~> Tomcat::Service <| tag == $base_sha |>
Tomcat::Instance::Copy_from_home <| tag == $base_sha |>
-> Tomcat::Config::Server::Connector <| tag == $base_sha |>
Tomcat::Install <| tag == $base_sha or tag == $home_sha |>
-> Tomcat::Setenv::Entry <| tag == $base_sha |>
-> Tomcat::Service <| tag == $base_sha |>
Tomcat::Install <| tag == $base_sha or tag == $home_sha |>
-> Tomcat::War <| tag == $base_sha |>
-> Tomcat::Service <| tag == $base_sha |>
}

View File

@@ -0,0 +1,13 @@
# Class: tomcat::params
#
# This class manages Tomcat parameters.
#
# Parameters:
# - $catalina_home is the root of the Tomcat installation.
# - The $user Tomcat runs as.
# - The $group Tomcat runs as.
class tomcat::params {
$catalina_home = '/opt/apache-tomcat'
$user = 'tomcat'
$group = 'tomcat'
}

View File

@@ -0,0 +1,177 @@
# Definition: tomcat::service
#
# Service management for Tomcat.
#
# Parameters:
# - $catalina_home is the root of the Tomcat installation.
# - $catalina_base is the base directory for the Tomcat installation.
# - Whether or not to $use_jsvc for service management. Boolean defaulting to
# false. If both $use_jsvc and $use_init are false,
# $CATALINA_BASE/bin/catalina.sh start and $CATALIN/A_BASE/bin/catalina.sh
# stop are used for service management.
# - If using jsvc, optionally set java_home. Has no affect unless
# $use_jsvc = true.
# - $service_ensure is passed on to the service resource.
# - $service_enable specifies whether the tomcat service should be enabled on
# on boot. Valid options are 'true' or 'false'. Defaults to 'undef', will be
# programmatically set to 'true' if $use_init is true AND
# $service_ensure == 'running'
# - Whether or not to $use_init for service management. Boolean defaulting to
# false. If both $use_jsvc and $use_init are false,
# $CATALINA_BASE/bin/catalina.sh start and $CATALINA_BASE/bin/catalina.sh
# stop are used for service management.
# - The $service_name to use for the packaged init script
# - The $start_command to use for the service
# - The $stop_command to use for the service
# - $user is the user of the jsvc process.
define tomcat::service (
$catalina_home = undef,
$catalina_base = undef,
$use_jsvc = false,
$use_init = false,
$java_home = undef,
$service_ensure = running,
$service_enable = undef,
$service_name = undef,
$start_command = undef,
$stop_command = undef,
$user = undef,
) {
include tomcat
$_user = pick($user, $::tomcat::user)
# XXX Backwards compatibility: If the user declares a base but not a home, we
# assume they are in compatibility mode
if $catalina_base {
$_catalina_home = pick($catalina_home, $catalina_base)
} else {
$_catalina_home = pick($catalina_home, $tomcat::catalina_home)
}
$_catalina_base = pick($catalina_base, $_catalina_home) #default to home
tag(sha1($_catalina_home))
tag(sha1($_catalina_base))
validate_bool($use_jsvc)
validate_bool($use_init)
if $use_init and ! $use_jsvc and ! $service_name {
fail('service_name must be specified when using the package init script')
}
if $use_init and ! $use_jsvc and $catalina_home {
warning('catalina_home has no effect when using the package init script; ignoring')
}
if $use_jsvc and $service_name {
warning('service_name has no effect when using jsvc; ignoring')
}
if ! $use_init and $service_enable != undef {
warning('service_enable has no effect without an init script; ignoring')
}
if ! $use_jsvc and $java_home {
warning('java_home has no effect when not using jsvc; ignoring')
}
if $use_jsvc and $use_init {
$_service_name = "tomcat-${name}"
$_hasstatus = true
$_hasrestart = true
$_start = "service tomcat-${name} start"
$_stop = "service tomcat-${name} stop"
$_status = "service tomcat-${name} status"
$_provider = undef
# Template uses:
# - $_catalina_home
# - $_catalina_base
# - $java_home
# - $_user
file { "/etc/init.d/tomcat-${name}":
mode => '0755',
content => template('tomcat/jsvc-init.erb'),
}
} elsif $use_jsvc {
if $java_home {
$_jsvc_home = "-home ${java_home} "
} else {
$_jsvc_home = undef
}
$_service_name = "tomcat-${name}"
$_hasstatus = false
$_hasrestart = false
if $start_command {
$_start = $start_command
} else {
$_start = "export CATALINA_HOME=${_catalina_home}; export CATALINA_BASE=${_catalina_base}; \
\$CATALINA_HOME/bin/jsvc \
${_jsvc_home}-user ${_user} \
-classpath \$CATALINA_HOME/bin/bootstrap.jar:\$CATALINA_HOME/bin/tomcat-juli.jar \
-outfile \$CATALINA_BASE/logs/catalina.out \
-errfile \$CATALINA_BASE/logs/catalina.err \
-pidfile \$CATALINA_BASE/logs/jsvc.pid \
-Dcatalina.home=\$CATALINA_HOME \
-Dcatalina.base=\$CATALINA_BASE \
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
-Djava.util.logging.config.file=\$CATALINA_BASE/conf/logging.properties \
org.apache.catalina.startup.Bootstrap"
}
if $stop_command {
$_stop = $stop_command
} else {
$_stop = "export CATALINA_HOME=${_catalina_home}; export CATALINA_BASE=${_catalina_base};
\$CATALINA_HOME/bin/jsvc \
-pidfile \$CATALINA_BASE/logs/jsvc.pid \
-stop org.apache.catalina.startup.Bootstrap"
}
$_status = "ps p `cat ${_catalina_base}/logs/jsvc.pid` > /dev/null"
$_provider = 'base'
} elsif $use_init {
$_service_name = $service_name
$_hasstatus = true
$_hasrestart = true
$_start = $start_command
$_stop = $stop_command
$_status = undef
$_provider = undef
} else {
$_service_name = "tomcat-${name}"
$_hasstatus = false
$_hasrestart = false
$_start = $start_command ? {
undef => "su -s /bin/bash -c 'CATALINA_HOME=${_catalina_home} CATALINA_BASE=${_catalina_base} ${_catalina_home}/bin/catalina.sh start' ${_user}",
default => $start_command
}
$_stop = $stop_command ? {
undef => "su -s /bin/bash -c 'CATALINA_HOME=${_catalina_home} CATALINA_BASE=${_catalina_base} ${_catalina_home}/bin/catalina.sh stop' ${_user}",
default => $stop_command
}
$_status = "ps aux | grep 'catalina.base=${_catalina_base} ' | grep -v grep"
$_provider = 'base'
}
if $use_init {
if $service_enable != undef {
validate_bool($service_enable)
$_service_enable = $service_enable
} else {
$_service_enable = $service_ensure ? {
'running' => true,
true => true,
default => undef,
}
}
} else {
$_service_enable = undef
}
service { $_service_name:
ensure => $service_ensure,
enable => $_service_enable,
hasstatus => $_hasstatus,
hasrestart => $_hasrestart,
start => $_start,
stop => $_stop,
status => $_status,
provider => $_provider,
}
}

View File

@@ -0,0 +1,81 @@
# Definition tomcat::setenv::entry
#
# This define adds an entry to the setenv.sh script.
#
# Parameters:
# - $value is the value of the parameter you're setting
# - $ensure whether the fragment should be present or absent.
# - $config_file is the path to the config file to edit
# - $param is the parameter you're setting. Defaults to $name.
# - $quote_char is the optional character to quote the value with.
# - $order is the optional order to the param in the file. Defaults to 10
# - $doexport is the optional prefix before the variable.
# - (Deprecated) $base_path is the path to create the setenv.sh script under. Should be
# either $catalina_base/bin or $catalina_home/bin.
define tomcat::setenv::entry (
$value,
$ensure = 'present',
$catalina_home = undef,
$config_file = undef,
$param = $name,
$quote_char = undef,
$order = '10',
$addto = undef,
$doexport = true,
$user = undef,
$group = undef,
# Deprecated
$base_path = undef,
) {
include tomcat
$_user = pick($user, $::tomcat::user)
$_group = pick($group, $::tomcat::group)
$_catalina_home = pick($catalina_home, $::tomcat::catalina_home)
$home_sha = sha1($_catalina_home)
tag($home_sha)
Tomcat::Install <| tag == $home_sha |>
-> Tomcat::Setenv::Entry[$name]
if $base_path {
warning('The $base_path parameter is deprecated; please use catalina_home or config_file instead')
$_config_file = "${base_path}/setenv.sh"
} else {
$_config_file = $config_file ? {
undef => "${_catalina_home}/bin/setenv.sh",
default => $config_file,
}
}
if ! $quote_char {
$_quote_char = ''
} else {
$_quote_char = $quote_char
}
if ! defined(Concat[$_config_file]) {
concat { $_config_file:
owner => $_user,
group => $_group,
mode => '0755',
ensure_newline => true,
}
}
if $doexport {
$_doexport = 'export'
} else {
$_doexport = ''
}
if $addto {
$_content = inline_template('<%= @_doexport %> <%= @param %>=<%= @_quote_char %><%= Array(@value).join(" ") %><%= @_quote_char}"\n" %> ; <%= @_doexport %> <%= @addto %>="$<%= @addto %> $<%= @param %>"')
} else {
$_content = inline_template('<%= @_doexport %> <%= @param %>=<%= @_quote_char %><%= Array(@value).join(" ") %><%= @_quote_char+"\n" %>')
}
concat::fragment { "setenv-${name}":
target => $_config_file,
content => $_content,
order => $order,
}
}

View File

@@ -0,0 +1,83 @@
# Definition: tomcat::war
#
# Manage deployment of WAR files.
#
# Parameters:
# - $catalina_base is the base directory for the Tomcat installation
# - $app_base is the path relative to $catalina_base to deploy the WAR to.
# Defaults to 'webapps'.
# - The $deployment_path can optionally be specified. Only one of $app_base and
# $deployment_path can be specified.
# - $war_ensure specifies whether you are trying to add or remove the WAR.
# Valid values are 'present', 'absent', 'true', and 'false'. Defaults to
# 'present'.
# _ Optionally specify a $war_name. Defaults to $name.
# - $war_purge is a boolean specifying whether or not to purge the exploded WAR
# directory. Defaults to true. Only applicable when $war_ensure is 'absent'
# or 'false'. Note: if tomcat is running and autodeploy is on, setting
# $war_purge to false won't stop tomcat from auto-undeploying exploded WARs.
# - $war_source is the source to deploy the WAR from. Currently supports
# http(s)://, puppet://, and ftp:// paths. $war_source must be specified
# unless $war_ensure is set to 'false' or 'absent'.
define tomcat::war(
$catalina_base = undef,
$app_base = undef,
$deployment_path = undef,
$war_ensure = 'present',
$war_name = undef,
$war_purge = true,
$war_source = undef,
) {
include tomcat
$_catalina_base = pick($catalina_base, $::tomcat::catalina_home)
tag(sha1($_catalina_base))
validate_re($war_ensure, '^(present|absent|true|false)$')
validate_bool($war_purge)
if $app_base and $deployment_path {
fail('Only one of $app_base and $deployment_path can be specified.')
}
if $war_name {
$_war_name = $war_name
} else {
$_war_name = $name
}
validate_re($_war_name, '\.war$')
if $deployment_path {
$_deployment_path = $deployment_path
} else {
if $app_base {
$_app_base = $app_base
} else {
$_app_base = 'webapps'
}
$_deployment_path = "${_catalina_base}/${_app_base}"
}
if $war_ensure =~ /^(absent|false)$/ {
file { "${_deployment_path}/${_war_name}":
ensure => absent,
force => false,
}
if $war_purge {
$war_dir_name = regsubst($_war_name, '\.war$', '')
if $war_dir_name != '' {
file { "${_deployment_path}/${war_dir_name}":
ensure => absent,
force => true,
}
}
}
} else {
if ! $war_source {
fail('$war_source must be specified if you aren\'t removing the WAR')
}
staging::file { $name:
source => $war_source,
target => "${_deployment_path}/${_war_name}",
}
}
}

View File

@@ -0,0 +1,80 @@
{
"name": "puppetlabs-tomcat",
"version": "1.7.0",
"author": "puppetlabs",
"summary": "Installs, deploys, and configures Apache Tomcat web services.",
"license": "Apache-2.0",
"source": "http://github.com/puppetlabs/puppetlabs-tomcat",
"project_page": "https://github.com/puppetlabs/puppetlabs-tomcat",
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 4.6.0 < 5.0.0"},
{"name":"puppetlabs/concat","version_requirement":">= 1.1.0 < 3.0.0"},
{"name":"puppet/staging","version_requirement":">= 0.4.1 < 3.0.0"}
],
"data_provider": null,
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"6",
"7",
"8"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"10.04",
"12.04",
"14.04",
"16.04"
]
},
{
"operatingsystem": "SLES",
"operatingsystemrelease": [
"11",
"12"
]
}
],
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 3.0.0 < 5.0.0"
}
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<service xmlns="http://www.github/cliffe/SecGen/service"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.github/cliffe/SecGen/service">
<name>Apache Tomcat Server</name>
<author>Thomas Shaw</author>
<author>Puppetlabs</author>
<module_license>Apache v2</module_license>
<description>Puppetlabs Apache Tomcat module</description>
<type>httpd</type>
<type>tomcat</type>
<platform>linux</platform>
<!--optional details-->
<reference>https://forge.puppet.com/puppetlabs/tomcat</reference>
<software_name>tomcat</software_name>
<software_license>Apache v2</software_license>
<conflict>
<type>httpd</type>
</conflict>
<requires>
<type>update</type>
</requires>
<requires>
<type>java</type>
</requires>
</service>

View File

@@ -0,0 +1,230 @@
require 'spec_helper_acceptance'
#fact based two stage confine
#confine array
confine_array = [
(fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '10.04'),
(fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') == '5'),
(fact('operatingsystem') == 'Debian' && fact('operatingsystemmajrelease') == '6'),
fact('osfamily') == 'Suse'
]
stop_test = false
stop_test = true if UNSUPPORTED_PLATFORMS.any?{ |up| fact('osfamily') == up} || confine_array.any?
describe 'Acceptance case one', :unless => stop_test do
after :all do
shell('pkill -f tomcat', :acceptable_exit_codes => [0,1])
shell('rm -rf /opt/tomcat*', :acceptable_exit_codes => [0,1])
shell('rm -rf /opt/apache-tomcat*', :acceptable_exit_codes => [0,1])
end
context 'Initial install Tomcat and verification' do
it 'Should apply the manifest without error' do
pp = <<-EOS
class{'tomcat':}
class{'java':}
class{'gcc':}
if $::operatingsystemmajrelease == '16.04' {
$java_home = "/usr/lib/jvm/java-8-openjdk-${::architecture}"
} else {
$java_home = $::osfamily ? {
'RedHat' => '/etc/alternatives/java_sdk',
'Debian' => "/usr/lib/jvm/java-7-openjdk-${::architecture}",
default => undef
}
}
tomcat::instance { 'tomcat_one':
source_url => '#{TOMCAT8_RECENT_SOURCE}',
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
}->
staging::extract { 'commons-daemon-native.tar.gz':
source => "/opt/apache-tomcat/tomcat8-jsvc/bin/commons-daemon-native.tar.gz",
target => "/opt/apache-tomcat/tomcat8-jsvc/bin",
unless => "test -d /opt/apache-tomcat/tomcat8-jsvc/bin/commons-daemon-1.0.15-native-src",
}->
exec { 'configure jsvc':
command => "JAVA_HOME=${java_home} configure --with-java=${java_home}",
creates => "/opt/apache-tomcat/tomcat8-jsvc/bin/commons-daemon-1.0.15-native-src/unix/Makefile",
cwd => "/opt/apache-tomcat/tomcat8-jsvc/bin/commons-daemon-1.0.15-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/tomcat8-jsvc/bin/commons-daemon-1.0.15-native-src/unix",
require => [ Class['gcc'], Class['java'] ],
provider => shell,
}->
exec { 'make jsvc':
command => 'make',
creates => "/opt/apache-tomcat/tomcat8-jsvc/bin/commons-daemon-1.0.15-native-src/unix/jsvc",
cwd => "/opt/apache-tomcat/tomcat8-jsvc/bin/commons-daemon-1.0.15-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/tomcat8-jsvc/bin/commons-daemon-1.0.15-native-src/unix",
provider => shell,
}->
file { 'jsvc':
ensure => link,
path => "/opt/apache-tomcat/tomcat8-jsvc/bin/jsvc",
target => "/opt/apache-tomcat/tomcat8-jsvc/bin/commons-daemon-1.0.15-native-src/unix/jsvc",
}->
tomcat::config::server { 'tomcat8-jsvc':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
port => '80',
}->
tomcat::config::server::connector { 'tomcat8-jsvc':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
port => '80',
protocol => 'HTTP/1.1',
additional_attributes => {
'redirectPort' => '443'
},
notify => Tomcat::Service['jsvc-default'],
}->
tomcat::config::server::connector { 'tomcat8-ajp':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
port => '8309',
protocol => 'AJP/1.3',
additional_attributes => {
'redirectPort' => '443'
},
connector_ensure => 'false',
}->
tomcat::war { 'war_one.war':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
war_source => '#{SAMPLE_WAR}',
}->
tomcat::setenv::entry { 'JAVA_HOME':
base_path => '/opt/apache-tomcat/tomcat8-jsvc/bin',
value => $java_home,
}->
tomcat::service { 'jsvc-default':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
java_home => $java_home,
use_jsvc => true,
}
EOS
apply_manifest(pp, :catch_failures => true, :acceptable_exit_codes => [0,2])
shell('sleep 15')
end
it 'Should be serving a page on port 80' do
shell('curl localhost:80/war_one/hello.jsp', :acceptable_exit_codes => 0) do |r|
r.stdout.should match(/Sample Application JSP Page/)
end
end
end
context 'Stop tomcat with verification!!!' do
it 'Should apply the manifest without error' do
pp = <<-EOS
class{ 'tomcat':}
tomcat::service{ 'jsvc-default':
service_ensure => stopped,
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
use_jsvc => true,
}
EOS
apply_manifest(pp, :catch_failures => true, :acceptable_exit_codes => [0,2])
shell('sleep 15')
end
it 'Should not be serving a page on port 80' do
shell('curl localhost:80/war_one/hello.jsp', :acceptable_exit_codes => 7)
end
end
context 'Start Tomcat with verification' do
it 'Should apply the manifest without error' do
pp = <<-EOS
class{ 'tomcat':}
if $::operatingsystemmajrelease == '16.04' {
$java_home = "/usr/lib/jvm/java-8-openjdk-${::architecture}"
} else {
$java_home = $::osfamily ? {
'RedHat' => '/etc/alternatives/java_sdk',
'Debian' => "/usr/lib/jvm/java-7-openjdk-${::architecture}",
default => undef
}
}
tomcat::service{ 'jsvc-default':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
service_ensure => true,
use_jsvc => true,
java_home => $java_home,
}
EOS
apply_manifest(pp, :catch_failures => true, :acceptable_exit_codes => [0,2])
shell('sleep 15')
end
it 'Should be serving a page on port 80' do
shell('curl localhost:80/war_one/hello.jsp', :acceptable_exit_codes => 0) do |r|
r.stdout.should match(/Sample Application JSP Page/)
end
end
end
context 'un-deploy the war with verification' do
it 'Should apply the manifest without error' do
pp = <<-EOS
class{ 'tomcat':}
tomcat::war { 'war_one.war':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
war_source => '#{SAMPLE_WAR}',
war_ensure => 'false',
}
EOS
apply_manifest(pp, :catch_failures => true, :acceptable_exit_codes => [0,2])
shell('sleep 15')
end
it 'Should not have deployed the war' do
shell('curl localhost:80/war_one/hello.jsp', :acceptable_exit_codes => 0) do |r|
r.stdout.should match(/The requested resource is not available./)
end
end
it 'Should still have the server running on port 80' do
shell('curl localhost:80', :acceptable_exit_codes => 0) do |r|
r.stdout.should match(/Apache Tomcat/)
end
end
end
context 'remove the connector with verification' do
it 'Should apply the manifest without error' do
pp = <<-EOS
class{ 'tomcat':}
if $::operatingsystemmajrelease == '16.04' {
$java_home = "/usr/lib/jvm/java-8-openjdk-${::architecture}"
} else {
$java_home = $::osfamily ? {
'RedHat' => '/etc/alternatives/java_sdk',
'Debian' => "/usr/lib/jvm/java-7-openjdk-${::architecture}",
default => undef
}
}
tomcat::config::server::connector { 'tomcat8-jsvc':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
port => '80',
protocol => 'HTTP/1.1',
additional_attributes => {
'redirectPort' => '443'
},
connector_ensure => 'absent',
notify => Tomcat::Service['jsvc-default']
}
tomcat::service { 'jsvc-default':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
java_home => $java_home,
use_jsvc => true,
}
EOS
apply_manifest(pp, :catch_failures => true, :acceptable_exit_codes => [0,2])
shell('sleep 15')
end
it 'Should not be able to serve pages over port 80' do
shell('curl localhost:80', :acceptable_exit_codes => 7)
end
end
end

View File

@@ -0,0 +1,236 @@
require 'spec_helper_acceptance'
#fact based two stage confine
#confine array
confine_array = [
(fact('operatingsystem') == 'Ubuntu' && fact('operatingsystemrelease') == '10.04'),
(fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') == '5'),
(fact('operatingsystem') == 'Debian' && fact('operatingsystemmajrelease') == '6'),
fact('osfamily') == 'Suse'
]
stop_test = false
stop_test = true if UNSUPPORTED_PLATFORMS.any?{ |up| fact('osfamily') == up} || confine_array.any?
describe 'Acceptance case one', docker: true, :unless => stop_test do
after :all do
shell('pkill -f tomcat', :acceptable_exit_codes => [0,1])
shell('rm -rf /opt/tomcat*', :acceptable_exit_codes => [0,1])
shell('rm -rf /opt/apache-tomcat*', :acceptable_exit_codes => [0,1])
end
context 'Initial install Tomcat and verification' do
it 'Should apply the manifest without error' do
pp = <<-EOS
class{'java':}
class{'gcc':}
if $::operatingsystemmajrelease == '16.04' {
$java_home = "/usr/lib/jvm/java-8-openjdk-${::architecture}"
} else {
$java_home = $::osfamily ? {
'RedHat' => '/etc/alternatives/java_sdk',
'Debian' => "/usr/lib/jvm/java-7-openjdk-${::architecture}",
default => undef
}
}
class jsvc {
staging::extract { 'commons-daemon-native.tar.gz':
source => "/opt/apache-tomcat/bin/commons-daemon-native.tar.gz",
target => "/opt/apache-tomcat/bin",
unless => "test -d /opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src",
}
-> exec { 'configure jsvc':
command => "JAVA_HOME=${java_home} configure --with-java=${java_home}",
creates => "/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix/Makefile",
cwd => "/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix",
require => [ Class['gcc'], Class['java'] ],
provider => shell,
}
-> exec { 'make jsvc':
command => 'make',
creates => "/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix/jsvc",
cwd => "/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix",
path => "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix",
provider => shell,
}
-> file { 'jsvc':
ensure => link,
path => "/opt/apache-tomcat/bin/jsvc",
target => "/opt/apache-tomcat/bin/commons-daemon-1.0.15-native-src/unix/jsvc",
}
}
# The default
tomcat::install { '/opt/apache-tomcat':
user => 'tomcat8',
group => 'tomcat8',
source_url => '#{TOMCAT8_RECENT_SOURCE}',
}
-> class { 'jsvc': } ->
tomcat::instance { 'tomcat_one':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
user => 'tomcat8',
group => 'tomcat8',
java_home => $java_home,
use_jsvc => true,
}
tomcat::config::server { 'tomcat8-jsvc':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
port => '80',
}
tomcat::config::server::connector { 'tomcat8-jsvc':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
port => '80',
protocol => 'HTTP/1.1',
additional_attributes => {
'redirectPort' => '443'
},
}
tomcat::config::server::connector { 'tomcat8-ajp':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
connector_ensure => absent,
port => '8309',
}
tomcat::war { 'war_one.war':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
war_source => '#{SAMPLE_WAR}',
}
tomcat::setenv::entry { 'JAVA_HOME':
user => 'tomcat8',
group => 'tomcat8',
value => $java_home,
}
EOS
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
shell('sleep 15')
end
it 'Should be serving a page on port 80' do
shell('curl localhost:80/war_one/hello.jsp', :acceptable_exit_codes => 0) do |r|
r.stdout.should match(/Sample Application JSP Page/)
end
end
end
context 'Stop tomcat with verification!!!' do
it 'Should apply the manifest without error' do
pp = <<-EOS
if $::operatingsystemmajrelease == '16.04' {
$java_home = "/usr/lib/jvm/java-8-openjdk-${::architecture}"
} else {
$java_home = $::osfamily ? {
'RedHat' => '/etc/alternatives/java_sdk',
'Debian' => "/usr/lib/jvm/java-7-openjdk-${::architecture}",
default => undef
}
}
tomcat::service { 'jsvc-default':
service_ensure => stopped,
catalina_home => '/opt/apache-tomcat',
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
use_jsvc => true,
java_home => $java_home,
user => 'tomcat8',
}
EOS
apply_manifest(pp, :catch_failures => true, :acceptable_exit_codes => [0,2])
shell('sleep 15')
end
it 'Should not be serving a page on port 80' do
shell('curl localhost:80/war_one/hello.jsp', :acceptable_exit_codes => 7)
end
end
context 'Start Tomcat with verification' do
it 'Should apply the manifest without error' do
pp = <<-EOS
if $::operatingsystemmajrelease == '16.04' {
$java_home = "/usr/lib/jvm/java-8-openjdk-${::architecture}"
} else {
$java_home = $::osfamily ? {
'RedHat' => '/etc/alternatives/java_sdk',
'Debian' => "/usr/lib/jvm/java-7-openjdk-${::architecture}",
default => undef
}
}
tomcat::service { 'jsvc-default':
service_ensure => running,
catalina_home => '/opt/apache-tomcat',
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
use_jsvc => true,
java_home => $java_home,
user => 'tomcat8',
}
EOS
apply_manifest(pp, :catch_failures => true, :acceptable_exit_codes => [0,2])
shell('sleep 15')
end
it 'Should be serving a page on port 80' do
shell('curl localhost:80/war_one/hello.jsp', :acceptable_exit_codes => 0) do |r|
r.stdout.should match(/Sample Application JSP Page/)
end
end
end
context 'un-deploy the war with verification' do
it 'Should apply the manifest without error' do
pp = <<-EOS
tomcat::war { 'war_one.war':
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
war_source => '#{SAMPLE_WAR}',
war_ensure => absent,
}
EOS
apply_manifest(pp, :catch_failures => true, :acceptable_exit_codes => [0,2])
shell('sleep 15')
end
it 'Should not have deployed the war' do
shell('curl localhost:80/war_one/hello.jsp', :acceptable_exit_codes => 0) do |r|
r.stdout.should eq("")
end
end
end
context 'remove the connector with verification' do
it 'Should apply the manifest without error' do
pp = <<-EOS
if $::operatingsystemmajrelease == '16.04' {
$java_home = "/usr/lib/jvm/java-8-openjdk-${::architecture}"
} else {
$java_home = $::osfamily ? {
'RedHat' => '/etc/alternatives/java_sdk',
'Debian' => "/usr/lib/jvm/java-7-openjdk-${::architecture}",
default => undef
}
}
tomcat::config::server::connector { 'tomcat8-jsvc':
connector_ensure => 'absent',
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
port => '80',
notify => Tomcat::Service['jsvc-default']
}
tomcat::service { 'jsvc-default':
service_ensure => running,
catalina_home => '/opt/apache-tomcat',
catalina_base => '/opt/apache-tomcat/tomcat8-jsvc',
java_home => $java_home,
use_jsvc => true,
user => 'tomcat8',
}
EOS
apply_manifest(pp, :catch_failures => true, :acceptable_exit_codes => [0,2])
shell('sleep 15')
end
it 'Should not be able to serve pages over port 80' do
shell('curl localhost:80', :acceptable_exit_codes => 7)
end
end
end

Some files were not shown because too many files have changed in this diff Show More