-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from MrMarioMichel/development
Readme
- Loading branch information
Showing
8 changed files
with
159 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
date=`date +%d%m%y` | ||
achivesize=`du -sh ./Archiv/` > ./Log/BackupCheck/log$date.txt | ||
achivesize=`du -sh ./Archiv/` | ||
echo Current size : $achivesize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
# Use gunzip -r Archiv/ to unzip all ziped .gz files | ||
date=`date +%d%m%y` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
# Use gunzip -r Log/ to unzip all ziped .gz files | ||
date=`date +%d%m%y` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,100 @@ | ||
# Config-Backupper | ||
This script can backup the configs from firewalls and switches | ||
This script can backup the configs from firewalls and switches. | ||
|
||
|
||
### Packet dependencies | ||
Check the file **REQUIREMENTS** to see all packet dependencies. | ||
|
||
# How to install | ||
Step 1. ``` git clone https://github.com/MrMarioMichel/Config-Backupper ``` --> this branch should work otherwise download one of the [newest release](https://github.com/MrMarioMichel/Config-Backupper/releases) | ||
|
||
Step 2. ```cd ./Config-Backupper``` --> enter the downloaded repository | ||
|
||
Step 3. ```chmod 700 ./setup.sh``` --> make the setup.sh executable | ||
|
||
Step 4. ```./setup.sh``` --> start the setup.sh | ||
|
||
# How to setup | ||
|
||
#### Set days after a config gets compressed (.gz format) [2,5x-3,5x SMALLER] (Numbers only): | ||
|
||
Here you can define (in days) when the archived configs should get compressed. (Recommended : 14) | ||
|
||
If you don't want to compress the configs is set it to 9999. --> No compression for 27 Years long enough... | ||
|
||
#### Enter bit lenth (Numbers only): | ||
|
||
Here you can define the SSH Key used to authenticate at the devices. (Recommended : 4096 or higher) | ||
|
||
Use low bit key length (1024 - 2048bits) to speed up the authentication **BUT SECURITY SUFFERS FROM IT !!!**. | ||
|
||
#### Enter passphrase (empty for no passphrase): | ||
|
||
Just press enter otherwise the script would need everytime it connects to a devices the password. Still want to have a password you will neeed to enter the password in clear text in the ./Modules/Backup module ```sshpass -p "<PASSWORD>" scp -i ...``` | ||
|
||
#### Enter same passphrase again: | ||
|
||
Again just enter. | ||
|
||
# How to configure | ||
|
||
## Server side | ||
|
||
In ```./Devices/<VENDOR>/<VENDOR>-Devices.txt``` you need to enter line by line all IP addresses. For more information have a look in any of these device .txt files. | ||
|
||
## Client side (Network device) | ||
|
||
Create or use an existing read only profile for a user named "backup" (All in small letters, all togther, no spaces) on the device. This user should get only read rights for highest security. Also add the ./SSH-Keys/Backup-SSH-Key.pub to the user that this key pair can be used to login. See table **Use SSH-Key for Authenictaion** how to do that for each vendor. | ||
|
||
### Use SSH-Key for Authenictaion | ||
| Vendor | Link | Info | | ||
| :------------- |:-------------| :-----| | ||
| Fortinet |[Authenticate a CLI administrator using SSH keys](https://kb.fortinet.com/kb/documentLink.do?externalID=11985)| Also see [Technical Note: How to download a FortiGate configuration file and upload firmware file using secure file copy (SCP)](https://kb.fortinet.com/kb/documentLink.do?externalID=FD43754) | | ||
| DELL | | Note : [SSH Key Auth on Dell PowerConnect Switches](https://eengstrom.github.io/musings/ssh-key-auth-powerconnect) | | ||
| Cisco | | | | ||
| HP | [Configure the switch for SSH authentication](http://h22208.www2.hpe.com/eginfolib/networking/docs/switches/YA-YB/15-18/5998-8153_yayb_2530_asg/content/ch08s06.html#s_5Configuring_the_switch_for_SSH_authentication) | Note : See step **Option B: Configuring the switch for client Public-Key SSH authentication** in order to use the client, so in our case the server sided SSH key. | | ||
|
||
# How to test | ||
|
||
You can test the script (Recommended) befor you run it automaticaly to get the config file with ```scp -P <PORT> -vvv -i ./SSH-Keys/Backup-SSH-Key backup@><IP>:<CONFIGFILE> ./TestConfigFile```. If that worked and the config file is now stored as **TestConfigFile**. You can delete the **TestConfgiFile** and run the script and see what happens. | ||
|
||
### Remote name of the config file | ||
|
||
| Name | File | Note | | ||
| :------------- |:------------- | :----- | | ||
| Fortinet Firewall | sys_config | [Backup over SCP](https://forum.fortinet.com/tm.aspx?m=114055) | | ||
| 2 | | | | ||
| 3 | | | | ||
|
||
# About | ||
|
||
The script uses a <YOU-CHOOSE-IT> bit long SSH Key for authentication. That key must be added to all devices at the user backup in order for the script to get the configs. In the directory ./Log will be all output generated by the script for each day and each vendor. | ||
|
||
# Limitaions | ||
| LimitNr | Limitation | Reason | Will get fixed | | ||
| :-------------: |:------------- | :----- | :-----: | | ||
| 1 | If you try to run the scrip more often than once a day the logs of the secound run will also be in the same log file | Logging has not been designed for this | | ||
| 2 | | | | ||
| 3 | | | | ||
|
||
# Facing Problems | ||
|
||
### General : | ||
|
||
| Problem | Solution | Description | | ||
| :------------- |:------------- | :----- | | ||
| ssh: connect to host <IP-ADDRESS> port 22: Connection timed out | Check if port 22 used for SSH | If SSH do not use the port 22 (Default) you need to place the host inside the special module of the certain vendor (Problem caused by scp because it automaticaly uses port 22 if no other port is defined) | | ||
| 2 | | | | ||
| 3 | | | | ||
|
||
|
||
|
||
### Fortinet : | ||
|
||
| Problem | Solution | Description | | ||
| :------------- |:------------- | :----- | | ||
| Sink: 501-Permission Denied 501-Permission Denied | Check if enabled SCP on the Fortinet Device | The script can connect but has problems with the rights to copy the config file. If you don't enable SCP you can run into this problem. | | ||
| 2 | | | | ||
| 3 | | | | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters