Jaap Marcus 2 年 前
コミット
b1241e8172

+ 19 - 4
bin/v-import-cpanel

@@ -4,14 +4,19 @@
 #
 # example: v-import-cpanel /backup/backup.tar.gz yes
 #
+# Import Cpanel backups into the user
+
+#----------------------------------------------------------#
+#                Variables & Functions                     #
+#----------------------------------------------------------#
+
+# Argument definition
+backup=$1
+
 # Based on sk-import-cpanel-backup-to-vestacp
 # Credits: Maks Usmanov (skamasle) and contributors:
 # Thanks to <https://github.com/Skamasle/sk-import-cpanel-backup-to-vestacp/graphs/contributors>
 
-# Known issue
-# - Importing certificates fails at the moment. Due to format changes of CPanel side
-# - It doesn't update DKIM
-
 # shellcheck source=/usr/local/hestia/func/main.sh
 source $HESTIA/func/main.sh
 # shellcheck source=/etc/hestiacp/hestia.conf
@@ -19,6 +24,16 @@ source /etc/hestiacp/hestia.conf
 # load config file
 source_conf "$HESTIA/conf/hestia.conf"
 
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+check_args '1' "$#" 'BACKUP'
+
+# Known issue
+# - Importing certificates fails at the moment. Due to format changes of CPanel side
+# - It doesn't update DKIM
+
 if [ $# -lt 1 ]; then
 	echo "usage: bash $0 cpanel-backup.tar.gz"
 	echo "or"

+ 1 - 1
bin/v-import-database

@@ -31,7 +31,7 @@ source_conf "$HESTIA/conf/hestia.conf"
 #                    Verifications                         #
 #----------------------------------------------------------#
 
-check_args '3' "$#" 'DATABASE USER'
+check_args '3' "$#" 'DATABASE USER PATH'
 is_format_valid 'database' 'user'
 is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
 is_object_valid 'user' 'USER' "$user"

+ 24 - 3
bin/v-import-directadmin

@@ -1,24 +1,45 @@
 #!/bin/bash
 # info: Import DirectAdmin backup to a new user
-#
+# options: BACKUP FILE
 # example: v-import-directadmin /backup/backup.tar.gz
 #
 # Based on sk-da-importer
 # Credits: Maks Usmanov (skamasle), Jaap Marcus (jaapmarcus) and contributors:
 # Thanks to <https://github.com/Skamasle/sk_da_importer/graphs/contributors>
 
+
+#----------------------------------------------------------#
+#                Variables & Functions                     #
+#----------------------------------------------------------#
+
+# Argument definition
+backup=$1
+
 # This script is provided whitout any warranty
 # Run at your own risk
 # Version 0.1
 # This script restore backups from DA to Hestiacp
 
-# shellcheck source=/usr/local/hestia/func/main.sh
-source $HESTIA/func/main.sh
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+check_args '1' "$#" 'BACKUP'
+
+# Includes
 # shellcheck source=/etc/hestiacp/hestia.conf
 source /etc/hestiacp/hestia.conf
+# shellcheck source=/usr/local/hestia/func/main.sh
+source $HESTIA/func/main.sh
+# shellcheck source=/usr/local/hestia/func/db.sh
+source $HESTIA/func/db.sh
+# shellcheck source=/usr/local/hestia/func/rebuild.sh
+source $HESTIA/func/rebuild.sh
 # load config file
 source_conf "$HESTIA/conf/hestia.conf"
 
+
+
 if [ ! -e /usr/bin/rsync ] || [ ! -e /usr/bin/file ]; then
 	echo "#######################################"
 	echo "rsync not installed, try install it"

+ 4 - 1
bin/v-insert-dns-domain

@@ -1,6 +1,9 @@
 #!/bin/bash
 # info: insert dns domain
-# options: USER DATA [SRC] [FLUSH] #
+# options: USER DATA [SRC] [FLUSH]
+#
+# example: v-insert-dns-domain user '/path/to/data' 'source' 'yes'
+#
 # This function inserts raw record to the dns.conf
 
 #----------------------------------------------------------#

+ 2 - 0
bin/v-insert-dns-record

@@ -2,6 +2,8 @@
 # info: insert dns record
 # options: USER DOMAIN DATA
 #
+# example: v-insert-dns-record user 'domain' 'DNS CONF DATA'
+#
 # This function inserts raw dns record to the domain conf
 
 #----------------------------------------------------------#

+ 3 - 0
bin/v-insert-dns-records

@@ -2,6 +2,9 @@
 # info: inserts dns records
 # options: USER DOMAIN DATA_FILE
 #
+# example: v-insert-dns-records user 'domain' '/path/to/data'
+#
+#
 # This function copy dns record to the domain conf
 
 #----------------------------------------------------------#

+ 2 - 2
bin/v-list-dnssec-public-key

@@ -1,8 +1,8 @@
 #!/bin/bash
 # info: list public dnssec key
-# options: USER DOMAIN [FROMAT]
+# options: USER DOMAIN [FROMAT] [DNS-TYPE]
 #
-# example: v-list-dns-public-key admin acme.com
+# example: v-list-dnssec-public-key admin acme.com
 #
 # This function list the public key to be used with DNSSEC and needs to be added to the domain register.
 

+ 1 - 1
bin/v-list-sys-cpu-status

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: list system cpu info
-# options:
+# options: none
 #
 # example: v-list-sys-cpu-status
 #

+ 1 - 1
bin/v-list-sys-db-status

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: list db status
-# options:
+# options: none
 #
 # v-list-sys-db-status
 #

+ 1 - 1
bin/v-list-sys-disk-status

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: list disk information
-# options:
+# options: none
 #
 # example: v-list-sys-disk-status
 #

+ 1 - 1
bin/v-list-sys-dns-status

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: list dns status
-# options:
+# options: none
 #
 # example: v-list-sys-dns-status
 #

+ 1 - 1
bin/v-list-sys-mail-status

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: list mail status
-# options:
+# options: none
 #
 # example: v-list-sys-mail-status
 #

+ 1 - 1
bin/v-list-sys-memory-status

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: list virtual memory info
-# options:
+# options: none
 #
 # example: v-list-sys-memory-status
 #

+ 1 - 1
bin/v-list-sys-network-status

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: list system network status
-# options:
+# options: none
 #
 # example: v-list-sys-network-status
 #

+ 1 - 1
bin/v-list-sys-web-status

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: list web status
-# options:
+# options: none
 #
 # example: v-list-sys-web-status
 #

+ 4 - 1
bin/v-log-action

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: adds action event to user or system log
-# options: LOG_TYPE USER
+# options: USER EVENT_LEVEL EVENT_CATEGORY EVENT_DETAILS
 
 # Event Levels:
 # info, warning, error
@@ -32,6 +32,9 @@ export event_category=$3
 event_details=$4
 
 is_common_format_valid "$event_level" "event level"
+is_common_format_valid "$event_category" "event category"
+is_common_format_valid "$event_details" "event details"
+
 
 # Validate event type input
 if [ "$event_level" != "Info" ] && [ "$event_level" != "Warning" ] && [ "$event_level" != "Error" ]; then

+ 4 - 1
bin/v-log-user-login

@@ -1,6 +1,9 @@
 #!/bin/bash
 # info: add user login
-# options: USER IP STATUS [FINGERPRINT]
+# options: USER IP STATUS [FINGERPRINT] [USER_AGENT] [AUTHLOG] [REASON]
+#
+# v-log-user-login user 1.1.1.1 session_id "User agent" yes "Failed multiple login attempts"
+#
 
 #----------------------------------------------------------#
 #                Variables & Functions                     #

+ 2 - 0
bin/v-log-user-logout

@@ -1,6 +1,8 @@
 #!/bin/bash
 # info: Log User logout event
 # options: USER FINGERPRINT
+#
+# example: v-log-user-logout user session_id
 
 #----------------------------------------------------------#
 #                Variables & Functions                     #

+ 1 - 1
bin/v-purge-nginx-cache

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: Purge nginx cache
-# options: USER DOMAIN
+# options: USER DOMAIN [RESTART]
 #
 # example: v-purge-nginx-cache user domain.tld
 #

+ 1 - 1
bin/v-rebuild-mail-domain

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: rebuild mail domain
-# options: USER DOMAIN
+# options: USER DOMAIN [RESTART]
 #
 # example: v-rebuild-mail-domain user domain.tld
 #

+ 2 - 2
bin/v-rename-user-package

@@ -1,8 +1,8 @@
 #!/bin/bash
 # info: change package name
-# options: OLD_NAME NEW_NAME [mode]
+# options: OLD_NAME NEW_NAME [MODE]
 #
-# example: v-rename-package package package2
+# example: v-rename-user-package package package2
 #
 # This function changes the name of an existing package.
 

+ 2 - 2
bin/v-restart-web-backend

@@ -1,8 +1,8 @@
 #!/bin/bash
 # info: restart php interpreter
-# options: NONE
+# options: [RESTART] [VERSION]
 #
-# example: v-restart-web-backend
+# example: v-restart-web-backend yes 8.0
 #
 # This function reloads php interpreter configuration.
 

+ 1 - 1
bin/v-unsuspend-dns-domains

@@ -12,7 +12,7 @@
 
 # Argument definition
 user=$1
-restart=${3-no}
+restart=${2-no}
 
 # Includes
 # shellcheck source=/etc/hestiacp/hestia.conf

+ 1 - 1
bin/v-unsuspend-mail-domain

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: unsuspend mail domain
-# options: USER DOMAIN
+# options: USER DOMAIN [RESTART]
 #
 # example: v-unsuspend-mail-domain user02 acme.com
 #

+ 1 - 1
bin/v-update-white-label-logo

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: update white label logo's
-# options: [DOWNLOAD]
+# options: [DOWNLOAD] [RESET]
 #
 # example: v-update-white-label-logo
 #