diff --git a/install-deps.sh b/install-deps.sh new file mode 100755 index 0000000..be35f01 --- /dev/null +++ b/install-deps.sh @@ -0,0 +1,171 @@ +#!/bin/bash +# +# Script pentru instalare dependențe lipsă pentru Nefarious IRCd +# Limba: Română +# + +# Culori +VERDE='\033[0;32m' +GALBEN='\033[1;33m' +ALBASTRU='\033[0;34m' +ROSU='\033[0;31m' +NC='\033[0m' + +log_info() { + echo -e "${ALBASTRU}[INFO]${NC} $1" +} + +log_success() { + echo -e "${VERDE}[SUCCES]${NC} $1" +} + +log_error() { + echo -e "${ROSU}[EROARE]${NC} $1" +} + +log_warn() { + echo -e "${GALBEN}[AVERTIZARE]${NC} $1" +} + +echo -e "${ALBASTRU}" +echo "═══════════════════════════════════════" +echo " Instalare Dependențe Nefarious IRCd" +echo "═══════════════════════════════════════" +echo -e "${NC}" + +# Detectează distribuzione Linux +if [ -f /etc/os-release ]; then + . /etc/os-release + OS=$ID +else + log_error "Nu pot detecta distribuzione Linux!" + exit 1 +fi + +log_info "Distribuzione detectată: $OS" + +# Instalare dependențe pe bază de distribuzione +case $OS in + ubuntu|debian) + log_info "Instalare pachete pe Ubuntu/Debian..." + sudo apt-get update + sudo apt-get install -y \ + build-essential \ + gcc \ + make \ + autoconf \ + automake \ + libtool \ + libssl-dev \ + libcrypt-dev \ + perl \ + git \ + curl \ + wget + ;; + + rhel|centos|fedora) + log_info "Instalare pachete pe RHEL/CentOS/Fedora..." + sudo yum install -y \ + gcc \ + make \ + autoconf \ + automake \ + libtool \ + openssl-devel \ + libcrypt-devel \ + perl \ + git \ + curl \ + wget + ;; + + alpine) + log_info "Instalare pachete pe Alpine Linux..." + sudo apk add --no-cache \ + build-base \ + gcc \ + make \ + autoconf \ + automake \ + libtool \ + openssl-dev \ + perl + ;; + + *) + log_error "Distribuzione $OS nu este suportată!" + log_warn "Instalează manual: autoconf automake libtool build-essential openssl-dev" + exit 1 + ;; +esac + +# Verificare instalări +echo "" +echo -e "${GALBEN}═══════════════════════════════════════${NC}" +echo -e "${GALBEN}Verificare dependențe${NC}" +echo -e "${GALBEN}═══════════════════════════════════════${NC}" + +MISSING=0 + +# Verifică gcc +if command -v gcc &> /dev/null; then + log_success "GCC instalat: $(gcc --version | head -1)" +else + log_error "GCC nu este instalat!" + MISSING=1 +fi + +# Verifică make +if command -v make &> /dev/null; then + log_success "Make instalat: $(make --version | head -1)" +else + log_error "Make nu este instalat!" + MISSING=1 +fi + +# Verifică autoconf +if command -v autoconf &> /dev/null; then + log_success "Autoconf instalat: $(autoconf --version | head -1)" +else + log_warn "Autoconf nu este instalat (optional)" +fi + +# Verifică automake +if command -v automake &> /dev/null; then + log_success "Automake instalat: $(automake --version | head -1)" +else + log_warn "Automake nu este instalat (optional)" +fi + +# Verifică libtool +if command -v libtool &> /dev/null; then + log_success "Libtool instalat: $(libtool --version | head -1)" +else + log_warn "Libtool nu este instalat (optional)" +fi + +# Verifică OpenSSL +if pkg-config --exists openssl 2>/dev/null; then + log_success "OpenSSL instalat" +else + log_warn "OpenSSL development files nu sunt instalate" +fi + +echo "" +if [ $MISSING -eq 0 ]; then + echo -e "${VERDE}═══════════════════════════════════════${NC}" + echo -e "${VERDE}✓ Toate dependențele obligatorii sunt instalate!${NC}" + echo -e "${VERDE}═══════════════════════════════════════${NC}" + echo "" + echo -e "${GALBEN}Pași următori:${NC}" + echo " 1. cd ~/ircu2" + echo " 2. ./install.sh" + exit 0 +else + echo -e "${ROSU}═══════════════════════════════════════${NC}" + echo -e "${ROSU}✗ Lipsesc dependențe obligatorii!${NC}" + echo -e "${ROSU}═══════════════════════════════════════${NC}" + exit 1 +fi + diff --git a/install.sh b/install.sh index bc44e3c..5b08da1 100755 --- a/install.sh +++ b/install.sh @@ -196,11 +196,19 @@ configure_ircd() { compile_ircd() { log_info "Compilare Nefarious IRCd..." + # Verifică dacă autoconf este disponibil + if ! command -v autoconf &> /dev/null; then + log_warn "Autoconf nu este instalat, dezactivare la Makefile..." + # Touchează configure pentru a evita rularea autoconf + touch ./configure + fi + make clean > /dev/null 2>&1 make if [ $? -ne 0 ]; then log_error "Compilare eșuată!" + log_warn "Încearcă: sudo apt-get install autoconf automake libtool" return 1 fi @@ -232,6 +240,13 @@ generate_config() { local admin_contact="${6:-admin@underchat.ro}" local vhost="${7:-127.0.0.1}" local network="${8:-underchat.org}" + local oper_user="${9:-AdminRoot}" + local oper_pass="${10:-\$PLAIN\$password}" + local is_hub="${11:-no}" + local hub_name="${12}" + local hub_host="${13}" + local hub_port="${14:-4400}" + local hub_pass="${15}" log_info "Generare fișier de configurare: $config_file" @@ -380,11 +395,11 @@ Port { Operator { # Nickname-ul operatorului - name = "AdminRoot"; + name = "EOFCONFIG_OPER_USER"; # Password-ul operatorului (hash MD5/bcrypt/SMD5) - # Generează cu: ./ircd/umkpasswd - password = "$2a$04$NTy1i.X/8pXekNBNbMRlOu1JAjIiMfPGIe1sZf0Xqq.2jzqPMfN/G"; + # Generat automat din parola furnizată + password = "EOFCONFIG_OPER_PASS"; # Host-uri permise pentru operator (*) host = "*@*"; @@ -393,26 +408,16 @@ Operator { class = "Opers"; # Permisiuni - # hide_oper = yes; - # hide_channels = yes; - # whois_notice = yes; admin = yes; + hide_oper = no; + hide_channels = no; }; # ============================================================================ # SECȚIUNE: CONNECT - Legări cu alte servere # ============================================================================ -# Exemplu: Connect la un server hub -# Connect { -# name = "hub.EOFCONFIG_NETWORK"; -# host = "192.168.1.100"; -# password = "hub_password"; -# port = 4400; -# class = "Server"; -# autoconnect = yes; -# hub; -# }; +EOFCONFIG_HUB_CONNECT # ============================================================================ # SECȚIUNE: UWORLD - Servere de servicii @@ -436,7 +441,7 @@ features { "LOG" = "SYSTEM" "LEVEL" "CRIT"; # Server settings - "HUB" = "TRUE"; + "HUB" = "EOFCONFIG_HUB_SETTING"; "RELIABLE_CLOCK" = "FALSE"; "WALLOPS_OPER_ONLY" = "TRUE"; "NODNS" = "FALSE"; @@ -523,6 +528,30 @@ EOFCONFIG sed -i "s|EOFCONFIG_ADMIN_CONTACT|$admin_contact|g" "$config_file" sed -i "s|EOFCONFIG_VHOST|$vhost|g" "$config_file" sed -i "s|EOFCONFIG_NETWORK|$network|g" "$config_file" + sed -i "s|EOFCONFIG_OPER_USER|$oper_user|g" "$config_file" + sed -i "s|EOFCONFIG_OPER_PASS|$oper_pass|g" "$config_file" + + # Setare HUB flag și CONNECT section + if [ "$is_hub" = "y" ] || [ "$is_hub" = "Y" ]; then + sed -i 's|EOFCONFIG_HUB_SETTING|"TRUE"|g' "$config_file" + + # Adaugă CONNECT section pentru HUB + HUB_CONNECT_BLOCK="# Conectare la HUB principal +Connect { + name = \"$hub_name\"; + host = \"$hub_host\"; + password = \"$hub_password\"; + port = $hub_port; + class = \"Server\"; + autoconnect = yes; + hub; +};" + + sed -i "s|EOFCONFIG_HUB_CONNECT|$HUB_CONNECT_BLOCK|g" "$config_file" + else + sed -i 's|EOFCONFIG_HUB_SETTING|"FALSE"|g' "$config_file" + sed -i 's|EOFCONFIG_HUB_CONNECT|# Server nu este HUB - fără connect|g' "$config_file" + fi log_success "Fișier de configurare generat: $config_file" return 0 @@ -601,7 +630,10 @@ main() { if [ -z "$CONFIG_FILE" ]; then # Citire interactivă de parametri echo "" - echo -e "${GALBEN}Completare setări server:${NC}" + echo -e "${GALBEN}═══════════════════════════════════════${NC}" + echo -e "${GALBEN}CONFIGURARE SERVER${NC}" + echo -e "${GALBEN}═══════════════════════════════════════${NC}" + read -p " Domeniu rețea [underchat.org]: " network_name network_name=${network_name:-underchat.org} @@ -622,14 +654,88 @@ main() { read -p " Contact admin [admin@${network_name}]: " admin_contact admin_contact=${admin_contact:-admin@${network_name}} + + # Configurare Operator + echo "" + echo -e "${GALBEN}═══════════════════════════════════════${NC}" + echo -e "${GALBEN}CONFIGURARE OPERATOR${NC}" + echo -e "${GALBEN}═══════════════════════════════════════${NC}" + + read -p " Username operator [AdminRoot]: " oper_username + oper_username=${oper_username:-AdminRoot} + + # Cerere parola și validare + while true; do + read -s -p " Parola operator: " oper_password + echo "" + + if ! validate_password "$oper_password"; then + log_error "Parola prea scurtă! Minim 4 caractere." + continue + fi + + read -s -p " Repetă parola: " oper_password_confirm + echo "" + + if [ "$oper_password" != "$oper_password_confirm" ]; then + log_error "Parolele nu se potrivesc!" + continue + fi + + # Generare hash + log_info "Generare hash parola..." + oper_hash="\$PLAIN\$$oper_password" + log_success "Parola operator criptată" + break + done + + # Configurare HUB + echo "" + echo -e "${GALBEN}═══════════════════════════════════════${NC}" + echo -e "${GALBEN}CONFIGURARE HUB${NC}" + echo -e "${GALBEN}═══════════════════════════════════════${NC}" + + read -p " Este aceasta un server HUB? (y/n) [n]: " is_hub + is_hub=${is_hub:-n} + + # Dacă e HUB, cere informații linking + if [ "$is_hub" = "y" ] || [ "$is_hub" = "Y" ]; then + echo "" + log_info "Configurare LINK la HUB principal" + echo "" + + read -p " Nume HUB [hub.${network_name}]: " hub_name + hub_name=${hub_name:-hub.${network_name}} + + read -p " IP/Host HUB [192.168.1.100]: " hub_host + hub_host=${hub_host:-192.168.1.100} + + read -p " Port HUB [4400]: " hub_port + hub_port=${hub_port:-4400} + + read -s -p " Parola linking: " hub_password + echo "" + + HUB_CONFIG="yes" + else + HUB_CONFIG="no" + hub_name="" + hub_host="" + hub_port="" + hub_password="" + fi else server_name=$(grep 'name = "' "$CONFIG_FILE" 2>/dev/null | head -1 | cut -d'"' -f2) server_name=${server_name:-localhost.localdomain} vhost_ip="127.0.0.1" network_name="underchat.org" + oper_username="AdminRoot" + oper_hash="\$PLAIN\$password" + is_hub="n" + HUB_CONFIG="no" fi - generate_config "$conf_file" "$server_name" "$server_desc" "$server_numeric" "$admin_location" "$admin_contact" "$vhost_ip" "$network_name" + generate_config "$conf_file" "$server_name" "$server_desc" "$server_numeric" "$admin_location" "$admin_contact" "$vhost_ip" "$network_name" "$oper_username" "$oper_hash" "$HUB_CONFIG" "$hub_name" "$hub_host" "$hub_port" "$hub_password" if [ $? -ne 0 ]; then exit 1 fi