wordpress elimu-kwanza.de #15
6 changed files with 59 additions and 7 deletions
1
bundles/wordpress/README.md
Normal file
1
bundles/wordpress/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
https://developer.wordpress.org/advanced-administration/upgrade/upgrading/
|
25
bundles/wordpress/files/check_wordpress_insecure
Normal file
25
bundles/wordpress/files/check_wordpress_insecure
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SITE=$1
|
||||||
|
VERSION=$(php -r "require('/opt/$SITE/wp-includes/version.php'); echo \$wp_version;")
|
||||||
|
STATUS=$(curl -ssL http://api.wordpress.org/core/stable-check/1.0/ | jq -r '.["'$VERSION'"]')
|
||||||
|
|
||||||
|
echo "WordPress $VERSION is '$STATUS'"
|
||||||
|
|
||||||
|
if [[ "$STATUS" == latest ]]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
elif [[ "$STATUS" == outdated ]]
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
elif [[ "$STATUS" == insecure ]]
|
||||||
|
then
|
||||||
|
if test -f /etc/nginx/sites/$SITE
|
||||||
|
then
|
||||||
|
rm /etc/nginx/sites/$SITE
|
||||||
|
systemctl restart nginx
|
||||||
|
fi
|
||||||
|
exit 2
|
||||||
|
else
|
||||||
|
exit 2
|
||||||
|
fi
|
5
bundles/wordpress/files/print-version.php
Normal file
5
bundles/wordpress/files/print-version.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once '${path}/wp-includes/version.php';
|
||||||
|
|
||||||
|
echo "$wp_version";
|
0
bundles/wordpress/files/wp-config.php
Normal file
0
bundles/wordpress/files/wp-config.php
Normal file
|
@ -1,8 +1,12 @@
|
||||||
|
files = {
|
||||||
|
'/usr/lib/nagios/plugins/check_wordpress_insecure': {
|
||||||
|
'mode': '0750',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
for site, conf in node.metadata.get('wordpress').items():
|
for site, conf in node.metadata.get('wordpress').items():
|
||||||
directories = {
|
directories[f'/opt/{site}'] = {
|
||||||
f'/opt/{site}': {
|
'owner': 'www-data',
|
||||||
'owner': 'www-data',
|
'group': 'www-data',
|
||||||
'group': 'www-data',
|
'mode': '0755',
|
||||||
'mode': '0755',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ def wordpress(metadata):
|
||||||
|
|
||||||
|
|
||||||
@metadata_reactor.provides(
|
@metadata_reactor.provides(
|
||||||
'mariadb',
|
'mariadb/databases',
|
||||||
)
|
)
|
||||||
def mariadb(metadata):
|
def mariadb(metadata):
|
||||||
return {
|
return {
|
||||||
|
@ -64,3 +64,20 @@ def zfs(metadata):
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@metadata_reactor.provides(
|
||||||
|
'monitoring/services',
|
||||||
|
)
|
||||||
|
def check_insecure(metadata):
|
||||||
|
return {
|
||||||
|
'monitoring': {
|
||||||
|
'services': {
|
||||||
|
f'wordpress {site} insecure': {
|
||||||
|
'vars.command': f'/usr/lib/nagios/plugins/check_wordpress_insecure {site}',
|
||||||
|
'check_interval': '1h',
|
||||||
|
'vars.sudo': True,
|
||||||
|
}
|
||||||
|
for site in metadata.get('wordpress')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue