main
HerrHase 11 months ago
parent 886193c162
commit eb6c9cab32

@ -0,0 +1,43 @@
#!/usr/bin/node
import { program } from 'commander'
import chalk from 'chalk'
import { command, execSync, log } from './../helpers/command.js'
try {
log(chalk.green('Mariadb > start install'))
command('apt install mariadb-server')
} catch(error) {
}
/***
await command('curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup')
await command('bash mariadb_repo_setup --mariadb-server-version=10.6')
await command('apt update')
await command('apt install mariadb-server')
await command('mariadb-secure-installation')
await command('cat >> /etc/mysql/my.cnf << EOF' +
[mysqld]
bind-address = 0.0.0.0
ssl-ca=/etc/mysql/ssl/ca-cert.pem
ssl-cert=/etc/mysql/ssl/server-cert.pem
ssl-key=/etc/mysql/ssl/server-key.pem
[client]
ssl-ca=/etc/mysql/ssl/ca-cert.pem
ssl-cert=/etc/mysql/ssl/client-cert.pem
ssl-key=/etc/mysql/ssl/client-key.pem')
await command('chown -R mysql:mysql /etc/mysql/ssl')
await command('chmod 644 /etc/mysql/ssl/*cert*')
await command('chmod 644 /etc/mysql/ssl/*key*')
await command('systemctl restart mariadb')
await command('ufw allow mysql')
*/

@ -0,0 +1,32 @@
#!/usr/bin/node
import { program } from 'commander'
import chalk from 'chalk'
import { command, execSync, log } from './../helpers/command.js'
/**
* mongodb.js
*
* installing Mongodb 7.0
*
*/
// getting arguments
const destination = program.args[0]
// creating
try {
log(chalk.green('Mongodb > start install'))
command('apt-get install -y gnupg curl')
command('curl -fsSL https://pgp.mongodb.com/server-7.0.asc | gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor')
command('echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list')
command('apt-get update')
command('apt-get install -y mongodb-org mongodb-mongosh')
log(chalk.green('Mongodb > starting Service'))
command('systemctl start mongod')
command('systemctl enable mongod')
} catch(error) {
}

@ -1,6 +1,14 @@
import chalk from 'chalk'
import { command, execSync, log } from './helpers/command.js'
/**
* lets-encrypt.js
*
* installing lets encrypt and
* activate cerbot.timer for renew certifactes
*
*/
try {
log(chalk.green('Installing letsencrypt'))
command('apt-get install -y letsencrypt')

@ -1,54 +0,0 @@
import chalk from 'chalk'
const log = console.log
import { exec } from 'node:child_process'
import util from 'util'
const command = util.promisify(exec)
await command('curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup')
await command('bash mariadb_repo_setup --mariadb-server-version=10.6')
await command('apt update')
await command('apt install mariadb-server')
await command('mariadb-secure-installation')
await command('mkdir -p /etc/mysql/ssl')
const hostname = await command('hostname')
log(chalk.green('Generating CA'))
await command('openssl genrsa 4096 > /etc/mysql/ssl/ca-key.pem')
await command('openssl req -new -x509 -nodes -days 365000 -key /etc/mysql/ssl/ca-key.pem -out /etc/mysql/ssl/ca-cert.pem -subj "/CN=' + hostname + '-mysql-ca"')
log(chalk.green('Generating Server Certificate'))
await command('openssl req -newkey rsa:4096 -days 365000 -nodes -keyout /etc/mysql/ssl/server-key.pem -out /etc/mysql/ssl/server-req.pem -subj "/CN=' + hostname + '-mysql-server"')
await command('openssl rsa -in /etc/mysql/ssl/server-key.pem -out /etc/mysql/ssl/server-key.pem');
await command('openssl x509 -req -in /etc/mysql/ssl/server-req.pem -days 365000 -CA /etc/mysql/ssl/ca-cert.pem -CAkey /etc/mysql/ssl/ca-key.pem -set_serial 01 -out /etc/mysql/ssl/server-cert.pem')
log(chalk.green('Generating Client Certificate'))
await command('openssl req -newkey rsa:4096 -days 365000 -nodes -keyout /etc/mysql/ssl/client-key.pem -out /etc/mysql/ssl/client-req.pem -subj "/CN=' + hostname + '-mysql-server"')
await command('openssl rsa -in /etc/mysql/ssl/client-key.pem -out /etc/mysql/ssl/client-key.pem')
await command('openssl x509 -req -in /etc/mysql/ssl/client-req.pem -days 365000 -CA /etc/mysql/ssl/ca-cert.pem -CAkey /etc/mysql/ssl/ca-key.pem -set_serial 01 -out /etc/mysql/ssl/client-cert.pem')
await command('openssl verify -CAfile /etc/mysql/ssl/ca-cert.pem /etc/mysql/ssl/server-cert.pem /etc/mysql/ssl/client-cert.pem')
await command('cat >> /etc/mysql/my.cnf << EOF' +
[mysqld]
bind-address = 0.0.0.0
ssl-ca=/etc/mysql/ssl/ca-cert.pem
ssl-cert=/etc/mysql/ssl/server-cert.pem
ssl-key=/etc/mysql/ssl/server-key.pem
[client]
ssl-ca=/etc/mysql/ssl/ca-cert.pem
ssl-cert=/etc/mysql/ssl/client-cert.pem
ssl-key=/etc/mysql/ssl/client-key.pem')
await command('chown -R mysql:mysql /etc/mysql/ssl')
await command('chmod 644 /etc/mysql/ssl/*cert*')
await command('chmod 644 /etc/mysql/ssl/*key*')
await command('systemctl restart mariadb')
await command('ufw allow mysql')

@ -1,3 +1,9 @@
import { program } from 'commander'
import chalk from 'chalk'
import { command, execSync, log } from './helpers/command.js'
install nginx -y
exec('cp '.base_path().'/resources/nginx/snippets/*.conf /etc/nginx/snippets');

Loading…
Cancel
Save