Monday, October 29, 2012

Allow Cyberduck to login to Amazon S3

If you have created a user in the Amazon IAM Console and wish to allow them to use Cyberduck to connect to Amazon S3 you need to grant them the ability to list all the buckets. This is done by applying a policy on the user of:


{
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:ListAllMyBuckets"
      ],
      "Resource": "arn:aws:s3:::*"
    }
  ]
}


This means they can see all the buckets that exist on your account but can't actually see then contents of them without getting some policies applied on specific buckets.

This all comes about from the way Cyberduck does it's initial login to Amazon S3.

Update: If you just connect directly to the bucket using it's bucket name as part of the hostname (eg www.example.com.s3.amazonaws.com), you don't need to grant this permission but you do get an SSL issue.

Thursday, July 05, 2012

virsh vol-upload error

I was attempting to upload a file into a volume using virsh with libvirt to a qemu/kvm hypervisor storage pool and I was getting:

vol-upload error: unknown procedure: 208


Turns out this is because the remote libvirt version was 0.7.5 and upload support wasn't added until 0.9.0. Hope this helps someone else.

Tuesday, June 05, 2012

tftpd on Mac OS X

Mac OS X comes with a TFTP daemon which is all setup to use launchctl, the only issue is it's disabled by default. launchctl allows you to override the disabled entry when loading the file so to use the TFTP daemon:

sudo launchctl load -w /System/Library/LaunchDaemons/tftp.plist

Then it will serve files up from /private/tftpboot/ just make sure they are readable by all. To shutdown the daemon just run:

sudo launchctl remove com.apple.tftpd

Monday, May 28, 2012

svn diff of just modified files

I was working against a project in which I had a few conflicts, but wanted to generate a patch containing some of the changes to that project, in this case I wanted files I had modified but not the ones that had conflicts. In short svn doesn't provide a way todo this but using a few additional tools it works fine:


svn st | awk '$1 == "M"{print $2;}'| xargs svn diff


Monday, March 19, 2012

Random Skype Disconnections

Recently I'd started having problems with Skype disconnecting several minutes into a call and losing internet access in other applications as well. This initially was only happening with Skype on the iPad so I put it down to bugginess on the iOS version of Skype crashing the router or something on the iPad, however I just had the same disconnection symptoms after about 5 minutes of a video call on my Mac. This time I went to the router's administration page and found that the router (Speedtouch ST780) hadn't recently rebooted but in the event log it said:

Mar 19 22:04:10IDS dos parser : udp flood (1 of 1) : 192.168.1.69 80.229.225.26 1018 UDP 65177->45237

Now this tied in exactly with the time of the call dropping so it looks like Skype is triggering the udp flood detection on the router. There isn't a simple way to disable this through the web interface. So you have to telnet to the router and issue the commands:


ids config state=disabled
saveall


which disables the intrusion detection system. I'm not too worried about this as the router doesn't have any real services listening on it's WAN IP and I trust all the internal clients. Anyway, hopefully problem solved for now.

Saturday, December 31, 2011

General Logging in MySQL



I was looking to investigate some connection problems we were having to a MySQL database and wanted to be sure that the client was connecting to correct machine. MySQL 5.1 doesn't provide this information on it's own, but it is contained in the general log. However the log contains all statements executed against MySQL so will have a performance impact on a production machine. The general log can be enabled/disabled while MySQL is still running which means you can enable the logging, capture the events your interested in and then disable it again. Todo this connect to MySQL as a user who can set GLOBALS (typically root) and run:

mysql> SET GLOBAL general_log_file='/var/log/mysql.log';
Query OK, 0 rows affected (0.00 sec)

mysql> SET GLOBAL general_log = 1;
Query OK, 0 rows affected (0.00 sec)

Then the file /var/log/mysql.log should start filling up with statements. Once your done disable the general log:

mysql> SET GLOBAL general_log = 0;
Query OK, 0 rows affected (0.01 sec)

In my case I was looking for connection messages so a simple grep pulled out the lines I was interested in:

grep Connect /var/log/mysql.log | less

Tuesday, June 01, 2010

Using a maven SNAPSHOT plugin from repository.apache.org

I was working on a project and hitting a bug in the maven eclipse plugin which was causing the JRE to be placed incorrectly in the Eclipse .classpath. If it was just a single project I'd have gone and edited the resulting file manually but it affected a few, so I thought I'd try and grab a newer copy of the maven eclipse plugin. I did this by first adding a profile to my maven setttings.xml file ($HOME/.m2/settings.xml on UNIX).

<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

   <profiles>

     <!-- This is the additional bit you need -->
     <profile>
       <id>apache-plugin-snapshots</id>
       <pluginRepositories>
         <pluginRepository>
           <id>apache-snapshots</id>
           <name>Apache Snapshot Repository</name>
           <url>https://repository.apache.org/content/groups/snapshots-group/</url>
           <releases>
             <enabled>false</enabled>
           </releases>
           <snapshots>
             <enabled>true</enabled>
           </snapshots>
         </pluginRepository>
       </pluginRepositories>
     </profile>

   </profiles>

</settings>

and then run the mvn eclipse command:

mvn -Papache-plugin-snapshots org.apache.maven.plugins:maven-eclipse-plugin:2.9-SNAPSHOT:eclipse

which downloaded the newer plugin and then ran it against the project I had checked out.