feat(README.md): add README for Manage OpenLDAP script
feat(fnox.toml): add fnox provider configuration feat(main.sh): create main shell script for Manage OpenLDAP feat(mise.toml): add tools and env configurations for mise feat(sources/functions.sh): create functions shell script for Manage OpenLDAP
This commit is contained in:
commit
f756ca2991
5 changed files with 115 additions and 0 deletions
27
README.md
Normal file
27
README.md
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# Manage OpenLDAP
|
||||
|
||||
Script interactif en Bash pour gérer les utilisateurs OpenLDAP (ajout, suppression).
|
||||
|
||||
## Prérequis
|
||||
|
||||
- `bash`
|
||||
- `fzf` (sélecteur interactif)
|
||||
- `figlet` (génération de bannières)
|
||||
- `lolcat` (couleurs arc-en-ciel)
|
||||
- `mise` (gestion des outils, optionnel)
|
||||
|
||||
Installation rapide avec `mise` :
|
||||
|
||||
```bash
|
||||
mise install
|
||||
```
|
||||
|
||||
## Utilisation
|
||||
|
||||
```bash
|
||||
./main.sh
|
||||
```
|
||||
|
||||
Un menu interactif s'affiche via `fzf` permettant de :
|
||||
1. Ajouter un nouvel utilisateur
|
||||
2. Supprimer un utilisateur
|
||||
8
fnox.toml
Normal file
8
fnox.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
default_provider = "age"
|
||||
|
||||
[providers.age]
|
||||
type = "age"
|
||||
recipients = ["age10cr6p37zvr77xwjs2rpqnqnasaztpyzyt993dhze90fjtntnuu3s8fmnjz"]
|
||||
|
||||
[secrets]
|
||||
TEST= { provider = "age", value = "YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBkMmxtMTZmNWVZdzJ6MkdtMGJZUjNpMDhqZ0pLUDJDaFdMOG0zUU5Kb0dJClVabGZkL1ZkYlN3UmN4UFg4R3RGaXJ4WDNRM1VEa0xrY3BIcy8xUmp3cWsKLT4gcjs0LWdyZWFzZSArZX1IKHQiTiBdJG8jITxvIEMxIl58IFAKYXRmWE9nUE5DaUJqMXd5TUVWZ2wrVEVQa2R3NVV4QVNmT3Rya2dwdlhRdzFrZWJQb2FCSDBLNTVhME9uK3cxQgpIK2J0ZXBIRkxVMAotLS0gekFSNG9HQzJZcHRTcjBRZ1hmRG54Vm93YURPMk5GT1ZNMEppRjZ4T2lGSQr+hZBytIlC8QnI/NlRSwYOEdY1U7DrQdDCDqOhweZJ2jyH5vw=", description = "test test" }
|
||||
22
main.sh
Executable file
22
main.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
clear
|
||||
|
||||
source ./sources/functions.sh
|
||||
|
||||
banner "Manage OpenLDAP"
|
||||
|
||||
CHOIX=(
|
||||
"1. Ajouter un nouveau utilisateur"
|
||||
"2. Supprimer un utilisateur"
|
||||
)
|
||||
|
||||
select_option() {
|
||||
local choice
|
||||
choice=$(printf "%s\n" "${CHOIX[@]}" | fzf --height=4 --reverse --cycle --prompt="❯ Choix : " --layout=reverse)
|
||||
log info "Selection - ${choice}"
|
||||
}
|
||||
|
||||
sleep 1.5
|
||||
|
||||
select_option
|
||||
9
mise.toml
Normal file
9
mise.toml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[tools]
|
||||
age = "latest"
|
||||
fnox = "latest"
|
||||
fzf = "latest"
|
||||
lazygit = "latest"
|
||||
npm = "latest"
|
||||
|
||||
[env]
|
||||
PROVIDER = "ollama"
|
||||
49
sources/functions.sh
Executable file
49
sources/functions.sh
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/bash
|
||||
|
||||
export CREATOR_NAME="Guillaume DENIS"
|
||||
|
||||
C_BLEU="\e[34m"
|
||||
C_ROUGE="\e[31m"
|
||||
C_VERT="\e[32m"
|
||||
C_ORANGE="\e[33m"
|
||||
C_VIOLET="\e[35m"
|
||||
|
||||
C_INVERSE="\e[7m"
|
||||
C_RESET="\e[0m"
|
||||
|
||||
function banner() {
|
||||
figlet -w 200 ${1} | lolcat
|
||||
echo -e "Created by ${CREATOR_NAME}\n"
|
||||
}
|
||||
|
||||
function log() {
|
||||
|
||||
DATE_NOW=$(date +%H:%M:%S)
|
||||
|
||||
if [[ -n ${1} ]]; then
|
||||
if [[ -n ${2} ]]; then
|
||||
case ${1} in
|
||||
info)
|
||||
echo -e "${C_BLEU}${C_INVERSE}[${DATE_NOW}]${C_RESET}${C_BLEU} - Info : ${2}${C_RESET}"
|
||||
;;
|
||||
warning)
|
||||
echo -e "${C_ORANGE}${C_INVERSE}[${DATE_NOW}]${C_RESET}${C_ORANGE} - Warning : ${2}${C_RESET}"
|
||||
;;
|
||||
success)
|
||||
echo -e "${C_VERT}${C_INVERSE}[${DATE_NOW}]${C_RESET}${C_VERT} - Success : ${2}${C_RESET}"
|
||||
;;
|
||||
error)
|
||||
echo -e "${C_ROUGE}${C_INVERSE}[${DATE_NOW}]${C_RESET}${C_ROUGE} - Error : ${2}${C_RESET}"
|
||||
;;
|
||||
*)
|
||||
echo -e "${C_ROUGE}${C_INVERSE}[${DATE_NOW}]${C_RESET}${C_ROUGE} - Error : Soit info / warning / success / error${C_RESET}"
|
||||
;;
|
||||
esac
|
||||
|
||||
else
|
||||
echo -e "${C_ROUGE}${C_INVERSE}[${DATE_NOW}]${C_RESET}${C_ROUGE} - Error : Il manque le deuxieme argument${C_RESET}"
|
||||
fi
|
||||
else
|
||||
echo -e "${C_ROUGE}${C_INVERSE}[${DATE_NOW}]${C_RESET}${C_ROUGE} - Error : Il manque le premier argument${C_RESET}"
|
||||
fi
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue