[SOLVED] Network drive and installation

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
Herzas
Messages: 10
Registration: Apr 02, 2019 - 11:44

October 10, 2019 - 10:38

Hello everyone, I'm working on a new WAPT installation and for this one I'd like to avoid using a replication server. So I've chosen to create WAPT packages for my largest software programs. Something fairly simple like: `
def install():
cmd = '\\server_north\software_folder\large_software\setup.exe'`.
Of course, just like with my usual setup, I get that wonderful error message:
"The specified path could not be found."
So I discovered that: The WAPT service runs under a local system account (NT_Authority\System), and this account is complicated for network drives with my Samba domain controller.
So I tried WAPT's session setup function and, miraculously, it works.
Except, unfortunately, it only works if the user has access rights to that network location, and if it's open and they enter their password at least once.

So I have a starting point: with the command
cmd = 'net use * \\serveur_nord\dossierlogiciel\groslogiciel\ /USER:login mdp'
locally there is no problem but via wapt it gets stuck I must be missing a ' ' or a " "

Finally I am open to any suggestion that would allow me to do without these replication servers.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

October 12, 2019 - 11:19

Putting a password in plain text in a WAPT packet isn't ideal.

Do you absolutely want to do it via SMB?

I'd recommend setting up a small web server instead. Nginx, Apache, or something similar... and then use wget in your packet.
nliaudat
Messages: 29
Registration: August 8, 2019 - 8:31 AM

October 14, 2019 - 08:34

Code: Select all

import win32wnet

wnet_connect(host, username, password)
#dès la connexion établie, l'accès au dossier est possible.

def wnet_connect(host, username, password):
    unc = ''.join(['\\\\', host])
    try:
        win32wnet.WNetAddConnection2(0, None, unc, None, username, password)
    except Exception, err:
        if isinstance(err, win32wnet.error):
            # Disconnect previous connections if detected, and reconnect.
            if err[0] == 1219:
                win32wnet.WNetCancelConnection2(unc, 0, 0)
                return wnet_connect(host, username, password)
        raise err
You create a read-only wapt-install user on your software folder with no other access

An example of how to select the nearest server based on the gateway:

Code: Select all

def getdownloadserver():
    #### Get gateway and set depending server
    location = str(get_default_gateways()).split('.')[2]  ## third octet of gateway ip address

    if location == 0 : 
        return "10.0.0.X"
    elif location == 1 : 
        return "10.0.1.X"
    elif location == 2 : 
        return "10.0.2.X"
    else :
        return "10.0.0.X"
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

October 14, 2019 - 09:15

Remember to make a copy rather than launching the installer directly from the network drive. This avoids a number of problems
Locked