Forum Discussion

Adrien_Dopchie's avatar
Adrien_Dopchie
Icon for Nimbostratus rankNimbostratus
Mar 23, 2023

Upload iFiles to Bigip from Samba share

Good morning, 

I've got a usecase that I don't know how to implement it. 
We would like to upload each day some CRL Files from a windows samba share to our bigip and make them available with an Ifiles. Like that we have got a virtual server which is able to send the CRL files to client with a HTTP::respond 200 content [ifile get ]

I first think doing a ssh script to the bigip, to mount a samba share on the bigip, copy the files locally into /tmp and then execute the various command ( modify /sys file ifile .... ) to update the ifile files from the /tmp


But has someone has a better solution for doing this ? 
Call RestAPI to upload files and update the ifiles ? 

 Thanks in advance, 

Adrien

  • Hi Adrien_Dopchie 

    I wouldn't recommend having the BIG-IP be the controlling agent here, but if you want to do that, the smbclient executable is on the host and can be used with a bash script like:

     

    #!/bin/bash
    
    SMBSRV="smbserver"
    SMBSHARE="share_name"
    SMBUSER="username"
    SMBPASS="password"
    FNAME="CRLupdates"
    
    smbclient //$SMBSRV/$SMBSHARE -U $SMBUSER%$SMBPASS -c "get $FNAME"
    
    if [ $? -eq 0 ]; then
        echo "$FNAME retrieved"
    else
        echo "$FNAME not retrieved"
    fi
    

     

    You could then have an iCall script with a periodic handler at whatever interval you wish execute the bash script, then create an iFile from its contents.

    Personally, I'd move all the control off the BIG-IP and have an externally managed process (could also be a simple script, but documented in an operational procedure) check the share for updates to that file and upload them to BIG-IP and then modify the iFile as needed.

  • Hi Adrien_Dopchie 

    I wouldn't recommend having the BIG-IP be the controlling agent here, but if you want to do that, the smbclient executable is on the host and can be used with a bash script like:

     

    #!/bin/bash
    
    SMBSRV="smbserver"
    SMBSHARE="share_name"
    SMBUSER="username"
    SMBPASS="password"
    FNAME="CRLupdates"
    
    smbclient //$SMBSRV/$SMBSHARE -U $SMBUSER%$SMBPASS -c "get $FNAME"
    
    if [ $? -eq 0 ]; then
        echo "$FNAME retrieved"
    else
        echo "$FNAME not retrieved"
    fi
    

     

    You could then have an iCall script with a periodic handler at whatever interval you wish execute the bash script, then create an iFile from its contents.

    Personally, I'd move all the control off the BIG-IP and have an externally managed process (could also be a simple script, but documented in an operational procedure) check the share for updates to that file and upload them to BIG-IP and then modify the iFile as needed.

  • Thanks for the answer. 

    Automatize it trough ansible will be the better solution 😉

    • JRahm's avatar
      JRahm
      Icon for Admin rankAdmin

      yes, ansible is far more robust a solution than standalone scripts.

  • Hi Adrien_Dopchie - I see nobody has answered yet, so I'm going to feature your question in today's Community Highlights article to boost visibility and try to get a better reply for you.