2

I am trying to send DBus messages via Ubuntu Touch C++ application. With configuring default template (no error with unconfined) for Apparmor file my application is getting following error as reply:

QDBusMessage(type=Error, service="", error name="org.freedesktop.DBus.Error.AccessDenied", error message="An AppArmor policy prevents this sender from sending this message to this recipient, 0 matched rules; type="method_call", sender=":1.278" (uid=32011 pid=28575 comm="/usr/lib/arm-linux-gnueabihf/qt5/bin/qmlscene $@ s") interface="org.bluez.Manager" member="DefaultAdapter" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=824 comm="/usr/sbin/bluetoothd ")", signature="", contents=([]) )

phablet@ubuntu-phablet:/etc/apparmor.d$ aa-easyprof  --policy-vendor=ubuntu --policy-version=1.2 --list-templates
default
ubuntu-push-helper
ubuntu-scope-network
ubuntu-sdk
ubuntu-webapp
unconfined

My question: Do I have to configure Apparmor template with value unconfined even though the Ubuntu review will reject the upload package (and will do a manual review probably)? Or is there any way to create an own template for Ubuntu Touch click packages?

1
  • 1
    Just edit the *.apparmor in your project. Add rights that are needed.
    – Velkan
    Apr 25, 2015 at 6:48

1 Answer 1

1

Thanks for your answer. This is what I did. See manifest.json.in:

{
    "policy_groups": [
        "networking"
    ],
    "policy_version": 1.2,
    "template": "unconfined"
}

Thus following ways worked for me for muting BQ phone by any Ubuntu Touch application, but only by specifying the security template as unconfined.

  1. Launch pulse audio command:

    [...]
    myProcess = new QProcess(this);
    connect (myProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(printOutput()));
    connect (myProcess, SIGNAL(readyReadStandardError()), this, SLOT(printError()));
    QString cmd("/usr/bin/pactl");
    QStringList arguments;
    arguments.append(QString("set-sink-mute"));
    arguments.append(QString("0"));
    arguments.append(QString(muted?"1":"0"));
    myProcess->start(QString(cmd), arguments);
    
  2. Send DBus message:

    QDBusInterface handlerPropertiesInterface("org.freedesktop.Accounts", "/org/freedesktop/Accounts/User32011", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus());
    handlerPropertiesInterface.call("Set", "com.ubuntu.touch.AccountsService.Sound", "SilentMode", QVariant::fromValue(QDBusVariant(muted)));
    

To my mind it would be better to have a specific template for sending DBus messages (other than "wide" unconfined template), right? Or is it possible to define own security templates?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .