Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handling of config files in tgt-admin #72

Merged
merged 2 commits into from
Mar 31, 2025
Merged

Conversation

tjwoodall
Copy link

There are two commits here.

The first improves the config file handling, in particular, it avoids things like executing code supplied in the config file via shell escapes.
(I don't consider this a security risk as the config files are owned by root *on debian at least) but a system that allowed other users to change these files would give a local root compromise)

The second allows a tape changer VTL to be defined in the config file (I've included my config file in the commit message)

Note that I'm including them both together because I've never tests with them separate, the first one that avoids shell escapes from the config file came about because of me wanting the second one.

Tim Woodall added 2 commits March 22, 2025 17:21
# Create a target
<target iqn.2007-03:virtual-tape:hostname>

# Create a tape drive and give it a nice name
# The tape starts out without a backing store file, i.e. no tape loaded
  <backing-store NONE:0>
    lun 1
    device-type tape
    vendor_id   IBM
    product_id  ULT3580-TD8
    product_rev 2160
    scsi_sn     XYZZY_1
    removable   1
  </backing-store>

  <backing-store NONE:1>
    lun 2
    device-type tape
    vendor_id   IBM
    product_id  ULT3580-TD8
    product_rev 2160
    scsi_sn     XYZZY_2
    removable   1
  </backing-store>

# We need a backing store file for the media changer
#dd if=/dev/zero of=$HOME/smc bs=1k count=1

# Create the SMC device and give it a nice name
  <backing-store /root/smc>
    lun 3
    device-type changer
    vendor_id   STK
    product_id  L700
    product_rev 0010
    scsi_sn     XYZZY_0
    removable   1

# Add a Data Transfer devices (2 drives)
    params element_type=4,start_address=1,quantity=2

# Specify that the TAPEs above (LUN 1/2) are the data transfer devices we created
    params element_type=4,address=1,tid=${tid},lun=1
    params element_type=4,address=2,tid=${tid},lun=2

# Medium Transport Elements (robot arm / picker)
    params element_type=1,start_address=16,quantity=1

# define path to virtual media
    params media_home=/root/media

# Storage Elements - 8 starting at addr 1024
    params element_type=2,start_address=1024,quantity=8

# Add 'media' to slots 1-3 and leave the other 5 slots empty
# slot 1
    params element_type=2,address=1024,barcode=tape001
# slot 2
    params element_type=2,address=1025,barcode=tape002
# slot 3
    params element_type=2,address=1026,barcode=tape003

  </backing-store>

</target>
@fujita fujita merged commit b39d056 into fujita:master Mar 31, 2025
2 checks passed
@fujita
Copy link
Owner

fujita commented Mar 31, 2025

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants