diff options
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | composer.json | 23 | ||||
| -rw-r--r-- | composer.lock | 1246 | ||||
| -rw-r--r-- | files/auto-upgrades.twig | 25 | ||||
| -rw-r--r-- | files/config.php | 143 | ||||
| -rw-r--r-- | files/unattended-upgrades.twig | 121 | ||||
| -rw-r--r-- | src/UnattendedUpgrades.php | 44 | ||||
| -rw-r--r-- | test/Vagrantfile | 70 | ||||
| -rw-r--r-- | test/config.php | 15 | 
9 files changed, 1689 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2c58d7a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/vendor/ +/test/.vagrant/ diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..63e21da --- /dev/null +++ b/composer.json @@ -0,0 +1,23 @@ +{ +    "name": "dweipert/unattended-upgrades", +    "authors": [ +        { +            "name": "Daniel Weipert", +            "email": "code@drogueronin.de" +        } +    ], +    "require": { +        "php-iac/role": "^1.0" +    }, +    "require-dev": { +        "php-iac/php-iac": "^1.0" +    }, +    "autoload": { +        "psr-4": { +            "Dweipert\\DevOps\\UnattendedUpgrades\\": "src" +        } +    }, +    "scripts": { +        "test": "phpiac --config=./test/config.php" +    } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..e6c7768 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1246 @@ +{ +    "_readme": [ +        "This file locks the dependencies of your project to a known state", +        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", +        "This file is @generated automatically" +    ], +    "content-hash": "78c82f1fcd047a29cc57104556fdbe02", +    "packages": [ +        { +            "name": "php-iac/role", +            "version": "v1.0.1", +            "source": { +                "type": "git", +                "url": "https://gitlab.com/php-iac/role.git", +                "reference": "3b2ebc616568f60919bd25aa4f3d31ceca201617" +            }, +            "dist": { +                "type": "zip", +                "url": "https://gitlab.com/api/v4/projects/php-iac%2Frole/repository/archive.zip?sha=3b2ebc616568f60919bd25aa4f3d31ceca201617", +                "reference": "3b2ebc616568f60919bd25aa4f3d31ceca201617", +                "shasum": "" +            }, +            "require": { +                "php": "^8.0" +            }, +            "require-dev": { +                "php-iac/modules": "^1.0", +                "php-iac/php-iac": "^1.0" +            }, +            "type": "library", +            "autoload": { +                "psr-4": { +                    "PHPIAC\\Role\\": "src" +                } +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "AGPL-3.0-only" +            ], +            "authors": [ +                { +                    "name": "Daniel Weipert", +                    "email": "code@drogueronin.de" +                } +            ], +            "support": { +                "issues": "https://gitlab.com/api/v4/projects/25988498/issues" +            }, +            "time": "2021-04-28T14:12:03+00:00" +        } +    ], +    "packages-dev": [ +        { +            "name": "paragonie/constant_time_encoding", +            "version": "v2.4.0", +            "source": { +                "type": "git", +                "url": "https://github.com/paragonie/constant_time_encoding.git", +                "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c", +                "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c", +                "shasum": "" +            }, +            "require": { +                "php": "^7|^8" +            }, +            "require-dev": { +                "phpunit/phpunit": "^6|^7|^8|^9", +                "vimeo/psalm": "^1|^2|^3|^4" +            }, +            "type": "library", +            "autoload": { +                "psr-4": { +                    "ParagonIE\\ConstantTime\\": "src/" +                } +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "Paragon Initiative Enterprises", +                    "email": "security@paragonie.com", +                    "homepage": "https://paragonie.com", +                    "role": "Maintainer" +                }, +                { +                    "name": "Steve 'Sc00bz' Thomas", +                    "email": "steve@tobtu.com", +                    "homepage": "https://www.tobtu.com", +                    "role": "Original Developer" +                } +            ], +            "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)", +            "keywords": [ +                "base16", +                "base32", +                "base32_decode", +                "base32_encode", +                "base64", +                "base64_decode", +                "base64_encode", +                "bin2hex", +                "encoding", +                "hex", +                "hex2bin", +                "rfc4648" +            ], +            "support": { +                "email": "info@paragonie.com", +                "issues": "https://github.com/paragonie/constant_time_encoding/issues", +                "source": "https://github.com/paragonie/constant_time_encoding" +            }, +            "time": "2020-12-06T15:14:20+00:00" +        }, +        { +            "name": "paragonie/random_compat", +            "version": "v9.99.100", +            "source": { +                "type": "git", +                "url": "https://github.com/paragonie/random_compat.git", +                "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", +                "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", +                "shasum": "" +            }, +            "require": { +                "php": ">= 7" +            }, +            "require-dev": { +                "phpunit/phpunit": "4.*|5.*", +                "vimeo/psalm": "^1" +            }, +            "suggest": { +                "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." +            }, +            "type": "library", +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "Paragon Initiative Enterprises", +                    "email": "security@paragonie.com", +                    "homepage": "https://paragonie.com" +                } +            ], +            "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", +            "keywords": [ +                "csprng", +                "polyfill", +                "pseudorandom", +                "random" +            ], +            "support": { +                "email": "info@paragonie.com", +                "issues": "https://github.com/paragonie/random_compat/issues", +                "source": "https://github.com/paragonie/random_compat" +            }, +            "time": "2020-10-15T08:29:30+00:00" +        }, +        { +            "name": "php-iac/modules", +            "version": "v1.0.1", +            "source": { +                "type": "git", +                "url": "https://gitlab.com/php-iac/modules.git", +                "reference": "b5aab3b2428889a9ba27bf41af68249c0a0c7199" +            }, +            "dist": { +                "type": "zip", +                "url": "https://gitlab.com/api/v4/projects/php-iac%2Fmodules/repository/archive.zip?sha=b5aab3b2428889a9ba27bf41af68249c0a0c7199", +                "reference": "b5aab3b2428889a9ba27bf41af68249c0a0c7199", +                "shasum": "" +            }, +            "require": { +                "php": "^8.0", +                "twig/twig": "^3.0" +            }, +            "require-dev": { +                "php-iac/php-iac": "^1.0" +            }, +            "type": "library", +            "autoload": { +                "psr-4": { +                    "PHPIAC\\Modules\\": "src" +                } +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "AGPL-3.0-only" +            ], +            "authors": [ +                { +                    "name": "Daniel Weipert", +                    "email": "code@drogueronin.de" +                } +            ], +            "support": { +                "issues": "https://gitlab.com/api/v4/projects/25988482/issues" +            }, +            "time": "2021-04-28T14:11:42+00:00" +        }, +        { +            "name": "php-iac/php-iac", +            "version": "v1.0.1", +            "source": { +                "type": "git", +                "url": "https://gitlab.com/php-iac/php-iac.git", +                "reference": "9f0ccee3f967c2cd6cd5cfaea97dc35e1a7bd12a" +            }, +            "dist": { +                "type": "zip", +                "url": "https://gitlab.com/api/v4/projects/php-iac%2Fphp-iac/repository/archive.zip?sha=9f0ccee3f967c2cd6cd5cfaea97dc35e1a7bd12a", +                "reference": "9f0ccee3f967c2cd6cd5cfaea97dc35e1a7bd12a", +                "shasum": "" +            }, +            "require": { +                "php": "^8.0", +                "php-iac/modules": "^1.0", +                "php-iac/role": "^1.0", +                "phpseclib/phpseclib": "^3.0", +                "symfony/console": "^5.2" +            }, +            "bin": [ +                "bin/phpiac" +            ], +            "type": "library", +            "autoload": { +                "psr-4": { +                    "PHPIAC\\": "src" +                } +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "AGPL-3.0-only" +            ], +            "authors": [ +                { +                    "name": "Daniel Weipert", +                    "email": "code@drogueronin.de" +                } +            ], +            "support": { +                "issues": "https://gitlab.com/api/v4/projects/25973629/issues" +            }, +            "time": "2021-04-28T14:11:23+00:00" +        }, +        { +            "name": "phpseclib/phpseclib", +            "version": "3.0.8", +            "source": { +                "type": "git", +                "url": "https://github.com/phpseclib/phpseclib.git", +                "reference": "d9615a6fb970d9933866ca8b4036ec3407b020b6" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d9615a6fb970d9933866ca8b4036ec3407b020b6", +                "reference": "d9615a6fb970d9933866ca8b4036ec3407b020b6", +                "shasum": "" +            }, +            "require": { +                "paragonie/constant_time_encoding": "^1|^2", +                "paragonie/random_compat": "^1.4|^2.0|^9.99.99", +                "php": ">=5.6.1" +            }, +            "require-dev": { +                "phing/phing": "~2.7", +                "phpunit/phpunit": "^5.7|^6.0|^9.4", +                "squizlabs/php_codesniffer": "~2.0" +            }, +            "suggest": { +                "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", +                "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", +                "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", +                "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." +            }, +            "type": "library", +            "autoload": { +                "files": [ +                    "phpseclib/bootstrap.php" +                ], +                "psr-4": { +                    "phpseclib3\\": "phpseclib/" +                } +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "Jim Wigginton", +                    "email": "terrafrost@php.net", +                    "role": "Lead Developer" +                }, +                { +                    "name": "Patrick Monnerat", +                    "email": "pm@datasphere.ch", +                    "role": "Developer" +                }, +                { +                    "name": "Andreas Fischer", +                    "email": "bantu@phpbb.com", +                    "role": "Developer" +                }, +                { +                    "name": "Hans-Jürgen Petrich", +                    "email": "petrich@tronic-media.com", +                    "role": "Developer" +                }, +                { +                    "name": "Graham Campbell", +                    "email": "graham@alt-three.com", +                    "role": "Developer" +                } +            ], +            "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", +            "homepage": "http://phpseclib.sourceforge.net", +            "keywords": [ +                "BigInteger", +                "aes", +                "asn.1", +                "asn1", +                "blowfish", +                "crypto", +                "cryptography", +                "encryption", +                "rsa", +                "security", +                "sftp", +                "signature", +                "signing", +                "ssh", +                "twofish", +                "x.509", +                "x509" +            ], +            "support": { +                "issues": "https://github.com/phpseclib/phpseclib/issues", +                "source": "https://github.com/phpseclib/phpseclib/tree/3.0.8" +            }, +            "funding": [ +                { +                    "url": "https://github.com/terrafrost", +                    "type": "github" +                }, +                { +                    "url": "https://www.patreon.com/phpseclib", +                    "type": "patreon" +                }, +                { +                    "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib", +                    "type": "tidelift" +                } +            ], +            "time": "2021-04-19T03:20:48+00:00" +        }, +        { +            "name": "psr/container", +            "version": "1.1.1", +            "source": { +                "type": "git", +                "url": "https://github.com/php-fig/container.git", +                "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", +                "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", +                "shasum": "" +            }, +            "require": { +                "php": ">=7.2.0" +            }, +            "type": "library", +            "autoload": { +                "psr-4": { +                    "Psr\\Container\\": "src/" +                } +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "PHP-FIG", +                    "homepage": "https://www.php-fig.org/" +                } +            ], +            "description": "Common Container Interface (PHP FIG PSR-11)", +            "homepage": "https://github.com/php-fig/container", +            "keywords": [ +                "PSR-11", +                "container", +                "container-interface", +                "container-interop", +                "psr" +            ], +            "support": { +                "issues": "https://github.com/php-fig/container/issues", +                "source": "https://github.com/php-fig/container/tree/1.1.1" +            }, +            "time": "2021-03-05T17:36:06+00:00" +        }, +        { +            "name": "symfony/console", +            "version": "v5.2.6", +            "source": { +                "type": "git", +                "url": "https://github.com/symfony/console.git", +                "reference": "35f039df40a3b335ebf310f244cb242b3a83ac8d" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/symfony/console/zipball/35f039df40a3b335ebf310f244cb242b3a83ac8d", +                "reference": "35f039df40a3b335ebf310f244cb242b3a83ac8d", +                "shasum": "" +            }, +            "require": { +                "php": ">=7.2.5", +                "symfony/polyfill-mbstring": "~1.0", +                "symfony/polyfill-php73": "^1.8", +                "symfony/polyfill-php80": "^1.15", +                "symfony/service-contracts": "^1.1|^2", +                "symfony/string": "^5.1" +            }, +            "conflict": { +                "symfony/dependency-injection": "<4.4", +                "symfony/dotenv": "<5.1", +                "symfony/event-dispatcher": "<4.4", +                "symfony/lock": "<4.4", +                "symfony/process": "<4.4" +            }, +            "provide": { +                "psr/log-implementation": "1.0" +            }, +            "require-dev": { +                "psr/log": "~1.0", +                "symfony/config": "^4.4|^5.0", +                "symfony/dependency-injection": "^4.4|^5.0", +                "symfony/event-dispatcher": "^4.4|^5.0", +                "symfony/lock": "^4.4|^5.0", +                "symfony/process": "^4.4|^5.0", +                "symfony/var-dumper": "^4.4|^5.0" +            }, +            "suggest": { +                "psr/log": "For using the console logger", +                "symfony/event-dispatcher": "", +                "symfony/lock": "", +                "symfony/process": "" +            }, +            "type": "library", +            "autoload": { +                "psr-4": { +                    "Symfony\\Component\\Console\\": "" +                }, +                "exclude-from-classmap": [ +                    "/Tests/" +                ] +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "Fabien Potencier", +                    "email": "fabien@symfony.com" +                }, +                { +                    "name": "Symfony Community", +                    "homepage": "https://symfony.com/contributors" +                } +            ], +            "description": "Eases the creation of beautiful and testable command line interfaces", +            "homepage": "https://symfony.com", +            "keywords": [ +                "cli", +                "command line", +                "console", +                "terminal" +            ], +            "support": { +                "source": "https://github.com/symfony/console/tree/v5.2.6" +            }, +            "funding": [ +                { +                    "url": "https://symfony.com/sponsor", +                    "type": "custom" +                }, +                { +                    "url": "https://github.com/fabpot", +                    "type": "github" +                }, +                { +                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", +                    "type": "tidelift" +                } +            ], +            "time": "2021-03-28T09:42:18+00:00" +        }, +        { +            "name": "symfony/polyfill-ctype", +            "version": "v1.22.1", +            "source": { +                "type": "git", +                "url": "https://github.com/symfony/polyfill-ctype.git", +                "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", +                "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", +                "shasum": "" +            }, +            "require": { +                "php": ">=7.1" +            }, +            "suggest": { +                "ext-ctype": "For best performance" +            }, +            "type": "library", +            "extra": { +                "branch-alias": { +                    "dev-main": "1.22-dev" +                }, +                "thanks": { +                    "name": "symfony/polyfill", +                    "url": "https://github.com/symfony/polyfill" +                } +            }, +            "autoload": { +                "psr-4": { +                    "Symfony\\Polyfill\\Ctype\\": "" +                }, +                "files": [ +                    "bootstrap.php" +                ] +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "Gert de Pagter", +                    "email": "BackEndTea@gmail.com" +                }, +                { +                    "name": "Symfony Community", +                    "homepage": "https://symfony.com/contributors" +                } +            ], +            "description": "Symfony polyfill for ctype functions", +            "homepage": "https://symfony.com", +            "keywords": [ +                "compatibility", +                "ctype", +                "polyfill", +                "portable" +            ], +            "support": { +                "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" +            }, +            "funding": [ +                { +                    "url": "https://symfony.com/sponsor", +                    "type": "custom" +                }, +                { +                    "url": "https://github.com/fabpot", +                    "type": "github" +                }, +                { +                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", +                    "type": "tidelift" +                } +            ], +            "time": "2021-01-07T16:49:33+00:00" +        }, +        { +            "name": "symfony/polyfill-intl-grapheme", +            "version": "v1.22.1", +            "source": { +                "type": "git", +                "url": "https://github.com/symfony/polyfill-intl-grapheme.git", +                "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5601e09b69f26c1828b13b6bb87cb07cddba3170", +                "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170", +                "shasum": "" +            }, +            "require": { +                "php": ">=7.1" +            }, +            "suggest": { +                "ext-intl": "For best performance" +            }, +            "type": "library", +            "extra": { +                "branch-alias": { +                    "dev-main": "1.22-dev" +                }, +                "thanks": { +                    "name": "symfony/polyfill", +                    "url": "https://github.com/symfony/polyfill" +                } +            }, +            "autoload": { +                "psr-4": { +                    "Symfony\\Polyfill\\Intl\\Grapheme\\": "" +                }, +                "files": [ +                    "bootstrap.php" +                ] +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "Nicolas Grekas", +                    "email": "p@tchwork.com" +                }, +                { +                    "name": "Symfony Community", +                    "homepage": "https://symfony.com/contributors" +                } +            ], +            "description": "Symfony polyfill for intl's grapheme_* functions", +            "homepage": "https://symfony.com", +            "keywords": [ +                "compatibility", +                "grapheme", +                "intl", +                "polyfill", +                "portable", +                "shim" +            ], +            "support": { +                "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.1" +            }, +            "funding": [ +                { +                    "url": "https://symfony.com/sponsor", +                    "type": "custom" +                }, +                { +                    "url": "https://github.com/fabpot", +                    "type": "github" +                }, +                { +                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", +                    "type": "tidelift" +                } +            ], +            "time": "2021-01-22T09:19:47+00:00" +        }, +        { +            "name": "symfony/polyfill-intl-normalizer", +            "version": "v1.22.1", +            "source": { +                "type": "git", +                "url": "https://github.com/symfony/polyfill-intl-normalizer.git", +                "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/43a0283138253ed1d48d352ab6d0bdb3f809f248", +                "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248", +                "shasum": "" +            }, +            "require": { +                "php": ">=7.1" +            }, +            "suggest": { +                "ext-intl": "For best performance" +            }, +            "type": "library", +            "extra": { +                "branch-alias": { +                    "dev-main": "1.22-dev" +                }, +                "thanks": { +                    "name": "symfony/polyfill", +                    "url": "https://github.com/symfony/polyfill" +                } +            }, +            "autoload": { +                "psr-4": { +                    "Symfony\\Polyfill\\Intl\\Normalizer\\": "" +                }, +                "files": [ +                    "bootstrap.php" +                ], +                "classmap": [ +                    "Resources/stubs" +                ] +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "Nicolas Grekas", +                    "email": "p@tchwork.com" +                }, +                { +                    "name": "Symfony Community", +                    "homepage": "https://symfony.com/contributors" +                } +            ], +            "description": "Symfony polyfill for intl's Normalizer class and related functions", +            "homepage": "https://symfony.com", +            "keywords": [ +                "compatibility", +                "intl", +                "normalizer", +                "polyfill", +                "portable", +                "shim" +            ], +            "support": { +                "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.1" +            }, +            "funding": [ +                { +                    "url": "https://symfony.com/sponsor", +                    "type": "custom" +                }, +                { +                    "url": "https://github.com/fabpot", +                    "type": "github" +                }, +                { +                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", +                    "type": "tidelift" +                } +            ], +            "time": "2021-01-22T09:19:47+00:00" +        }, +        { +            "name": "symfony/polyfill-mbstring", +            "version": "v1.22.1", +            "source": { +                "type": "git", +                "url": "https://github.com/symfony/polyfill-mbstring.git", +                "reference": "5232de97ee3b75b0360528dae24e73db49566ab1" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/5232de97ee3b75b0360528dae24e73db49566ab1", +                "reference": "5232de97ee3b75b0360528dae24e73db49566ab1", +                "shasum": "" +            }, +            "require": { +                "php": ">=7.1" +            }, +            "suggest": { +                "ext-mbstring": "For best performance" +            }, +            "type": "library", +            "extra": { +                "branch-alias": { +                    "dev-main": "1.22-dev" +                }, +                "thanks": { +                    "name": "symfony/polyfill", +                    "url": "https://github.com/symfony/polyfill" +                } +            }, +            "autoload": { +                "psr-4": { +                    "Symfony\\Polyfill\\Mbstring\\": "" +                }, +                "files": [ +                    "bootstrap.php" +                ] +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "Nicolas Grekas", +                    "email": "p@tchwork.com" +                }, +                { +                    "name": "Symfony Community", +                    "homepage": "https://symfony.com/contributors" +                } +            ], +            "description": "Symfony polyfill for the Mbstring extension", +            "homepage": "https://symfony.com", +            "keywords": [ +                "compatibility", +                "mbstring", +                "polyfill", +                "portable", +                "shim" +            ], +            "support": { +                "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.1" +            }, +            "funding": [ +                { +                    "url": "https://symfony.com/sponsor", +                    "type": "custom" +                }, +                { +                    "url": "https://github.com/fabpot", +                    "type": "github" +                }, +                { +                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", +                    "type": "tidelift" +                } +            ], +            "time": "2021-01-22T09:19:47+00:00" +        }, +        { +            "name": "symfony/polyfill-php73", +            "version": "v1.22.1", +            "source": { +                "type": "git", +                "url": "https://github.com/symfony/polyfill-php73.git", +                "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", +                "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", +                "shasum": "" +            }, +            "require": { +                "php": ">=7.1" +            }, +            "type": "library", +            "extra": { +                "branch-alias": { +                    "dev-main": "1.22-dev" +                }, +                "thanks": { +                    "name": "symfony/polyfill", +                    "url": "https://github.com/symfony/polyfill" +                } +            }, +            "autoload": { +                "psr-4": { +                    "Symfony\\Polyfill\\Php73\\": "" +                }, +                "files": [ +                    "bootstrap.php" +                ], +                "classmap": [ +                    "Resources/stubs" +                ] +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "Nicolas Grekas", +                    "email": "p@tchwork.com" +                }, +                { +                    "name": "Symfony Community", +                    "homepage": "https://symfony.com/contributors" +                } +            ], +            "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", +            "homepage": "https://symfony.com", +            "keywords": [ +                "compatibility", +                "polyfill", +                "portable", +                "shim" +            ], +            "support": { +                "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.1" +            }, +            "funding": [ +                { +                    "url": "https://symfony.com/sponsor", +                    "type": "custom" +                }, +                { +                    "url": "https://github.com/fabpot", +                    "type": "github" +                }, +                { +                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", +                    "type": "tidelift" +                } +            ], +            "time": "2021-01-07T16:49:33+00:00" +        }, +        { +            "name": "symfony/polyfill-php80", +            "version": "v1.22.1", +            "source": { +                "type": "git", +                "url": "https://github.com/symfony/polyfill-php80.git", +                "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", +                "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", +                "shasum": "" +            }, +            "require": { +                "php": ">=7.1" +            }, +            "type": "library", +            "extra": { +                "branch-alias": { +                    "dev-main": "1.22-dev" +                }, +                "thanks": { +                    "name": "symfony/polyfill", +                    "url": "https://github.com/symfony/polyfill" +                } +            }, +            "autoload": { +                "psr-4": { +                    "Symfony\\Polyfill\\Php80\\": "" +                }, +                "files": [ +                    "bootstrap.php" +                ], +                "classmap": [ +                    "Resources/stubs" +                ] +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "Ion Bazan", +                    "email": "ion.bazan@gmail.com" +                }, +                { +                    "name": "Nicolas Grekas", +                    "email": "p@tchwork.com" +                }, +                { +                    "name": "Symfony Community", +                    "homepage": "https://symfony.com/contributors" +                } +            ], +            "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", +            "homepage": "https://symfony.com", +            "keywords": [ +                "compatibility", +                "polyfill", +                "portable", +                "shim" +            ], +            "support": { +                "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.1" +            }, +            "funding": [ +                { +                    "url": "https://symfony.com/sponsor", +                    "type": "custom" +                }, +                { +                    "url": "https://github.com/fabpot", +                    "type": "github" +                }, +                { +                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", +                    "type": "tidelift" +                } +            ], +            "time": "2021-01-07T16:49:33+00:00" +        }, +        { +            "name": "symfony/service-contracts", +            "version": "v2.4.0", +            "source": { +                "type": "git", +                "url": "https://github.com/symfony/service-contracts.git", +                "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", +                "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", +                "shasum": "" +            }, +            "require": { +                "php": ">=7.2.5", +                "psr/container": "^1.1" +            }, +            "suggest": { +                "symfony/service-implementation": "" +            }, +            "type": "library", +            "extra": { +                "branch-alias": { +                    "dev-main": "2.4-dev" +                }, +                "thanks": { +                    "name": "symfony/contracts", +                    "url": "https://github.com/symfony/contracts" +                } +            }, +            "autoload": { +                "psr-4": { +                    "Symfony\\Contracts\\Service\\": "" +                } +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "Nicolas Grekas", +                    "email": "p@tchwork.com" +                }, +                { +                    "name": "Symfony Community", +                    "homepage": "https://symfony.com/contributors" +                } +            ], +            "description": "Generic abstractions related to writing services", +            "homepage": "https://symfony.com", +            "keywords": [ +                "abstractions", +                "contracts", +                "decoupling", +                "interfaces", +                "interoperability", +                "standards" +            ], +            "support": { +                "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" +            }, +            "funding": [ +                { +                    "url": "https://symfony.com/sponsor", +                    "type": "custom" +                }, +                { +                    "url": "https://github.com/fabpot", +                    "type": "github" +                }, +                { +                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", +                    "type": "tidelift" +                } +            ], +            "time": "2021-04-01T10:43:52+00:00" +        }, +        { +            "name": "symfony/string", +            "version": "v5.2.6", +            "source": { +                "type": "git", +                "url": "https://github.com/symfony/string.git", +                "reference": "ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/symfony/string/zipball/ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572", +                "reference": "ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572", +                "shasum": "" +            }, +            "require": { +                "php": ">=7.2.5", +                "symfony/polyfill-ctype": "~1.8", +                "symfony/polyfill-intl-grapheme": "~1.0", +                "symfony/polyfill-intl-normalizer": "~1.0", +                "symfony/polyfill-mbstring": "~1.0", +                "symfony/polyfill-php80": "~1.15" +            }, +            "require-dev": { +                "symfony/error-handler": "^4.4|^5.0", +                "symfony/http-client": "^4.4|^5.0", +                "symfony/translation-contracts": "^1.1|^2", +                "symfony/var-exporter": "^4.4|^5.0" +            }, +            "type": "library", +            "autoload": { +                "psr-4": { +                    "Symfony\\Component\\String\\": "" +                }, +                "files": [ +                    "Resources/functions.php" +                ], +                "exclude-from-classmap": [ +                    "/Tests/" +                ] +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "MIT" +            ], +            "authors": [ +                { +                    "name": "Nicolas Grekas", +                    "email": "p@tchwork.com" +                }, +                { +                    "name": "Symfony Community", +                    "homepage": "https://symfony.com/contributors" +                } +            ], +            "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", +            "homepage": "https://symfony.com", +            "keywords": [ +                "grapheme", +                "i18n", +                "string", +                "unicode", +                "utf-8", +                "utf8" +            ], +            "support": { +                "source": "https://github.com/symfony/string/tree/v5.2.6" +            }, +            "funding": [ +                { +                    "url": "https://symfony.com/sponsor", +                    "type": "custom" +                }, +                { +                    "url": "https://github.com/fabpot", +                    "type": "github" +                }, +                { +                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", +                    "type": "tidelift" +                } +            ], +            "time": "2021-03-17T17:12:15+00:00" +        }, +        { +            "name": "twig/twig", +            "version": "v3.3.0", +            "source": { +                "type": "git", +                "url": "https://github.com/twigphp/Twig.git", +                "reference": "1f3b7e2c06cc05d42936a8ad508ff1db7975cdc5" +            }, +            "dist": { +                "type": "zip", +                "url": "https://api.github.com/repos/twigphp/Twig/zipball/1f3b7e2c06cc05d42936a8ad508ff1db7975cdc5", +                "reference": "1f3b7e2c06cc05d42936a8ad508ff1db7975cdc5", +                "shasum": "" +            }, +            "require": { +                "php": ">=7.2.5", +                "symfony/polyfill-ctype": "^1.8", +                "symfony/polyfill-mbstring": "^1.3" +            }, +            "require-dev": { +                "psr/container": "^1.0", +                "symfony/phpunit-bridge": "^4.4.9|^5.0.9" +            }, +            "type": "library", +            "extra": { +                "branch-alias": { +                    "dev-master": "3.3-dev" +                } +            }, +            "autoload": { +                "psr-4": { +                    "Twig\\": "src/" +                } +            }, +            "notification-url": "https://packagist.org/downloads/", +            "license": [ +                "BSD-3-Clause" +            ], +            "authors": [ +                { +                    "name": "Fabien Potencier", +                    "email": "fabien@symfony.com", +                    "homepage": "http://fabien.potencier.org", +                    "role": "Lead Developer" +                }, +                { +                    "name": "Twig Team", +                    "role": "Contributors" +                }, +                { +                    "name": "Armin Ronacher", +                    "email": "armin.ronacher@active-4.com", +                    "role": "Project Founder" +                } +            ], +            "description": "Twig, the flexible, fast, and secure template language for PHP", +            "homepage": "https://twig.symfony.com", +            "keywords": [ +                "templating" +            ], +            "support": { +                "issues": "https://github.com/twigphp/Twig/issues", +                "source": "https://github.com/twigphp/Twig/tree/v3.3.0" +            }, +            "funding": [ +                { +                    "url": "https://github.com/fabpot", +                    "type": "github" +                }, +                { +                    "url": "https://tidelift.com/funding/github/packagist/twig/twig", +                    "type": "tidelift" +                } +            ], +            "time": "2021-02-08T09:54:36+00:00" +        } +    ], +    "aliases": [], +    "minimum-stability": "stable", +    "stability-flags": [], +    "prefer-stable": false, +    "prefer-lowest": false, +    "platform": [], +    "platform-dev": [], +    "plugin-api-version": "2.0.0" +} diff --git a/files/auto-upgrades.twig b/files/auto-upgrades.twig new file mode 100644 index 0000000..dbbf1a2 --- /dev/null +++ b/files/auto-upgrades.twig @@ -0,0 +1,25 @@ +APT::Periodic::Unattended-Upgrade "1"; + +{% if unattended_update_package_list is defined %} +    APT::Periodic::Update-Package-Lists "{{unattended_update_package_list}}"; +{% endif %} + +{% if unattended_download_upgradeable is defined %} +    APT::Periodic::Download-Upgradeable-Packages "{{unattended_download_upgradeable}}"; +{% endif %} + +{% if unattended_autoclean_interval is defined %} +    APT::Periodic::AutocleanInterval "{{unattended_autoclean_interval}}"; +{% endif %} + +{% if unattended_clean_interval is defined %} +    APT::Periodic::CleanInterval "{{unattended_clean_interval}}"; +{% endif %} + +{% if unattended_verbose is defined %} +    APT::Periodic::Verbose "{{unattended_verbose}}"; +{% endif %} + +{% if unattended_random_sleep is defined %} +    APT::Periodic::RandomSleep "{{unattended_random_sleep}}"; +{% endif %} diff --git a/files/config.php b/files/config.php new file mode 100644 index 0000000..03d0593 --- /dev/null +++ b/files/config.php @@ -0,0 +1,143 @@ +<?php + +return [ +    # Cache update time for apt module +    'unattended_cache_valid_time' => 3600, + +    #Unattended-Upgrade::Origins-Pattern +    # Automatically upgrade packages from these origin patterns +    # e.g.: 'o=Debian,a=stable', 'o=Debian,a=stable-updates' +    # +    # Left unset, distribution-specific defaults will be used through +    # __unattended_origins_patterns variable only if this variable +    #   is not provided externally +    # REFS https://github.com/ansible/ansible/issues/8121 +    #'unattended_origins_patterns' => [], +    '__unattended_origins_patterns' => [ +        'o=${distro_id},a=${distro_codename}-security', +    ], + +    #Unattended-Upgrade::Package-Blacklist +    # List of packages to not update +    'unattended_package_blacklist' => [], + +    #Unattended-Upgrade::AutoFixInterruptedDpkg +    # On a unclean dpkg exit unattended-upgrades will run +    #   dpkg --force-confold --configure -a +    # The default is true, to ensure updates keep getting installed +    'unattended_autofix_interrupted_dpkg' => true, + +    #Unattended-Upgrade::MinimalSteps +    # Split the upgrade into the smallest possible chunks so that +    # they can be interrupted with SIGUSR1. This makes the upgrade +    # a bit slower but it has the benefit that shutdown while a upgrade +    # is running is possible (with a small delay) +    'unattended_minimal_steps' => true, + +    #Unattended-Upgrade::InstallOnShutdown +    # Install all unattended-upgrades when the machine is shuting down +    # instead of doing it in the background while the machine is running +    # This will (obviously) make shutdown slower +    'unattended_install_on_shutdown' => false, + +    #Unattended-Upgrade::Mail +    # Send email to this address for problems or packages upgrades +    # If empty or unset then no email is sent, make sure that you +    # have a working mail setup on your system. A package that provides +    # 'mailx' must be installed. +    'unattended_mail' => false, + +    #Unattended-Upgrade::MailOnlyOnError +    # Set this value to "true" to get emails only on errors. Default +    # is to always send a mail if Unattended-Upgrade::Mail is set +    'unattended_mail_only_on_error' => false, + +    #Unattended-Upgrade::Remove-Unused-Dependencies +    # Do automatic removal of all unused dependencies after the upgrade +    # (equivalent to apt-get autoremove) +    'unattended_remove_unused_dependencies' => false, + +    #Unattended-Upgrade::Remove-New-Unused-Dependencies +    # Remove any new unused dependencies after the upgrade +    'unattended_remove_new_unused_dependencies' => true, + +    #Unattended-Upgrade::Automatic-Reboot +    # Automatically reboot *WITHOUT CONFIRMATION* if a +    # the file /var/run/reboot-required is found after the upgrade +    'unattended_automatic_reboot' => false, + +    #Unattended-Upgrade::Automatic-Reboot-Time +    # If automatic reboot is enabled and needed, reboot at the specific +    # time instead of immediately +    'unattended_automatic_reboot_time' => false, + +    #Unattended-Upgrade::IgnoreAppsRequireRestart +    # Do upgrade application even if it requires restart after upgrade +    # I.e. "XB-Upgrade-Requires: app-restart" is set in the debian/control file +    'unattended_ignore_apps_require_restart' => false, + +    #Unattended-Upgrade::SyslogEnable +    # Write events to syslog, which is useful in environments where syslog +    # messages are sent to a central store. +    'unattended_syslog_enable' => false, + +    #Unattended-Upgrade::SyslogFacility +    # Write events to the specified syslog facility, or the daemon facility if +    # not specified. Requires the Unattended-Upgrade::SyslogEnable option to be +    # set to true. +    #'unattended_syslog_facility' => 'daemon', + +    ### APT::Periodic configuration +    # Snatched from /usr/lib/apt/apt.systemd.daily + +    #APT::Periodic::Update-Package-Lists "0"; +    # - Do "apt-get update" automatically every n-days (0=disable) +    'unattended_update_package_list' => 1, + +    #APT::Periodic::Download-Upgradeable-Packages "0"; +    # - Do "apt-get upgrade --download-only" every n-days (0=disable) +    #'unattended_download_upgradeable' => 0, + +    #APT::Periodic::AutocleanInterval "0"; +    # - Do "apt-get autoclean" every n-days (0=disable) +    'unattended_autoclean_interval' => 7, + +    #APT::Periodic::CleanInterval "0"; +    # - Do "apt-get clean" every n-days (0=disable) +    #'unattended_clean_interval' => 0, + +    #APT::Periodic::Verbose "0"; +    # - Send report mail to root +    #     0:  no report             (or null string) +    #     1:  progress report       (actually any string) +    #     2:  + command outputs     (remove -qq, remove 2>/dev/null, add -d) +    #     3:  + trace on +    #'unattended_verbose' => 0, + +    ## Cron systems only + +    #APT::Periodic::RandomSleep +    # When the apt job starts, it will sleep for a random period between 0 +    # and APT::Periodic::RandomSleep seconds +    # The default value is "1800" so that the script will stall for up to 30 +    # minutes (1800 seconds) so that the mirror servers are not crushed by +    # everyone running their updates all at the same time +    # Kept undefined to allow default (1800) +    #'unattended_random_sleep' => 0, + +    #Dpkg::Options +    # Provide dpkg options that take effect during unattended upgrades. +    # By default no flags are appended. Configuration file changes can +    # block installation of certain packages. Passing the flags +    # "--force-confdef" and "--force-confold" will ensure updates are applied +    # and old configuration files are preserved. +    'unattended_dpkg_options' => [], + +    # 'unattended_dpkg_options' => [ +    #   '--force-confdef', +    #   '--force-confold', +    # ], + +    # Use apt bandwidth limit feature, this example limits the download speed to 70kb/sec +    #'unattended_dl_limit' => 70, +]; diff --git a/files/unattended-upgrades.twig b/files/unattended-upgrades.twig new file mode 100644 index 0000000..9532094 --- /dev/null +++ b/files/unattended-upgrades.twig @@ -0,0 +1,121 @@ +// Unattended-Upgrade::Origins-Pattern controls which packages are +// upgraded. +Unattended-Upgrade::Origins-Pattern { +{% if unattended_origins_patterns is defined %} +    {% for origin in unattended_origins_patterns %} +        "{{ origin }}"; +    {% endfor %} +{% else %} +    {% for origin in __unattended_origins_patterns %} +        "{{ origin }}"; +    {% endfor %} +{% endif %} +}; + +// List of packages to not update (regexp are supported) +Unattended-Upgrade::Package-Blacklist { +{% for package in unattended_package_blacklist %} +    "{{ package }}"; +{% endfor %} +}; + +{% if not unattended_autofix_interrupted_dpkg %} +    // This option allows you to control if on a unclean dpkg exit +    // unattended-upgrades will automatically run +    //   dpkg --force-confold --configure -a +    // The default is true, to ensure updates keep getting installed +    Unattended-Upgrade::AutoFixInterruptedDpkg "false"; +{% endif %} + +// Split the upgrade into the smallest possible chunks so that +// they can be interrupted with SIGUSR1. This makes the upgrade +// a bit slower but it has the benefit that shutdown while a upgrade +// is running is possible (with a small delay) +Unattended-Upgrade::MinimalSteps "{{ unattended_minimal_steps | lower }}"; + +{% if unattended_install_on_shutdown %} +    // Install all unattended-upgrades when the machine is shuting down +    // instead of doing it in the background while the machine is running +    // This will (obviously) make shutdown slower +    Unattended-Upgrade::InstallOnShutdown "true"; +{% endif %} + +{% if unattended_mail %} +    // Send email to this address for problems or packages upgrades +    // If empty or unset then no email is sent, make sure that you +    // have a working mail setup on your system. A package that provides +    // 'mailx' must be installed. +    Unattended-Upgrade::Mail "{{ unattended_mail }}"; +{% endif %} + +{% if unattended_mail_only_on_error %} +    // Set this value to "true" to get emails only on errors. Default +    // is to always send a mail if Unattended-Upgrade::Mail is set +    Unattended-Upgrade::MailOnlyOnError "true"; +{% endif %} + +{% if unattended_remove_unused_dependencies %} +    // Do automatic removal of all unused dependencies after the upgrade +    // (equivalent to apt-get autoremove) +    Unattended-Upgrade::Remove-Unused-Dependencies "true"; +{% endif %} + +{% if not unattended_remove_new_unused_dependencies %} +    // Do automatic removal of new unused dependencies after the upgrade +    Unattended-Upgrade::Remove-New-Unused-Dependencies "false"; +{% endif %} + +{% if unattended_automatic_reboot %} +    // Automatically reboot *WITHOUT CONFIRMATION* if a +    // the file /var/run/reboot-required is found after the upgrade +    Unattended-Upgrade::Automatic-Reboot "true"; +{% endif %} + +{% if unattended_automatic_reboot_time %} +    // If automatic reboot is enabled and needed, reboot at the specific +    // time instead of immediately +    // Default: "now" +    Unattended-Upgrade::Automatic-Reboot-Time "{{ unattended_automatic_reboot_time }}"; +{% endif %} + +{% if unattended_update_days is defined %} +    // Set the days of the week that updates should be applied. The days can be specified +    // as localized abbreviated or full names. Or as integers where "0" is Sunday, "1" is +    // Monday etc. +    // Example - apply updates only on Monday and Friday: +    // {"Mon";"Fri"}; +    Unattended-Upgrade::Update-Days {{ unattended_update_days }}; +{% endif %} + +{% if unattended_ignore_apps_require_restart %} +    // Do upgrade application even if it requires restart after upgrade +    // I.e. "XB-Upgrade-Requires: app-restart" is set in the debian/control file +    Unattended-Upgrade::IgnoreAppsRequireRestart "true"; +{% endif %} + +{% if unattended_syslog_enable %} +    // Write events to syslog, which is useful in environments where syslog +    // messages are sent to a central store. +    Unattended-Upgrade::SyslogEnable "{{ unattended_syslog_enable }}"; +    {% if unattended_syslog_facility is defined %} +        // Write events to the specified syslog facility, or the daemon facility +        // if not specified. Requires the Unattended-Upgrade::SyslogEnable option +        // to be set to true. +        Unattended-Upgrade::SyslogFacility "{{ unattended_syslog_facility }}"; +    {% endif %} +{% endif %} + +{% if unattended_dpkg_options %} +    // Append options for governing dpkg behavior, e.g. --force-confdef. +    Dpkg::Options { +    {% for dpkg_option in unattended_dpkg_options %} +        "{{ dpkg_option }}"; +    {% endfor %} +    }; +{% endif %} + +{% if unattended_dl_limit is defined %} +    // Use apt bandwidth limit feature, this example limits the download +    // speed to 70kb/sec +    Acquire::http::Dl-Limit "{{ unattended_dl_limit }}"; +{% endif %} diff --git a/src/UnattendedUpgrades.php b/src/UnattendedUpgrades.php new file mode 100644 index 0000000..2322cef --- /dev/null +++ b/src/UnattendedUpgrades.php @@ -0,0 +1,44 @@ +<?php + +namespace Dweipert\DevOps\UnattendedUpgrades; + +use PHPIAC\Modules\AptModule; +use PHPIAC\Modules\TemplateModule; +use PHPIAC\Role\RoleInterface; +use PHPIAC\Task; + +class UnattendedUpgrades implements RoleInterface +{ +    public function __invoke(array $config = []): array +    { +        $config = array_replace_recursive( +            include dirname(__DIR__) . '/files/config.php', +            $config +        ); + +        return [ +            (new Task())->setModule(new AptModule([ +                'package' => 'unattended-upgrades', +                'updateCache' => true, +            ])), +            (new Task())->setModule(new TemplateModule([ +                'src' => dirname(__DIR__) . '/files/auto-upgrades.twig', +                'dest' => '/etc/apt/apt.conf.d/20auto-upgrades', +                'vars' => $config, +                'owner' => 'root', +                'group' => 'root', +                'mode' => 0644, +                'force' => true, +            ])), +            (new Task())->setModule(new TemplateModule([ +                'src' => dirname(__DIR__) . '/files/unattended-upgrades.twig', +                'dest' => '/etc/apt/apt.conf.d/50unattended-upgrades', +                'vars' => $config, +                'owner' => 'root', +                'group' => 'root', +                'mode' => 0644, +                'force' => true, +            ])), +        ]; +    } +} diff --git a/test/Vagrantfile b/test/Vagrantfile new file mode 100644 index 0000000..a69333e --- /dev/null +++ b/test/Vagrantfile @@ -0,0 +1,70 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| +  # The most common configuration options are documented and commented below. +  # For a complete reference, please see the online documentation at +  # https://docs.vagrantup.com. + +  # Every Vagrant development environment requires a box. You can search for +  # boxes at https://vagrantcloud.com/search. +  config.vm.box = "bento/ubuntu-20.04" + +  # Disable automatic box update checking. If you disable this, then +  # boxes will only be checked for updates when the user runs +  # `vagrant box outdated`. This is not recommended. +  # config.vm.box_check_update = false + +  # Create a forwarded port mapping which allows access to a specific port +  # within the machine from a port on the host machine. In the example below, +  # accessing "localhost:8080" will access port 80 on the guest machine. +  # NOTE: This will enable public access to the opened port +  # config.vm.network "forwarded_port", guest: 80, host: 8080 + +  # Create a forwarded port mapping which allows access to a specific port +  # within the machine from a port on the host machine and only allow access +  # via 127.0.0.1 to disable public access +  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" + +  # Create a private network, which allows host-only access to the machine +  # using a specific IP. +  config.vm.network "private_network", ip: "192.168.33.10" + +  # Create a public network, which generally matched to bridged network. +  # Bridged networks make the machine appear as another physical device on +  # your network. +  # config.vm.network "public_network" + +  # Share an additional folder to the guest VM. The first argument is +  # the path on the host to the actual folder. The second argument is +  # the path on the guest to mount the folder. And the optional third +  # argument is a set of non-required options. +  # config.vm.synced_folder "../data", "/vagrant_data" + +  # Provider-specific configuration so you can fine-tune various +  # backing providers for Vagrant. These expose provider-specific options. +  # Example for VirtualBox: +  # +  # config.vm.provider "virtualbox" do |vb| +  #   # Display the VirtualBox GUI when booting the machine +  #   vb.gui = true +  # +  #   # Customize the amount of memory on the VM: +  #   vb.memory = "1024" +  # end +  # +  # View the documentation for the provider you are using for more +  # information on available options. + +  # Enable provisioning with a shell script. Additional provisioners such as +  # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the +  # documentation for more information about their specific syntax and use. +  # config.vm.provision "shell", inline: <<-SHELL +  #   apt-get update +  #   apt-get install -y apache2 +  # SHELL +end diff --git a/test/config.php b/test/config.php new file mode 100644 index 0000000..cf97afd --- /dev/null +++ b/test/config.php @@ -0,0 +1,15 @@ +<?php + +require dirname(__DIR__) . '/vendor/autoload.php'; + +return [ +  'host' => 'vagrant', +  'user' => 'vagrant', +  'private_key_file' => __DIR__ . '/.vagrant/machines/default/virtualbox/private_key', + +  'tasks' => [ +    ...(new \Dweipert\DevOps\UnattendedUpgrades\UnattendedUpgrades())([ +        'unattended_mail' => 'test@example.org', +    ]), +  ], +];  | 
