summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #198 from gonzoleeman/fix-changing-savedir-modeHEADmasterLee Duncan2023-04-261-4/+6
|\ | | | | Fix changing savedir directory mode
| * Fix changing savedir directory modeLee Duncan2023-04-241-4/+6
|/ | | | | | | | | | Commit 9f5764dac39b ("saveconfig: set right perms on /etc/target/ dir") fixed CVE-2020-13867 by ensuring that the mode of the target meta-data directory (/etc/target) was always mode 0600. But users can specify a different directory, such as "/tmp", and we don't want targetcli changing the mode of such directories to 0600. So only change the mode of the directory, when saving a config file, if the directory is /etc/target.
* Merge pull request #197 from zoumingzhe/killMaurizio Lombardi2023-04-141-1/+4
|\ | | | | targetcli: avoild Ctrl+C print error stack
| * targetcli: avoild Ctrl+C print error stackMingzhe Zou2023-03-271-1/+4
| | | | | | | | Signed-off-by: Mingzhe Zou <zoumingzhe@qq.com>
* | Merge pull request #189 from zoumingzhe/zmz-devMaurizio Lombardi2023-04-141-18/+20
|\ \ | |/ |/| fix setting preference rollback error
| * fix setting preference rollback errormingzhe.zou@easystack.cn2021-10-221-18/+20
|/ | | | | | | | | | | | | | | | Setting preference maybe rollback when execute multiple targetcli requests concurrently. ConfigShell always initialization new Console object. However, the lockfile need to be opened before requesting flock. At this time, an exception may occur and need to be output to the console. Currently, ConfigShell always initializes a new Console object. So, ConfigShell is initialized first to be able to print information. The prefs.bin file will be loaded when ConfigShell is initialized. In this case, the old value may be read, if a new preference is being set and not saved. In order to solve this problem we must first initialize a Console object. This patch needs https://github.com/open-iscsi/configshell-fb/pull/62 to be merged first. Signed-off-by: Zou Mingzhe <mingzhe.zou@easystack.cn>
* version 2.1.54v2.1.54Maurizio Lombardi2021-03-041-1/+1
| | | | Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
* Merge pull request #177 from maurizio-lombardi/sparseMaurizio Lombardi2020-11-231-8/+8
|\ | | | | fileio backstore: fix sparse file creation
| * fileio backstore: fix sparse file creationMaurizio Lombardi2020-11-231-8/+8
|/ | | | | | | | | | | | | | | | fallocate() can't be used to create sparse files because it actually preallocates all the disk space that will be used by the file backstore, sparse files do not have preallocated disk space by definition. We must therefore use ftruncate(). We can, on the other hand, use fallocate() to create non-sparse files and fall back to the slower "while() fwrite()" if we are running on Python version < 3.3 where fallocate() is not available Fixes 3bd4d8ef7c9b154c53e8b8dd863a570bce7f5c2c Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
* Merge pull request #176 from iammattcoleman/no-systemd-changes-in-setup.pyMaurizio Lombardi2020-07-161-1/+0
|\ | | | | Do not install systemd files in setup.py
| * Do not install systemd files in setup.pyMatt Coleman2020-06-191-1/+0
| | | | | | | | | | setuptools should not perform OS-specific actions such as installing systemd units. OS-specific actions should be handled by the package manager.
* | version 2.1.53v2.1.53Maurizio Lombardi2020-06-241-1/+1
|/ | | | Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
* Merge pull request #172 from pkalever/permsMaurizio Lombardi2020-06-041-6/+28
|\ | | | | Ensure we have right perms on saveconfig
| * saveconfig: set right perms on /etc/target/ dirPrasanna Kumar Kalever2020-06-011-15/+25
| | | | | | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
| * saveconfig: set right perms on backup dirPrasanna Kumar Kalever2020-06-011-3/+10
| | | | | | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
| * saveconfig: set 0o600 perms on backupfilesPrasanna Kumar Kalever2020-06-011-0/+5
| | | | | | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* | Merge pull request #173 from pkalever/perms2Maurizio Lombardi2020-06-041-0/+6
|\ \ | |/ |/| uds: set right permissions at bind() time
| * uds: set right permissions at bind() timePrasanna Kumar Kalever2020-05-291-0/+6
|/ | | | | | | | | | | | | | We fixed it earlier with commit 6e4f39357a90a914d11bac21cc2d2b52c07c213d but that fixes the issue when someone run the targetclid with systemd only. If we don't use targetclid.socket and want to run `targetclid` from command line, then socket.bind() will create the file with default permissions. Hence its good if we can guard the permissions right at the time of .bind() Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* version 2.1.52v2.1.52Maurizio Lombardi2020-05-111-1/+1
|
* Merge pull request #167 from pkalever/interactive-modeMaurizio Lombardi2020-04-093-25/+111
|\ | | | | daemonized-mode: add interactive shell support
| * daemon-interactive: do not allow clearing the promptPrasanna Kumar Kalever2020-04-071-2/+1
| | | | | | | | | | | | | | | | | | Typing somthing and then hitting backspace multiple-times would clear the prompt previously. This patch do not let backspace clear the prompt msg. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
| * daemon-interactive: show path on promptPrasanna Kumar Kalever2020-04-061-7/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ targetcli targetcli shell version 2.1.51 Entering targetcli interactive mode for daemonized approach. Type 'exit' to quit. /> pwd / /> cd /iscsi /iscsi> ls o- iscsi .......................................... [Targets: 0] /iscsi> exit Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
| * daemonized-mode: add interactive shell supportPrasanna Kumar Kalever2020-04-063-22/+71
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | set interactive mode as default to make it appear similar to cli approach, $ targetcli targetcli shell version 2.1.51 Entering targetcli interactive mode for daemonized approach. Type 'exit' to quit. /> pwd / /> cd /iscsi /> pwd /iscsi /> exit Here we introduce a new global option daemon_use_batch_mode for switching between batch and interactive modes. $ targetcli set global daemon_use_batch_mode=true Parameter daemon_use_batch_mode is now 'true'. $ targetcli targetcli shell version 2.1.51 Entering targetcli batch mode for daemonized approach. Enter multiple commands separated by newline and type 'exit' to run them all in one go. /> pwd /> cd /iscsi /> pwd / /iscsi Fixes: #160 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* Merge pull request #168 from pkalever/temp-filesMaurizio Lombardi2020-04-062-14/+15
|\ | | | | Use temp file objects for temporary storage area
| * Use temp file objects for temporary storage areaPrasanna Kumar Kalever2020-04-032-14/+15
|/ | | | | | | | | | | | | | | | | | | | | | | happen to see yet another issue after we switch to stringIO/bytesIO: $ targetcli ls 'unicode' does not have the buffer interface After which I felt like dealing with StringIO/BytesIO is like a wild goose chase and we are after all attempting to deal with python incompatible apis. Technically speaking, the rtslib and configshell libraries are expecting a string IO stream, but then for python2 with ByteIO() we are passing a bytestream, and stringIO() is behaving a bit different in python2 than expected as explained in my previous patch. Lets simply switch to temporary file in the most secure manner possible, opening files in string mode will assure the compatibility across the platforms. At the end we wish to have a consistent behaviour across all python versions. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* Merge pull request #166 from pkalever/Fix-BytesIO-StringIOMaurizio Lombardi2020-04-031-6/+9
|\ | | | | Fix StringIO/BytesIO stuck issue
| * Fix StringIO/BytesIO stuck issuePrasanna Kumar Kalever2020-04-021-6/+9
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We all know the way python3 handles strings is a bit different. $ python2 Python 2.7.16 (default, Apr 30 2019, 15:54:43) [GCC 9.0.1 20190312 (Red Hat 9.0.1-0.10)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import io >>> s=io.BytesIO() >>> s.write('hello') 5L >>> s.getvalue() 'hello' >>> s=io.StringIO() >>> s.write('hello') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unicode argument expected, got 'str' >>> s.write(u'hello') 5L >>> s.getvalue() u'hello' >>> $ python3 Python 3.6.8 (default, Dec 5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import io >>> s=io.BytesIO() >>> s.write('hello') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: a bytes-like object is required, not 'str' >>> s.write(b'hello') 5 >>> s.getvalue() b'hello' >>> s=io.StringIO() >>> s.write('hello') 5 >>> s.getvalue() 'hello' >>> The way Python2 and Python3 handles String and Bytes IO is different. * In Python2 BytesIO() accepts text format syntax, and StringIO() expects unicodes * While in Python3 StringIO() accepts text format syntax, and BytesIO() expects bytes like objects I think the compatibility of using both the IO streams with python2 and python3 is compromised. Hence this patch, uses BytesIO() and StringIO() based on python version. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* Merge pull request #164 from pkalever/sockModeFixMaurizio Lombardi2020-04-011-0/+1
|\ | | | | targetclid.sock: change SocketMode to 0600
| * targetclid.sock: change SocketMode to 0600Prasanna Kumar Kalever2020-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | SocketMode= If listening on a file system socket or FIFO, this option specifies the file system access mode used when creating the file node. Takes an access mode in octal notation. Defaults to 0666. Thanks Alex Murray[@alexmurray], for reporting. Fixes: #162 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* | Merge pull request #165 from pkalever/targetclid-fixMaurizio Lombardi2020-03-301-1/+1
|\ \ | |/ |/| Fix targetclid daemon infinite stuck
| * Fix targetclid daemon infinite stuckPrasanna Kumar Kalever2020-03-301-1/+1
|/ | | | | | | We need to open a byte IO stream because we are actually dealing with binary data in memory. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* Merge pull request #156 from iammattcoleman/replace-file-with-stringioMaurizio Lombardi2020-01-271-8/+9
|\ | | | | Use StringIO as a buffer instead of a file
| * Use StringIO as a buffer instead of a fileMatt Coleman2019-11-071-8/+9
| |
* | Merge pull request #157 from maurizio-lombardi/masterMaurizio Lombardi2019-11-261-0/+1
|\ \ | |/ |/| setup.py: add the socket and service files to the data_files section
| * setup.py: add the socket and service files to the data_files sectionMaurizio Lombardi2019-11-261-0/+1
|/ | | | Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
* version 2.1.51v2.1.51Maurizio Lombardi2019-11-061-1/+1
|
* Merge pull request #154 from pkalever/deprecate-tcp-optionMaurizio Lombardi2019-11-052-21/+4
|\ | | | | targetcli: depreciate the redundant '--tcp' option
| * targetcli: depreciate the redundant '--tcp' optionPrasanna Kumar Kalever2019-11-042-21/+4
| | | | | | | | | | | | | | | | It looks like '--tcp' option is no more needed after our recent global auto_use_daemon flag addition, which helps set/unset the daemonized approach. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* | Merge pull request #141 from cvubrugier/remove-epydocMaurizio Lombardi2019-11-044-97/+97
|\ \ | |/ |/| Remove Epydoc markup from command messages
| * Remove Epydoc markup from command messagesChristophe Vu-Brugier2019-08-014-97/+97
| | | | | | | | Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
* | Merge pull request #153 from pkalever/improve-daemon-expMaurizio Lombardi2019-10-316-8/+121
|\ \ | | | | | | Improve user experience with daemonized appoach
| * | man: add daemon intro at targetcli(8) man pagePrasanna Kumar Kalever2019-10-301-1/+7
| | | | | | | | | | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
| * | systemd-units: fix documentationPrasanna Kumar Kalever2019-10-302-2/+2
| | | | | | | | | | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
| * | targetclid: add man page entryPrasanna Kumar Kalever2019-10-301-0/+86
| | | | | | | | | | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
| * | daemon: load the prefs on every new connectionPrasanna Kumar Kalever2019-10-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ------- Noticing inconsistency with prefs when switching between cli mode and daemon mode Solution: ------- Makesure to read/load the prefs on every new connection Thanks to 'Xiubo Li <xiubli@redhat.com>' for reporting the problem Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
| * | cli: show useful hint in header area of shell in daemonized modePrasanna Kumar Kalever2019-10-301-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ------- When auto_use_daemon=true, entering multi-line command-mode/shell-mode appears like the cli is stuck for new users, as we do not display any info now :-) $ targetcli ---- nothing here, is it stuck ? ------- $ targetcli cd /backstores/ get global auto_use_daemon pwd ls exit auto_use_daemon=true /backstores o- backstores ................................................ [...] o- block .................................... [Storage Objects: 0] o- fileio ................................... [Storage Objects: 0] o- pscsi .................................... [Storage Objects: 0] o- ramdisk .................................. [Storage Objects: 0] o- user:glfs ................................ [Storage Objects: 0] Solution: ------- Add some userful info and a '/> ' in each line, $ targetcli targetcli shell version 2.1.50 Entering targetcli batch mode for daemonized approach. Enter multiple commands separated by newline and type 'exit' to run them all in one go. /> cd /backstores/ /> get global auto_use_daemon /> pwd /> ls /> exit auto_use_daemon=true /backstores o- backstores ................................................ [...] o- block .................................... [Storage Objects: 0] o- fileio ................................... [Storage Objects: 0] o- pscsi .................................... [Storage Objects: 0] o- ramdisk .................................. [Storage Objects: 0] o- user:glfs ................................ [Storage Objects: 0] Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
| * | cli: provide a way to disable using daemonPrasanna Kumar Kalever2019-10-301-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ------- Currently when auto_use_daemon is set to true and in case for some reasons user do not want to start the daemon or the dameon is not starting succefully for some unknown reason, then there is no way to bypass the calls to dameon and use cli directly $ targetcli pwd [Errno 111] Connection refused Solution: -------- Provide an option with cli to turn auto_use_daemon to false. $ targetcli pwd [Errno 111] Connection refused Currently auto_use_daemon is true, hence please make sure targetclid daemon is running ... (or) Incase if you wish to turn auto_use_daemon to false then run '#targetcli --disable-daemon' $ targetcli --help Usage: ./scripts/targetcli [--version|--help|CMD|--tcp|--disable-daemon] [...] --disable-daemon Turn-off the global auto use daemon flag See man page for more information. $ targetcli --disable-daemon Parameter auto_use_daemon is now 'false'. $ targetcli pwd / Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
| * | cli: show better error msg when daemon is not runningPrasanna Kumar Kalever2019-10-181-0/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When auto_use_daemon is set to true and daemon is not running/stopped Before: ------ $ targetcli ls [Errno 111] Connection refused Now: --- $ targetcli ls [Errno 111] Connection refused Currently auto_use_daemon is true, hence please make sure targetclid daemon is running ... Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* | Merge pull request #151 from gonzoleeman/fix-daemon-and-python-3.7-issues-v2Maurizio Lombardi2019-10-154-42/+65
|\ \ | | | | | | Fix daemon and python 3.7 issues v2
| * | Do not print err msg when signal closes socket.Lee Duncan2019-10-101-1/+3
| | | | | | | | | | | | | | | | | | Before, we would get a "Bad File Descriptor" message when a signal causes closure of the socket while waiting on a socket message.