summaryrefslogtreecommitdiff
path: root/src/libs/ssh/sshconnection.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Ssh: Rename SshConnectionParameters into SshParametersJarek Kobus2022-05-231-435/+0
| | | | | | | | | | Move it to its own header. Get rid of SshConnection and SshConnectionManager, as they are not used anymore. Change-Id: I52fe20d7816ea57e7a7158ab2ae9565d50a76e21 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Get rid of SftpTransferJarek Kobus2022-05-231-21/+0
| | | | | | | | Remove also sftpdefs.h. They are not used anymore. Change-Id: I6c45a70cec2e01afdd1a668068e090f5d4abde9b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* SftpTransfer: Get rid of FileTransferErrorHandling enumJarek Kobus2022-05-111-10/+7
| | | | | | | FileTransferErrorHandling::Ignore wasn't used anywhere. Change-Id: I5826fc9f7871b06cd8f423d7e3b1d01a5b6cbdff Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Utils: Introduce QtcProcess::controlEnvironment()hjk2022-05-101-2/+3
| | | | | | | | | | | | | | ... and drop QtcProcess::removeEnvironment() This shifts the meaning of the unqualified QtcProcess::environment() to always refer to (possibly remote) "main" process this QtcProcess wraps. The controlEnvironment is now referring to secondary helper processes (if any...) typically(?) running on the host system. This helps to avoid local/remote distinctions in some places. Change-Id: Ib7cd15dd226617484b5358acd7deaed29e751883 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* QtcProcess: Forward declare Environment in QtcProcess headerJarek Kobus2022-05-091-0/+1
| | | | | | Change-Id: If85a8a07b144c94cb6e45f66dcb06573ef07c777 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
* Get rid of SshRemoteProcessJarek Kobus2022-05-091-13/+0
| | | | | | | | It's being replaced by QtcProcess with path on device. Change-Id: I29eb038d1b17151683f86855eb547e47f7f7dea5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
* Move setupSshEnvironment() into SshConnectionParametersJarek Kobus2022-05-091-1/+21
| | | | | | | | As we are going to remove SshRemoteProcess. Change-Id: I07cf246791f1adb6cfc454935d7e330c2f1d4dc7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
* Get rid of SshConnectionInfoJarek Kobus2022-05-031-33/+0
| | | | | | | | It's not used anymore. Change-Id: Ie77c9d9bc8eb82c1f74cfdac2304bc6c2f92ee93 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Get rid of SftpSessionJarek Kobus2022-04-081-7/+0
| | | | | | | | | Should be substituted by FilePath actions using remote paths. Change-Id: Ib1e3913cc94d417045cbe6b922284a2f8ab6d71f Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
* QtcSsh: Connect to QtcProcess::done() signalJarek Kobus2022-04-051-12/+3
| | | | | | | Instead of connecting to errorOccurred() and finished() signals. Change-Id: I113f51564501a67725afee77ab4d20e5d954a7c0 Reviewed-by: hjk <hjk@qt.io>
* Merge remote-tracking branch 'origin/7.0'Eike Ziller2022-03-181-1/+2
|\ | | | | | | | | | | | | Conflicts: src/plugins/webassembly/webassemblytoolchain.cpp Change-Id: Ia75c783e3ecab1f97de2b5c73a0979c49da82009
| * Make the setup info visually more noticeableJarek Kobus2022-03-181-1/+2
| | | | | | | | | | | | | | | | | | | | By adding two leading newlines we separate it nicely from the other part of the test log. Amends 66c5b1e11e1f80c4113bea940302ea79926a0c13 Change-Id: Ic260cdc4cc2421ddb04bc5027082521800b268e8 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | Merge remote-tracking branch 'origin/7.0'Eike Ziller2022-03-171-0/+91
|\ \ | |/ | | | | | | | | | | | | Conflicts: src/plugins/android/androiddevice.cpp src/plugins/docker/dockerdevice.cpp Change-Id: Id16ba0d9993c9f608242622aceae0a2a6691e05e
| * RemoteLinux: Avoid unexpected password dialog in testsChristian Stenger2022-03-161-0/+91
| | | | | | | | | | | | | | | | | | | | Make the test depend on environment variables and give some hint how to run the test correctly. Beside this make the test work on Windows and share the setup with ssh unit test. Change-Id: I6bbf1ec863449512646ca2c51d13fec537beedbc Reviewed-by: hjk <hjk@qt.io>
* | Get rid of SshProcess (one process class less)Jarek Kobus2022-02-211-3/+5
| | | | | | | | | | | | | | | | | | Introduce static SshRemoteProcess::setupSshEnvironment() method instead. Change-Id: I9a49bc68bd96ddf0f58234d28b92a721f7d4bb56 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | Ssh: Drop ProcessMode from c'tors and creator methodsJarek Kobus2022-02-181-5/+4
|/ | | | | | Change-Id: I2db51f26d9a841f60d5ab3722fa82b3a89d57146 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
* RemoteLinux: Implement some of the remote file APIhjk2022-01-041-31/+43
| | | | | | | | | | | | | | | | | | | Implementation of remote file API for correct FilePath work with RemoteLinux. Added tests for this functionality Run ssh shell in separate thread. The linux device instance keeps its own thread for running SshRemoteProcess. In this way all calls to filepath interface of linux device coming from different threads are executed in one thread (SshRemoteProcess is reentrant, but not thread safe). The redirection to the device thread is done by invoking SshRemoteProcess' methods through BlockingQueuedConnection. Done-by: Artem Sokolovskii Change-Id: Id8756738d3a4597f175c8ef000c148d0c8536eeb Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Make connParams a const memberJarek Kobus2022-01-031-3/+5
| | | | | | | Change-Id: I1dc75414766b9ec6c16a1c7080878da51310863c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Get rid of Utils::FileSystemWatcher from SshConnectionJarek Kobus2021-12-151-29/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we are starting master process for ssh (-M option specified) we don't know whether everything went fine, since the process just starts and doesn't print anything to the output in case all went fine. It may also happen that when there are issues the master process finishes soon after it was started. When everything went fine the master process should create a socket (specified by ControlPath option). But when we receive a started() signal from the process, the socket isn't yet ready. So, in order to detect that connection was established properly, the old implementation created a FileSystemWatcher on the expected socket file to appear. There are 2 issues with the approach above: 1. There might be a race condition inside the started() handler of the master process. After checking that the expected socket isn't created yet and before setting up the file system watcher, the socket file could have been created in meantime what wouldn't be noticed. 2. The use of Utils::FileSystemWatcher excludes the usage in non-main threads. Thus in general: usage of SshConnection outside of main thread is dangerous. This patch implements it in a different way. Instead of installing a file system watcher we make use of local command of ssh master process. We enable it by "PermitLocalCommand=yes" and specify a local command by "LocalCommand=echo". This means that local command will be executed after successfully connecting to the server. Our command is very simple - just empty echo, which means that we should expect the "\n" on master process output after successful run. So, instead of connecting to started() signal we are connected to readyReadStandardOutput() and detect successful connection after receiving newline char. This eliminates both issues with the old approach and makes a step towards thread safe shared ssh connections. Change-Id: I2e20c82aeff09b297e3cad5644d4d2c956db82d0 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Use QtcProcess in SshConnection::connectionInfo()Jarek Kobus2021-11-051-3/+5
| | | | | | Change-Id: Ibc0966ee43266d5d0f5f4f71274f11a4150eab3b Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Ssh: Use FilePath for SshConnectionParameters::privateKeyFilehjk2021-09-281-1/+1
| | | | | | Change-Id: Ifaf97cc744f80e1fa0f4000aabf83671b2ffd972 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Ssh: Re-base SshProcess on top of QtcProcessJarek Kobus2021-09-131-11/+13
| | | | | Change-Id: I266820e0e2ea12d6e4a5a83a679a7279fab9cd83 Reviewed-by: hjk <hjk@qt.io>
* SSH: Help preventing "Too many authentication failures" errorsMartin Kampas2020-10-071-1/+3
| | | | | | | | | | When an ssh-agent offers many different identities, the maximum authentication attempts the server permits may be exceeded, resulting in the above error. With IdentitiesOnly enabled, just the explicitly specified identities will be used. Change-Id: Ic10d7032893a38c608989f957b5e91b7dc15c24c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* SSH: Ignore connection timeout with Microsoft's OpenSSHChristian Kandeler2019-10-011-12/+20
| | | | | | | | | | The Microsoft-provided ssh binaries misinterpret the connection timeout in that they only start to connect after that period has passed, which slows down the connection process. So let's not use the timeout option there. Change-Id: I5a5335c7f1b4af04f1afb5603ab0f1a518e8c95e Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* SSH: Fix autotestChristian Kandeler2019-06-111-1/+1
| | | | | | | | - Consider the case of connection sharing being disabled. - Adapt to slower environments. Change-Id: I088622034c26ea343eb78161b24c43b3286b0512 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Merge remote-tracking branch 'origin/4.9' into 4.10Eike Ziller2019-06-061-1/+3
|\ | | | | | | Change-Id: I5775afb845c26afa6fae9bdfc47dc9c3f9d5b975
| * SSH: Add missing return statementChristian Kandeler2019-06-051-1/+3
| | | | | | | | | | Change-Id: Ic109b0b5a022ea462532fbf21736ee7124168608 Reviewed-by: hjk <hjk@qt.io>
* | Utils: Rename FileName to FilePathhjk2019-05-281-1/+1
| | | | | | | | | | | | | | | | More in line with QFileInfo terminonlogy which appears to be best-of-breed within Qt. Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | SSH: Pass remote command as QStringChristian Kandeler2019-05-241-2/+2
|/ | | | | | | | | | The old implementation sent the command over the wire as-is, so we declared it as a QByteArray and let the caller choose the encoding. This doesn't make sense anymore, as the command is now passed to an external process as a QString anyway. Change-Id: Ib84bc0f871db2b45b93f71d924c4177cc28d3bb0 Reviewed-by: hjk <hjk@qt.io>
* SSH: Shorten the temporary directory even moreChristian Kandeler2019-04-301-4/+2
| | | | | | | | | | Creating a sub-directory of Creator's master temp dir makes the socket path too long on macOS, so use a normal QTemporaryDir. Fixes: QTCREATORBUG-21748 Change-Id: I4992e43032838e6f625162cd40ae101d21c62fdc Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Fix some deprecation warnings in basic pluginsFriedemann Kleint2019-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Fix warnings apppearing in 5.13, for example: warning: ‘QDir& QDir::operator=(const QString&)’ is deprecated: Use QDir::setPath() instead [-Wdeprecated-declarations] ... warning: ‘static QRgb QColorDialog::getRgba(QRgb, bool*, QWidget*)’ is deprecated: Use getColor() [-Wdeprecated-declarations] warning: ‘Qt::DropAction QDrag::start(Qt::DropActions)’ is deprecated: Use QDrag::exec() instead [-Wdeprecated-declarations] warning: ‘void QProcess::finished(int)’ is deprecated: Use QProcess::finished(int, QProcess::ExitStatus) instead [-Wdeprecated-declarations] ... warning: ‘const QRect QDesktopWidget::availableGeometry(int) const’ is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations] ... warning: ‘const QBrush& QPalette::background() const’ is deprecated: Use QPalette::window() instead [-Wdeprecated-declarations] ... warning: ‘const QBrush& QPalette::foreground() const’ is deprecated: Use QPalette::windowText() instead [-Wdeprecated-declarations] ... warning: ‘void QTextOption::setTabStop(qreal)’ is deprecated [-Wdeprecated-declarations] warning: ‘void QList<T>::swap(int, int) [with T = ProjectExplorer::BuildStep*]’ is deprecated: Use QList<T>::swapItemsAt() [-Wdeprecated-declarations] warning: ‘void QProcess::setReadChannelMode(QProcess::ProcessChannelMode)’ is deprecated: Use QProcess::setProcessChannelMode() instead [-Wdeprecated-declarations] ... warning: ‘QString QFileInfo::readLink() const’ is deprecated: Use QFileInfo::symLinkTarget() instead [-Wdeprecated-declarations] Change-Id: I1d893d42d372245892f2de8406f52dbe7bbd552a Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* SSH: Shorten the path name of the control socketChristian Kandeler2019-01-151-2/+2
| | | | | | | | | The maximum path length for a UNIX domain socket is much lower than for other file types. Fixes: QTCREATORBUG-21748 Change-Id: I5e27169f356d7a2960a817e308a1f5d4858b6f7d Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
* RemoteLinux: Use an SshProcess for rsyncChristian Kandeler2018-12-211-1/+1
| | | | | | | | Otherwise, if connection sharing is disabled and public key authentication fails, the askpass tool is not invoked. Change-Id: Iea8316675b8f270c924f822f340f6282b21450d5 Reviewed-by: hjk <hjk@qt.io>
* SshConnection: Reduce the scope of some variablesChristian Kandeler2018-12-191-14/+13
| | | | | | | | The file watching objects are temporary in nature and don't need to be class members. Change-Id: I845e4f8599a338517f6fc26ffd9d0061466ba33e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* RemoteLinux: Add an rsync deploy stepChristian Kandeler2018-12-171-2/+12
| | | | | | | | | | Using rsync enables proper incremental deployment and is particularly helpful when larger files are involved. We check whether rsync works as part of the device test. If it does, it becomes the default deploy step, otherwise we fall back to SFTP. Change-Id: I6ab938ccd5acd7e0cbe07b90b6938dccad19bba5 Reviewed-by: hjk <hjk@qt.io>
* SSH: Delete file system watcher right after useChristian Kandeler2018-12-141-1/+2
| | | | | | | It's only ever needed at startup, no need to keep it around after that. Change-Id: Icc1ada71177d4f81b0b84cd3607a8a8b7af9cec2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* SSH: Use OpenSSH toolsChristian Kandeler2018-12-131-871/+245
| | | | | | | | | | | | | | | | | | | | | | | | ... instead of our own SSH library. Advantages: - Full compatibility with OpenSSH behavior guaranteed. - Minimal maintenance effort. - Less code to build. - Big chunk of 3rd party sources can be removed from our repository. One the downside, Windows users now need to install OpenSSH for RemoteLinux support. Hoewever, people doing embedded development probably have it installed anyway. [ChangeLog] Switched SSH backend to OpenSSH Fixes: QTCREATORBUG-15744 Fixes: QTCREATORBUG-15807 Fixes: QTCREATORBUG-19306 Fixes: QTCREATORBUG-20210 Change-Id: Ifcfefdd39401e45ba1f4aca35d2c5bf7046c7aab Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* SSH: Implement X11 forwardingChristian Kandeler2018-11-191-0/+5
| | | | | | Change-Id: Ia7b15e784cb098bc7c6c6be2748d772192187e97 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* SSH: Use Botan2Christian Kandeler2018-08-101-8/+6
| | | | | | | | | | | | | | | | Botan 1.10 will be completely unsupported by the end of this year, so we now target API version 2 instead. Also upgrade our bundled Botan to the latest version 2.7. We no longer check in pre-processed files, but use the upstream sources directly (with unneeded parts removed), employing Botan's own configure script for building. This will make future upgrades much simpler. A script to automate this process is also provided. Task-number: QTCREATORBUG-18802 Task-number: QTCREATORBUG-8107 Change-Id: I5a5ea62cfd30d720b556217142e8b7e06bf49f7e Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Combine some SshConnectionParameter membershjk2017-12-191-13/+13
| | | | | | | | Combine host, port, username and password into a 'url' member and add some convenience accessors. Change-Id: Iddc26ff00dad1285c96aa56f196dbc4febe8e974 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Merge remote-tracking branch 'origin/4.3'Eike Ziller2017-05-091-2/+2
|\ | | | | | | | | | | | | Conflicts: src/plugins/debugger/cdb/cdbengine.cpp Change-Id: Ib9aeccc4162c43e9ee3d85847d96678045625dd0
| * SSH: Catch std::exception rather than Botan-specific onesChristian Kandeler2017-05-051-2/+2
| | | | | | | | | | | | | | | | | | | | In particular, the existence of Botan::Exception wrongly suggests that it is the parent class of all Botan-specific exceptions. This assumption, combined with a different bug that will be fixed in a follow-up commit, caused a crash in the key generator. Change-Id: I0aafb761052d185051df217c9914010235a7c77b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | SSH: Add support for ssh-agentChristian Kandeler2017-05-041-14/+162
|/ | | | | | Task-number: QTCREATORBUG-16245 Change-Id: Ifd30c89d19e547d7657765790b7520e42b3741c3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* SSH: Catch all exceptions in SshConnectionPrivate::closeConnectionRobert Loehning2017-02-221-1/+1
| | | | | | | | SshClientException or SshServerException might be thrown in SshAbstractCryptoFacility::convert Change-Id: I0950ce8d7979c171926a12f6c6d94abeffcc4b93 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* SSH: Use Qt5-style connectsOrgad Shaneh2016-06-151-16/+20
| | | | | | | The heavy lifting was done by clazy. Change-Id: I04261849c92c54990f9f142fe541d984c5fb21d3 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Ssh: Implement tcp/ip forward tunnelingUlf Hermann2016-05-231-4/+32
| | | | | Change-Id: I529b3392ea7e4cbae2c736c9f55352ef6b19da98 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Update License according to agreement with Free Qt FoundationTobias Hunger2016-01-191-17/+12
| | | | | | | * Update remaining files in src Change-Id: I1896f17fcf34f71c3310c87899fb5171b8e4afb1 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* SSH: Use categorized logging.Christian Kandeler2016-01-181-8/+4
| | | | | | Change-Id: I9890c7d4a86320c835e70e66c523c5a2f7b41421 Reviewed-by: Michal Klocek <michal.klocek@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* SSH: Fix TCP/IP forwarding support.Christian Kandeler2015-04-151-4/+6
| | | | | | | | | We hardcoded the remote host to the SSH server for some reason, and the originating port was bogus as well. Change-Id: I8f6700bc12f4374302dd3bfc035c9c9f060f56ef Reviewed-by: Caspar Romot <cro@icd.ee> Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Don't mix iterator and const_iteratorKai Koehne2015-04-021-1/+1
| | | | | | | | | | | This avoids unnecessary detaches of the Qt container data. The mismatches where detected by defining QT_STRICT_ITERATORS; however, this define violates the ODR (causing linker errors), and therefore is not added permanently. Change-Id: Idd336a9c8b394214a820437ef1b92d2101f6101c GPush-Base: 62b0848b9cf357bcded4184c71d490bae56c773b Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>