Re: [virt-bootstrap][PATCH] Don't allow overwriting of the root partition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/01/2019 00:06, Cole Robinson wrote:
> On 01/04/2019 05:56 PM, Radostin Stoyanov wrote:
>> Closes #7
>>
>> Reported-by: @loops
>> Signed-off-by: Radostin Stoyanov <rstoyanov1@xxxxxxxxx>
>> ---
>>   src/virtBootstrap/virt_bootstrap.py | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/src/virtBootstrap/virt_bootstrap.py
>> b/src/virtBootstrap/virt_bootstrap.py
>> index a0b97a2..4bfa95d 100755
>> --- a/src/virtBootstrap/virt_bootstrap.py
>> +++ b/src/virtBootstrap/virt_bootstrap.py
>> @@ -124,6 +124,9 @@ def bootstrap(uri, dest,
>>
>>       if not os.path.exists(dest):
>>           os.makedirs(dest)
>> +    elif os.path.abspath(dest) == "/":  # Don't overwrite root
>> +        logger.error("Unpack to root directory is not allowed")
>> +        sys.exit(1)
>>       elif not os.path.isdir(dest):  # Show error if not directory
>>           logger.error("Destination path '%s' is not directory.", dest)
>>           sys.exit(1)
>
> Makes sense to me, rm has similar safety checks
>
> Reviewed-by: Cole Robinson <crobinso@xxxxxxxxxx>
>
Thanks, pushed now.

Radostin

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux