Add setup and password check

master v0.2
sheychen 2017-07-13 15:04:20 +02:00
parent 8992dcb0aa
commit c371abadf6
5 changed files with 41 additions and 29 deletions

25
App/encryption/setup.bat Executable file
View File

@ -0,0 +1,25 @@
@echo off
set CFG=%USERPROFILE%\AppData\Local\nextcloud\nextcloud.cfg
echo Nextcloud Setup
echo Server Url:
set /p URL=
echo Username:
set /p USER=
echo [General] > %CFG%
echo optionalDesktopNotifications=true >> %CFG%
echo [Accounts] >> %CFG%
echo version=2 >> %CFG%
echo 0\url=%URL% >> %CFG%
echo 0\http_user=%USER% >> %CFG%
echo 0\authType=http >> %CFG%
echo 0\user=%USER% >> %CFG%
echo 0\Folders\1\localPath=../../Data/nextcloud/ >> %CFG%
echo 0\Folders\1\targetPath=/ >> %CFG%
echo 0\Folders\1\paused=true >> %CFG%
echo 0\Folders\1\ignoreHiddenFiles=true >> %CFG%
exit

View File

@ -1,26 +1,24 @@
::@echo off
@echo off
set CONFIG_ARCHIV="..\..\Data\config.7z"
set DATA_ARCHIV="nextcloudData.7z"
set DATA_ARCHIV="..\..\Data\nextcloud.7z"
:: [ 0 | 1 | 3 | 5 | 7 | 9 ]
set COMPRESSION=0
set SEVENEXE="libs\7-Zip\7za.exe"
set PASSWD=%1
set RUNTIME_CONFIG_DIR=%USERPROFILE%\AppData\Local\nextcloud
set PAPPS_DOCUMENTS_DIR=%2
set RUNTIME_OWNCLOUD_DATA_DIR=%PAPPS_DOCUMENTS_DIR%nextcloud
set RUNTIME_NEXTCLOUD_DATA_DIR=%PAPPS_DOCUMENTS_DIR%nextcloud
set RUNTIME_NEXTCLOUD_DATA_DIR="..\..\Data\nextcloud"
set LOG_FILE="..\..\Data\nextcloudPortableEncryption.log"
echo This is the nextcloudPortable encryption starter script! > %LOG_FILE%
echo Configuration: >> %LOG_FILE%
echo \t CONFIG_ARCHIV = %CONFIG_ARCHIV% >> %LOG_FILE%
echo \t DATA_ARCHIV = %PAPPS_DOCUMENTS_DIR%%DATA_ARCHIV% >> %LOG_FILE%
echo This is the nextcloud Portable encryption starter script! > %LOG_FILE%
if exist %CONFIG_ARCHIV% (
if not exist %CONFIG_ARCHIV% (
echo Can't find %CONFIG_ARCHIV% >> %LOG_FILE%
START /WAIT setup.bat
) else (
echo Extracting portable nextcloud client config and data... >> %LOG_FILE%
%SEVENEXE% x %CONFIG_ARCHIV% -o%RUNTIME_CONFIG_DIR% -p%PASSWD% -y >> %LOG_FILE%
%SEVENEXE% x %PAPPS_DOCUMENTS_DIR%%DATA_ARCHIV% -o%RUNTIME_NEXTCLOUD_DATA_DIR% -r -p%PASSWD% -y >> %LOG_FILE%
del /s /f /q %PAPPS_DOCUMENTS_DIR%%DATA_ARCHIV%
%SEVENEXE% x %CONFIG_ARCHIV% -o%RUNTIME_CONFIG_DIR% -p%PASSWD% -y >> %LOG_FILE% || (start cmd /C "echo Wrong Password & pause" & exit)
%SEVENEXE% x %DATA_ARCHIV% -o%RUNTIME_NEXTCLOUD_DATA_DIR% -r -p%PASSWD% -y >> %LOG_FILE% || (start cmd /C "echo Wrong Password & pause" & exit)
del /s /f /q %DATA_ARCHIV%
)
echo Starting nextcloud client. >> %LOG_FILE%
@ -31,7 +29,7 @@ echo Encrypting nextcloud client config and data... >> %LOG_FILE%
:: -mhe to encrypt headers so nobody can browse the archive
:: -mx0 to not compress the archiv (only for performance)
%SEVENEXE% u %CONFIG_ARCHIV% %RUNTIME_CONFIG_DIR%\nextcloud.cfg -mx%COMPRESSION% -mhe -p%PASSWD% -y >> %LOG_FILE%
%SEVENEXE% a %PAPPS_DOCUMENTS_DIR%%DATA_ARCHIV% %RUNTIME_NEXTCLOUD_DATA_DIR%\* -mx%COMPRESSION% -mhe -p%PASSWD% -y >> %LOG_FILE%
%SEVENEXE% a %DATA_ARCHIV% %RUNTIME_NEXTCLOUD_DATA_DIR%\* -mx%COMPRESSION% -mhe -p%PASSWD% -y >> %LOG_FILE%
echo Securely removing data from this computer... >> %LOG_FILE%
del /s /f /q %RUNTIME_NEXTCLOUD_DATA_DIR% & rd /s /q %RUNTIME_NEXTCLOUD_DATA_DIR% >> %LOG_FILE%

0
Data/nextcloud/.gitkeep Normal file
View File

View File

@ -4,25 +4,14 @@ This is a portable Nextcloud client that runs on Windows.
At starttime a Batch file is executed and will prompt you for a password.
On first run this will set your password to encrypt the Nextcloud client configuration (host, user, password) and the data stored in your portable `Documents` folder.
**ATTENTION**: This currently only works if used inside a complete PortableApps setup like used on USB sticks with the following directory structure:
```
X:\
Documents\
nextcloud\
PortableApps\
nextcloudPortable\
```
A setup with the PortableApps directories not at the root of a drive is not yet tested.
**ATTENTION**: A wrong password can remove your data.
## Install
1. Install 'nextcloudPortable_X.X.paf.exe' with PortableApps Plateform
1. Install 'nextcloudPortable_X.X-X.paf.exe' with PortableApps Plateform
2. Run Nextcloud
3. Enter a password
4. Create folder ```X:\Documents\nextcloud```
5. Setup nextcloud with folder ```../../../../Documents/nextcloud```
4. Setup nextcloud
5. Resume sync
## Used software