Jump to content

r0nmlt

Members
  • Posts

    155
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by r0nmlt

  1. Thanks.

    No.  I have the free account and it works.  You need to setup dropbox api to get the keys.  plenty of guides around.  One that comes to mind is how to setup rclone with dropbox.  You would obviously use just the instructions how to setup the api and get the keys.

    if anyone needs help I can show how I did it.

     

    • Like 1
  2. I don't know if this exists elsewhere but trying to search for "backup" and only found loads of questions but no solutions.  Krydos referenced a dead wiki in this post in 2019 https://helionet.org/index/topic/35348-backup-heliohost-account-to-a-cloud-storage/#findComment-157124 .  So without a solution here is what I did:

    1) Created a folder under my domain for backups.

    2) Under plex backup manager, Remote Storage Settings; I set this up to save backups to this folder.

    3) Again using plex, for a full backup, click on Account, backup my account and websites, and then Schedule Backup.   I setup a daily full backup to save into the FTP(S).

    4)  In the backups folder I created under my domain, I put this python file:

    #!/usr/bin/python3.12
    print('Content-type: text/html\r\n\r')
    
    import json
    import os
    import requests
    import sys
    session: requests.Session = requests.Session()
    
    #--------------------------------------------------------------------------
    #CONSTANTS
    local_backup_files_folder = "."
    dropbox_app_key = ""
    dropbox_app_secret = ""
    dropbox_basic_token = ""
    dropbox_access_token = ""
    #--------------------------------------------------------------------------
    
    #--------------------------------------------------------------------------
    def getLocalBackupFiles(local_backup_files_folder) -> dict[str, int]:
    
        local_files = {}
    
        all_local_files = os.listdir(local_backup_files_folder)
    
        for f in all_local_files:
            if os.path.isfile(os.path.join(local_backup_files_folder, f)) and f.endswith('.tar'):
                local_files[f] = os.path.getsize(f)
    
        return local_files
    #--------------------------------------------------------------------------
    
    #--------------------------------------------------------------------------
    def generateHeaders(auth_method) -> dict[str, str]:
    
        if auth_method == 'basic':
            headers: dict[str, str] = {
                'Authorization': 'Basic ' + dropbox_basic_token,
                'Content-Type': 'application/json'
                }
        if auth_method == 'bearer':
            headers: dict[str, str] = {
                'Authorization': 'Bearer ' + dropbox_access_token,
                'Content-Type': 'application/json'
                }
        if auth_method == 'upload':
            headers: dict[str, str] = {
                'Authorization': 'Bearer ' + dropbox_access_token,
                'Content-Type': 'application/octet-stream'
                }
    
        return headers
    #--------------------------------------------------------------------------
    
    #--------------------------------------------------------------------------
    def checkDropboxConnection() -> bool:
    
        headers: dict[str, str] = generateHeaders("basic")
    
        url: str='https://api.dropboxapi.com/2/check/app'
        data = json.dumps({"query":"heliohost"})
    
        res: requests.Response = session.post(url, data=data, headers=headers, timeout=10, allow_redirects=False)
    
        if res.status_code == 200:
            if res.json()['result'] == "heliohost":
                return True
            else:
                return False
        else:
            return False
    
    #--------------------------------------------------------------------------
    
    #--------------------------------------------------------------------------
    def listDropboxFolder() -> dict[str, int]:
    
        headers: dict[str, str] = generateHeaders("bearer")
    
        url: str='https://api.dropboxapi.com/2/files/list_folder'
        data = json.dumps({
            "path": ""
            })
    
        res: requests.Response = session.post(url, data=data, headers=headers, timeout=10, allow_redirects=False)
    
        if res.status_code == 200:
            if "entries" in res.text:
                number_of_dropbox_files = len(res.json()['entries'])
                if number_of_dropbox_files > 0:
                    #print(str(number_of_dropbox_files) + ' files in Dropbox Folder')
                    print("<br>")
                    dropbox_tar_files = {}
                    for f in res.json()['entries']:
                        #print(f)
                        print("<br>")
                        if f['name'].endswith('.tar'):
                            dropbox_tar_files[f['name']] = f['size']
                else:
                    print('No files in Dropbox Folder')
                    print("<br>")
                    dropbox_tar_files = []
                return dropbox_tar_files
            else:
                sys.exit('File list has wrong data')
        else:
            sys.exit('Cannot get file list')
    
    #--------------------------------------------------------------------------
    
    #--------------------------------------------------------------------------
    def checkMissingFiles(local_files, dropbox_tar_files):
        for f in local_files:
            #print(f)
            print("<br>")
            if f in dropbox_tar_files:
                print(f + " is in dropbox")
                print("<br>")
                if local_files[f] == dropbox_tar_files[f]:
                    print(f + " size matches")
                    print("<br>")
                    continue
                else:
                    print(f + " size mitchmatch in dropbox")
                    print("<br>")
                    result = uploadMissingFiles(f)
                    if result == True:
                        print(f + " uploaded successfully")
                        print("<br>")
            else:
                print(f + " is not in dropbox")
                print("<br>")
                result = uploadMissingFiles(f)
                if result == True:
                    print(f + " uploaded successfully")
                    print("<br>")
    #--------------------------------------------------------------------------
    
    #--------------------------------------------------------------------------
    def uploadMissingFiles(f) -> bool:
    
        headers: dict[str, str] = generateHeaders("upload")
    
        headers['Dropbox-API-Arg'] = '{"autorename":false,"mode":"add","mute":false,"path":"/' + f + '","strict_conflict":false}'
        url: str='https://content.dropboxapi.com/2/files/upload'
        data = open(f, "rb").read()
    
        res: requests.Response = session.post(url, data=data, headers=headers, timeout=10, allow_redirects=False)
    
        if res.status_code == 200:
            if res.json()['name'] == f:
                return True
            else:
                sys.exit('Error uploading')
        else:
            sys.exit('Error uploading')
    #--------------------------------------------------------------------------
    
    #--------------------------------------------------------------------------
    def deleteUploadedFiles(local_files, dropbox_tar_files):
        for f in dropbox_tar_files:
            if f in local_files:
                print(f + " exists in dropbox")
                print("<br>")
                if local_files[f] == dropbox_tar_files[f]:
                    print(f + " size matches")
                    print("<br>")
                    os.remove(f)
                else:
                    print(f + " size doesn't match")
                    print("<br>")
                    sys.exit('Size mismatch after upload')
            else:
                print(f + " is not in dropbox")
                print("<br>")
                sys.exit('File not in dropbox after upload')
    #--------------------------------------------------------------------------
    
    print("Starting")
    print("<br>")
    local_files= getLocalBackupFiles(local_backup_files_folder)
    if len(local_files) == 0: exit(0)
    print(local_files)
    print("<br>")
    
    check = checkDropboxConnection()
    
    if check:
        dropbox_tar_files = listDropboxFolder()
    else:
        sys.exit('Error connecting to DropBox')
    
    print(dropbox_tar_files)
    print("<br>")
    
    print("------------------------------------------")
    print("<br>")
    checkMissingFiles(local_files, dropbox_tar_files)
    dropbox_tar_files = listDropboxFolder()
    print("------------------------------------------")
    print("<br>")
    deleteUploadedFiles(local_files, dropbox_tar_files)
    print("------------------------------------------")
    print("<br>")
    local_files= getLocalBackupFiles(local_backup_files_folder)
    print(local_files)
    print("<br>")

    Replace the:

    dropbox_app_key = ""
    dropbox_app_secret = ""
    dropbox_basic_token = ""
    dropbox_access_token = ""

    with you own values.

    5) Setup a cron job to fetch the python url and execute the script.

    If you're having issues running python in this folder I used the .htaccess file in the folder:

    Options +ExecCGI
    AddHandler cgi-script .py
    DirectoryIndex backup_export.py

    where backup_export.py is the name of the script above.

    Hope this is of use.  If anyone improves on this and wants to share with the rest of us please go ahead.

     

  3. I am aware of the downtime due to the HD replacement but my vps is still down.  I was talking with baloons on discord and his has already booted some hours ago, so maybe there is something wrong with the bootup of my VPS.  Can you please check?

  4. For those like me who have been suspended for too many emails, a counter that keeps track is handy and helps in keeping within the 50 emails per day limit.

     

    This PHP script takes advantage of the report generated by cpanel track delivery tab.  I filtered the generated report to include only the outgoing emails and then counted.  I am not 100% sure this is foolproof as the filtering available is not clean cut.

     

    I have in mind of running a cron job (offsite) to execute the script (onsite) which checks the count.  If anything changed it will generate a report and store it in the mail folder (this avoids adding to the sendmail count).  Once the mail is synced with your home device the report in your mailbox will show the new daily count + some extra details.  

     

    Please feel free to modify to tailor to your needs.  Any suggestions welcome.

     

    PS my logging into heliohost is via 2FA, therefore I had to use the GoogleAuthenticator.php and FixedByteNotation.php scripts which should be place in a lib subfolder.

     

     

     

     

     

    GoogleAuthenticator.php

    FixedByteNotation.php

    KeyGenerator.php

    Logon.php

  5. Sorry but it was my fault.

     

    I set my outlook mail software to copy a hotmail account for all outgoing mail to keep a backup and this was adding a +1 to each email i sent.

     

    So 30 emails are actually 60 emails!  I thought an email is 1 email but every cc is an additional email.  

  6. I am quite sure that this time I haven't gone over the 50 emails as I also removed all fowarding as this was counting against the 50 emails.  I will check the mail route on cpanel to check how many emails are actually being sent and will revert.

     

    At your convenience please unsuspend.

     

    Thanks.

  7. A couple of days ago my account what suspended due to excess emails.  When this happens you cannot access your POP server, nonetheless the email client keeps on hammerring on interval to get in.  I think this is what caused it.

  8. Sorry for bothering you all again. Yesterday I got suspended because I went over the email limit. Krydos was kind enough to unblock me. Today I find this

     

    The IP address 77.71.171.34 has been blocked for trying to log in to POP3 with the wrong password too many times. To prevent this from happening again in the future please make sure your email client username and password are correct. You won't be able to continue to cPanel until an admin unblocks you. To request that your IP be unblocked please visit

     

    I'm sure I didn't do this as the pop server is accessed by a outlook and the passwords are saved. Can you please unblock me again?

     

    username: fcsltd

    website: fcs.com.mt

    server: tommy

  9. For anybody who is still using Outlook 2007 on windows 7 or other old mail clients which by default resort to TLS v1.0, there is a way to force Outlook 2007 to use TLS v1.2,

     

    I followed this article and got mine to work.

     

    https://blogs.technet.microsoft.com/schrimsher/2016/07/08/enabling-tls-1-1-and-1-2-in-outlook-on-windows-7/

     

    Just in case in the future this page is no longer accessible these are the steps to follow:

     

    Install KB3140245 from Microsoft update.

     

    Create a DWORD value called DefaultSecureProtocols in both of the following locations and set its value to 0xA80

     

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp

     

    Create the following DWORDS in the locations shown:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client

    DWORD: Enabled            Setting: 0
    DWORD: DisabledByDefault  Setting: 1

     

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client

    DWORD: Enabled            Setting: 1
    DWORD: DisabledByDefault  Setting: 0

     

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client

    DWORD: Enabled            Setting: 1
    DWORD: DisabledByDefault  Setting: 0

     

    Reboot and you are good to go.  Sniffing your connection should report 16 03 03 when handshaking TLS.

×
×
  • Create New...