403Webshell
Server IP : 34.87.99.72  /  Your IP : 216.73.217.31
Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n
System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64
User : bitnami ( 1000)
PHP Version : 7.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/bitnami/nami/node_modules/provisioner/lib/recipes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/bitnami/nami/node_modules/provisioner/lib/recipes/ssh_settings.js
/// <reference path="../../typings-recipe.d.ts" />
/*
 * Configure SSH server and client
 */
"use strict";
function getSSHConfigFile(name) {
    return $file.exists(`/etc/ssh/${name}`) ? `/etc/ssh/${name}` : `/etc/${name}`;
}
recipes.register({
    id: "ssh-settings",
    on: { provisionMachine: { depends: ["system-packages"] } },
    conditions: {
        platformTags: { any: ["linux"] },
    },
    recipeHandler: input => {
        const sshdConfigFile = getSSHConfigFile("sshd_config");
        const sshConfigfile = getSSHConfigFile("ssh_config");
        const clientAliveIntervalText = "\nClientAliveInterval 180\n";
        const excludedCiphers = ["arcfour"];
        const enabledCiphers = [
            "aes128-ctr", "aes192-ctr", "aes256-ctr",
            "aes128-gcm@openssh.com", "aes256-gcm@openssh.com",
            "chacha20-poly1305@openssh.com",
        ];
        // remove existing parameters
        $file.substitute(sshdConfigFile, [
            { pattern: new RegExp("(ClientAliveInterval\\s)"), value: "#$1" },
            { pattern: new RegExp("(Ciphers\\s)"), value: "#$1" },
        ], {
            multiline: false
        });
        // add ClientAliveInterval setting
        $file.append(sshdConfigFile, clientAliveIntervalText);
        // configure UseReoaming no for all hosts
        $file.append(sshConfigfile, "\nHost *\n    UseRoaming no\n");
        // configure ciphers
        const availableCiphers = $os.runProgram("ssh", [
            "-Q", "cipher"
        ]).split(/[\s,]+/).filter(cipher => {
            return ((cipher.length > 0) && (excludedCiphers.indexOf(cipher) < 0));
        });
        // detect ciphers that are not in the allowed list
        const unknownCiphers = availableCiphers.filter(cipher => {
            return (enabledCiphers.indexOf(cipher) < 0);
        });
        if (unknownCiphers.length > 0) {
            throw new Error(`Unknown SSH cipher(s): ${unknownCiphers.join(" ")}`);
        }
        let resultCiphers = enabledCiphers.filter(cipher => {
            return (availableCiphers.indexOf(cipher) >= 0);
        });
        $file.append(sshdConfigFile, `\nCiphers ${resultCiphers.join(",")}\n`);
    }
});
recipes.register({
    id: "ssh-settings-password",
    on: { provisionMachine: { depends: ["system-packages", "ssh-settings"] } },
    conditions: {
        platformTags: { any: ["linux"] },
        cloudTags: { not: { any: ["azure"] } }
    },
    recipeHandler: input => {
        const sshdConfigFile = getSSHConfigFile("sshd_config");
        const passwordAuthenticationText = "\nPasswordAuthentication no\n";
        // remove existing parameters
        $file.substitute(sshdConfigFile, [
            { pattern: new RegExp("(^|\\vn)\\s*(PasswordAuthentication\\s[A-Za-z]+)"), value: "" },
        ], {
            multiline: true
        });
        // add ClientAliveInterval setting
        $file.append(sshdConfigFile, passwordAuthenticationText);
    }
});

Youez - 2016 - github.com/yon3zu
LinuXploit