I am trying to correct the following stunnel syntax for CentOS 6.x:
stunnel -c -f -d 1143 -r imap.foo.tld:993 -P ''
The proposed syntax of is not working:
-c: No such file or directory (2)
To take care of XY problem concerns: I need to migrate my IMAP email from Host A to Host B. Generally I use imapcopy and port 143. However this time host A only supports SSL 993, which imapcopy does not. Stunnel is supposed to get around this, at least according to this tutorial: http://manurevah.com/blah/en/p/Migrate-emails-with-Imapcopy
That page contains a note (unfortunately not very well called out) that is of relevance.
NOTE: Stunnel doesn't work the same way since Debian Jessie (not sure since which version of stunnel). I've not dug in to it and hence do not know what the new syntax should be (if you know, let me know).
I don't know how you found that page but it is clearly old and out of date. (I can only find one other page that references stunnel having command line arguments like that and it lists itself as old more explicitly. Everything else I can find is about the new config file based configuration.)
You could also use pymap-copy instead imapcopy. It's more state of the art and you don't need stunnel.
Or you can write:
stunnel3 -c -f -d 1143 -r imap.foo.tld:993 -P ''
stunnel3 is a wrapper script for backward compability
Related
I am trying to set up a connection and transfer files using putty on a windows 10 platform. I have verified that the default port in putty is 22. When I run the command in the command line to connect and transfer files though I get the above error. Any idea why this is or what I should do?
Did you try:
pscp -P 22 c:\documents\foo.txt user#example.com:/tmp/foo
I had to go into the Putty Default Settings and "Save" them again, despite port 22 showing as the default. Worked for me to avoid adding the -P 22 option every time.
I had the same error and ended up at this page. The -P 22 did not solve my problem.
I use Putty saved sessions and double checked my command line and had the same error as the OP.
I was using:
pscp -l SESSION_NAME_IN_PUTTY ip:/remote_path local_path
I reviewed the command line options for pscp and changed the -l to -load and it worked.
The final command looked like:
pscp -load SESSION_NAME_IN_PUTTY ip:/remote_path local_path
Note: If you still have the error, please review your spelling of SESSION_NAME_IN_PUTTY and ensure it is an exact match. One letter off, can cause the same error.
In my case I had created a shortened "session name" in Putty -- that is, a shorter representation of the full hostname. This worked for most Putty functions -- but when I tried to use pscp I found that I needed to have a session name that was identical to the hostname.
I'm my case I was hitting this error because SSH was not enabled in Raspbian.
When trying to issue this command to send a file attachment from the command line I'm getting an error:
Bad IDN in "from": 'sd3.È'
sd3 is the name of my host.
The command I'm executing is:
echo "See attached file" | /usr/bin/mutt -a file.txt -s File:file.txt -- myemail#domain.com
I recently cloned an existing Centos7 server (made a copy of the virtual machine and spawned it as a second instance under a different IP) and everything has been working perfectly for awhile as far as I can tell. Not sure if that's relevant to this but it could be an indicator of what needs adjusting.
On the original server I cloned, I can run this command on without any error. I uninstalled mutt and re-installed it and I'm still getting the error.
.muttrc looks like this:
set mbox_type=Maildir
set folder="~/Maildir"
set mask="!^\\.[^.]"
set mbox="~/Maildir"
set record="+.Sent"
set postponed="+.Drafts"
set spoolfile="~/Maildir"
I also compared the /etc/Muttrc and /etc/Muttrc.local files and they're identical between the two systems. (Muttrc.local is empty)
Running the latest version of Mutt under CentOS7: Mutt 1.5.21 (2010-09-15)
So on two almost-identical servers, one runs, one doesn't. Any ideas what might be wrong?
I encountered the same problem and it was simply solved by setting the from variable in ~/.muttrc (in fact, the file didn't exist before and this is the only thing my .muttrc contains now):
set from="something#something.com"
I was smashing my head the entire day on this issue as I'm not permitted allow to installed outside of redhat repo
I found a workaround that is using option -x
-x Emulate the mailx compose mode.
echo "This is a test message" | mutt -x -s "Test Mail" john.smith#example.com
Setting the following environment variables worked for me.
EMAIL=default#company.com
REPLYTO=$EMAIL
export EMAIL REPLYTO
After a ton of research, there appears to be some obscure bugs that are still in this stable version of mutt - which is the standard package release on CentOS7.
First I removed my old version:
yum remove mutt.x86_64
I ended up downloading the latest source of mutt, 1.9.0 from mutt.org and manually compiling and installing it.
In order to compile the source version of Mutt, I also needed to run:
yum install ncurses-devel
Now the command works without this "bad IDN" error.
It appears CentOS 7.3 had mutt-1.5.21-26.el7.x86_64 and CentOS 7.4 now has mutt-1.5.21-27.el7.x86_64.
If you don't want to compile/install from source, I found that a Fedora 22 version (mutt-1.6.2-1.fc22.x86_64.rpm) works OK. I just removed the rpm that came from CentOS 7.4 and did a local install of the Fedora 22 rpm.
I ran into this working through some automated system builds (Centos7, Mutt 1.5.21).
Using strace and some other debugging it wasn't entirely clear what the issue was, but seemed to be circling dns/domain/hostname issues. I as able to get around/recreate the error by adding/remove the "search " in the /etc/resolv.conf file (works WITH a search domain).
Without a search domain, rendered the: Bad IDN in "from": ... error
I have this problem:
I need to control the perl-debugger from an external script.
By research I found out about various solutions, but I don't understand them.
I failed to properly set up the RemotePort option (editing ".perldb"), which was the first I tried, and found no useful information on providing a filehandle from which the debugger would get its input (by somehow setting #cmdfhs)
I found both options over here: http://search.cpan.org/~nwclark/perl-5.8.6/lib/perl5db.pl
It would be nice if you could tell me how to provide the filehandle from which the debugger gets its input, or if you know a link where this is explained?
Here's a simple example setting it up using RemotePort, which seemed easier to me:
The trick to using RemotePort is that you have to have someone listening on the remote end BEFORE you launch the script to be debugged.
As soon as you launch your script with -d Perl will attempt to connect to RemotePort. So you have to make sure the initial connection succeeds by having someone listening there beforehand.
Here I assume some Linux/Unix variant, which has the netcat utility installed. We use netcat to wait for incoming connections in this example, but you can use anything else you wish too which is able to create a service port and shuffle data between that and the current TTY:
In terminal 1:
# Use netcat to listen for incoming connections on port 9999
> nc -l -p 9999
In terminal 2:
# Start perl with -d and request a RemotePort connection
> PERLDB_OPTS=RemotePort=127.0.0.1:9999 perl -d my_script.pl
As soon as you do that in terminal 1 you will see something like this:
Loading DB routines from perl5db.pl version 1.39_10
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(my_script.pl:4):
DB<1>
There you go..debug away.
Devel::Trepan is a gdb-like debugger. Although it has remote control, you can also run it at the outset with the option --command which will "source" (in the gdb-sense) or run a series of debugger commands.
To go into remote control, either start the debugger using the --server option or inside the debugger use the "server" command once inside the debugger.
See Options for a list of options you can give at the outset.
I'm trying to write a perl script that redirects its stdin to a remote machine and at the same time redirects the stdout of the remote machine to its stdout:
callingProgram <--> myScript <--> sshTunnelToRemote
See this question and bdonlan's answer for the purpose of the script.
First I tried to use the open2() function from the IPC library but for reasons described here it doesn't seem to be a good approach, I didn't even get a simple grep command working.
My second idea was to use the Net::SSH::Perl or the Expect libraries but they're not available on the machine where the script is supposed to be executed and I can't install libraries there.
So my question is what could be a simple way to achieve what I want? Solutions using [ba]sh or even C++ are also possible. The targeted platform is Solaris 10.
Seems like you could probably get away with nothing more than system() — don't pass the data from your stdin to ssh's stdin and from your stdout to ssh's stdout; just let ssh inherit your stdin and stdout. Unless you need to modify the data in transit somehow.
cpanminus can do this for you
Running:
cd ~/bin
curl -LO http://xrl.us/cpanm
chmod +x cpanm
Now you can try your problem using the right tools (e.g. Net::SSH::Perl).
The power of perl is cpan, and cpanminus gives you the ability to install whatever you need even if you don't have permission to install to the system-wide libraries.
Read the module documentation for the full details.
I have started to learn Zend Framework with the Book "Zend Framework in Action" in German.
Right there where it starts to get interesting, my PHP Unit Test throws this Error:
"Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] No such file or directory"
I can't find any hints through Google searches. I did everything like it is in the book.
Can anyone give me a hint as to where to search for the fault?
Is this a common beginner mistake?
I would say that you have a problem connecting from PHP to MySQL...
Something like PHP trying to find some socket file, and not finding it, maybe ?
(I've had this problem a couple of times -- not sure the error I got was exactly this one, though)
If you are running some Linux-based system, there should be a my.cnf file somewhere, that is used to configure MySQL -- on my Ubuntu, it's in /etc/mysql/.
In this file, there might be something like this :
socket = /var/run/mysqld/mysqld.sock
PHP need to use the same file -- and, depending on your distribution, the default file might not be the same as the one that MySQL uses.
In this case, adding these lines to your php.ini file might help :
mysql.default_socket = /var/run/mysqld/mysqld.sock
mysqli.default_socket = /var/run/mysqld/mysqld.sock
pdo_mysql.default_socket = /var/run/mysqld/mysqld.sock
(You'll need to restart Apache so the modification to php.ini is taken into account)
The last one should be enough for PDO, which is used by Zend Framework -- but the two previous ones will not do any harm, and can be useful for other applications.
If this doesn't help : can you connect to your database using PDO, in another script, that's totally independant of Zend Framework ?
i.e. does something like this work (quoting) :
$dsn = 'mysql:dbname=testdb;host=127.0.0.1';
$user = 'dbuser';
$password = 'dbpass';
try {
$dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
If no, the problem is definitly not with ZF, and is a configuration / installation problem of PHP.
If yes... Well, it means you have a problem with ZF, and you'll need to give us more informations about your setup (like your DSN, for instance ? )
Do not assume your unix_socket which would be different from one to another, try to find it.
First of all, get your unix_socket location.
$ mysql -u root -p
Enter your mysql password and login your mysql server from command line.
mysql> show variables like '%sock%';
+---------------+---------------------------------------+
| Variable_name | Value |
+---------------+---------------------------------------+
| socket | /opt/local/var/run/mysql5/mysqld.sock |
+---------------+---------------------------------------+
Your unix_soket could be diffrent.
Then change your php.ini, find your php.ini file from
<? phpinfo();
You maybe install many php with different version, so please don't assume your php.ini file location, get it from your 'phpinfo';
Change your php.ini:
mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock
mysqli.default_socket = /opt/local/var/run/mysql5/mysqld.sock
pdo_mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock
Then restart your apache or php-fpm.
Try setting host=127.0.0.1 on your db settings file, it worked for me! :)
Hope it helps!
i had this problem when running the magento indexer in osx.
and yes its related to php problem when connecting to mysql through pdo
in mac osx xampp, to fix this you have create symbolic link to directory /var/mysql, here is how
cd /var/mysql && sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
if the directory /var/mysql doesnt exist, we must create it with
sudo mkdir /var/mysql
Im also suffered from this problem & simply, by adding port number after the ip address saved me.
$dsn = 'mysql:dbname=sms_messenger;host=127.0.0.1:8889';
$user = 'root';
$password = 'root';
This works for Mac OS
If you don't know your mysql port number, then
You can easily find the port number on MAMP home page
OR
Type following command while running the MAMP server to switch the terminal into mysql
OMBP:mamp Omal$ /Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot
Then type
mysql> SHOW GLOBAL VARIABLES LIKE 'PORT';
This error because mysql is trying to connect via wrong socket file
try this command for MAMP servers
cd /var/mysql && sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock
or
cd /tmp && sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock
and this commands for XAMPP servers
cd /var/mysql && sudo ln -s /Applications/XAMPP/tmp/mysql/mysql.sock
or
cd /tmp && sudo ln -s /Applications/XAMPP/tmp/mysql/mysql.sock
It looks like mysql service is either not working or stopped.
you can start it by using below command (in Ubuntu):
service mysql start
It should work! If you are using any other operating system than Ubuntu then use appropriate way to start mysql