Enable/Disable Kernel Configuration options in Yocto - security

I have a configuration option called CONFIG_X86_SMAP that I would like to disable in my kernel image. The problem is that I can't identify where this option is being set. I can confirm that it isn't set in my defconfig file and also it's not set by any configuration fragment ".cfg".
Even when I try to disable it using a .cfg as follows:
# CONFIG_FOO is not set
I still find it enabled in my final generated .config file. I cant get to understand how this option is being enabled.
Note: There is no dependency on this configuration option from any other driver/feature.

You can modify your defconfig by following these steps.
Identify in which tasks .config is generated.(In most cases there would be do_configure or do_defconfig task that will create your .config)
Add following lines in your recipe(linux-kernel.bb file).This will append configurations to your defconfig file.
do_confiure_prepend() {
cat >> <path_to_your_defconfig> << END
CONFIG_X=y
CONFIG_Y is not set
END
}

Related

How to disable file deletion confirmation in NvimTree?

I just installed NvimTree plugin to my neovim setup and i get annoyed by the y/n prompt when i am deleting a file. How to disable it?
Nvim's user-specific configuration file is located at
$XDG_CONFIG_HOME/nvim/init.vim, by default ~/.config/nvim/init.vim
add the following line to your configuration file:
let g:NERDTreeConfirmDelete = 0

Why Buildroot does not take in account new device_table.txt?

I want to modify the permission of a file.
I created my own device_table.txt in location board/<product>.
Configured BR2_ROOTFS_DEVICE_TABLE to point to the location of the new device_table.txt.
The permission of the file is not modified.
I can see that buildroot uses a default device_table.txt: system/device_table.txt.
Do I have to do extra configurations to buildroot? What I am missing?
Problem found: had a space in:
BR2_ROOTFS_DEVICE_TABLE =<device_table_location>.
Fix BR2_ROOTFS_DEVICE_TABLE=<device_table_location>.

Puppet: how to add a line to an existing file

I am trying to add a line to an existing file /etc/fuse.conf. I tried this
added a folder two folders under modules directory
sudo mkdir /etc/puppet/modules/test
sudo mkdir /etc/puppet/modules/test/manifests
Then created a test.pp file and added following lines
sudo vim /etc/puppet/modules/test/manifests/test.pp
file { '/etc/fuse.conf':
ensure => present,
}->
file_line { 'Append a line to /etc/fuse.conf':
path => '/etc/fuse.conf',
line => 'Want to add this line as a test',
}
After that I ran this command
puppet apply /etc/puppet/modules/test/manifests/test.pp
Then I opened this file /etc/fuse.conf and there was no change in the file. The line was not added to the file. I don't understand what I am missing here. How can I do this?
Interesting. I ran the same test you did without an issue, and as long as you have stdlib installed in your environment you should be fine.
https://forge.puppet.com/puppetlabs/stdlib
The results of running the same steps you outlined were successful for me:
[root#foreman-staging tmp]# puppet apply /etc/puppet/modules/test/manifests/test.pp
Notice: Compiled catalog for foreman-staging.kapsch.local in environment production in 0.18 seconds
Notice: /Stage[main]/Main/File[/etc/fuse.conf]/ensure: created
Notice: /Stage[main]/Main/File_line[Append a line to /etc/fuse.conf]/ensure: created
Notice: Finished catalog run in 0.24 seconds
What did your puppet run output?
You should use templates (ERB) to handle file configuration. Its easier and cleaner.
Check the puppet docs for it in :
https://docs.puppetlabs.com/puppet/latest/reference/lang_template.html
There are other options though. e.g. Augeas which is an API for file configuration and integrate very well with Puppet. http://augeas.net/index.html
[]'s
There are a few ways to handle this. If it's ini file you can use ini_setting. If it's supported by augeas you can use that. Otherwise try specifying the after parameter to file_line

make oldconfig overwriting value in .config

I'm attempting to compile the linux kernel and use a custom .config file.
So I copy the .config to my folder where the kernel source is, and run "make oldconfig" on the file to see if I'm missing anything. However, it appears that doing so modifies a few of my values back to what they were before I edited them:
< CONFIG_TRACEPOINTS=y
---
> CONFIG_TRACEPOINTS=n
< # CONFIG_DEBUG_RODATA is not set
< # CONFIG_DEBUG_SET_MODULE_RONX is not set
---
> CONFIG_DEBUG_RODATA=n
> CONFIG_DEBUG_SET_MODULE_RONX=n
How can I get oldconfig to keep the values as they were modified?
Thanks
Usually kernel config options are dependent on other config options. So even if you disable one config option, as its enabled by some other config option it will fall back to its original value after you do make oldconfig
In case of CONFIG_TRACEPOINTS it depends on or set by several other flags TRACING [=y] || BLK_DEV_IO_TRACE [=y] && TRACING_SUPPORT [=y] && FTRACE [=y] && SYSFS [=y] && BLOCK [=y]
Try setting one by one of them to =n along with CONFIG_TRACEPOINTS=n and see if its persistent after doing make oldconfig. For me setting CONFIG_FTRACE=n worked
How to find dependency. Run make menuconfig. Press / to search the config option and see the Selected by. Those are the config flags who are also setting your config option. See their current value next to them. For e.g. above you can see that TRACING_SUPPORT is set to y

Sourcing Puppet files from outside of modules

I'm installing a package from a module (Nginx in this specific case) and would like to include a configuration file from outside of the module, i.e. from a top level files directory parallel to the top level manifests directory. I don't see any way to source the file though without including it in a module or in my current Vagrant environment referring to the absolute local path.
Does Puppet allow for sourcing files from outside of modules as described in the documentation?
if I understand your question correctly, you can.
In your module a simple code like this
file { '/path/to/file':
ensure => present,
source => [
"puppet:///files/${fqdn}/path/to/file",
"puppet:///files/${hostgroup}/path/to/file",
"puppet:///files/${domain}/path/to/file",
"puppet:///files/global/path/to/file",
],
}
will do the job. The /path/to/file will be sourced using a file located in the "files" Puppet share.
(in the example above, it search in 4 different locations).
update maybe you're talking about a directory to store files which is not shared by Puppet fileserver (look at http://docs.puppetlabs.com/guides/file_serving.html), and in this case you can't i think, Vagrant or not, but you can add it to your Puppet fileserver to do it. I thinks it's the best (and maybe only) way to do it.
If you have a number of Vagrant VMs you can simply store files within your Vagrant project directory (containing your VagrantFile).
This directory is usually available to all VMs as /vagrant within the VM on creation.
If you want other directories on your computer to be available to your VMs just add the following to your VagrantFile
# see http://docs.vagrantup.com/v1/docs/config/vm/share_folder.html
config.vm.share_folder "v-packages", "/vagrant_packages", "../../dpkg"
Then to use the files within puppet you can simply treat them as local files to the VM
# bad example, bub basically use 'source => 'file:///vagrant/foo/bar'
file { '/opt/cassandra':
ensure => directory,
replace => true,
purge => true,
recurse => true,
source => 'file:///vagrant/conf/dist/apache-cassandra-1.2.0',
}
This is probably only wise to do if you only using local puppet manifests/modules.
Probably too late to help bennylope, but for others who happen across this question, as I did before figuring it out for myself ...
Include stuff like this in your Vagrantfile ...
GUEST_PROVISIONER_CONFDIR = "/example/destination/path"
HOST_PROVISIONER_CONFDIR = "/example/source/path"
config.vm.synced_folder HOST_PROVISIONER_CONFIDIR, GUEST_PROVISIONER_CONFDIR
puppet.options = "--fileserverconfig='#{GUEST_PROVISIONER_CONFDIR}/fileserver.conf'"
Then make sure /example/source/path contains the referenced fileserver.conf file. It should look something like ...
[foo]
path /example/destination/path
allow *
Now, assuming example-file.txt exists in /example/source/path, the following will work in your manifests:
source => "puppet:///foo/example-file.txt",
See:
Puppet configuration reference entry for fileserverconfig
Serving Files From Custom Mount Points

Resources