329 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
70001c841f
tor: Minor improvements
- Minimize loading of Augeas since it takes time.

- Make some methods private

- PEP8 fixes
2016-07-16 13:43:23 -04:00
Sunil Mohan Adapa
2afae80dd8
security: Recommend/notify about restricted logins
- Do stricter matches when editing configuration file.  Earlier
  mechanism would match comments etc.

- Move action methods to module core from views.

- During first boot, notify users that console login is restricted and
  that they can changed that from security settings.

- Recommend enabling conosle login restrictions.  Add message about why
  console restrictions are important.

- Show title in security module.
2016-07-09 22:42:20 +05:30
James Valleroy
8e96e828d9
security: New module to control login restrictions 2016-07-09 22:41:21 +05:30
James Valleroy
38382ec09c
tor: Add option to toggle bridge relay 2016-07-08 23:19:16 +05:30
James Valleroy
1c98d1272f
tor: Use single command to get status
Merge get_ports and get_hs into get_status.
2016-07-08 23:19:09 +05:30
Sunil Mohan Adapa
9ac37465dd
disks: New module to manage disks
- Show free space of currently mounted partitions.  Should help with
  people running out of free space and ending up with non-working
  system.  In future, this module could emit more visible messages.

- Show and allow expanding root partition to help people who have
  written FreedomBox images to higher capacity SD cards.  Very selective
  and restrictive checks to minimize problems.

- Automated tests to ensure expansion works in non-trivial senarious.
2016-06-19 16:20:01 -04:00
Daniel Steglich
ddc049734d
dynamicdns: Status message improvement
Closes #496.  If no update is done because no update needs to be done,
the success status needs to be written.  Because maybe the DNS record is
up to date when the action script is executed for the first time.  In
this case no success message was written and it looks like DynDNS is not
executed.
2016-06-15 22:47:23 +05:30
James Valleroy
ef40941c7c
Fix quoted values in nslcd config 2016-06-14 06:57:28 -04:00
Sunil Mohan Adapa
7a9a4cd861
packages: Switch to installing with apt-get
- Use action helper so that Plinth can run unprivilaged and action
  script can run as root.

- Use Status-Fd feature of apt-get to report progress.  Don't report
  much detail.

- Capture all stderr of the apt-get process and present it only in case
  of failure.

- Remove package installation using PackageKit.  Remove dependency on
  PackageKit.

- Merge --setup package installation with regular package installation.

This should fix the following problems:

- PackageKit throws errors when APT encounters an error and later
  corrects them and proceeds well.  This is reported upstream but not
  fixed.

- PackageKit does not install recommends by default and there is no easy
  way to tell it to do so.

- In some rare cases, PackageKit could get stuck for interactive input
  even though interactive flag is set to false.

- PackageKit does not work without network manager connections. (Could
  have been mitigated by altering packagekit configuration).

- PackageKit glib library leaks file descriptors after each operation.
  This leads to running out of fds during long running refresh
  operations such as OpenVPN setup.  (This should have subsided by not
  checking package install with the new setup mechanism.)]

Known issues:

- In development mode, inside action scripts the python modules are
  always loaded from system path and not development directory.

- With PackageKit it is possible to run multiple operations
  simultaneously.  Others would wait while the first is being
  installed.  With new implementation, the others error out unable to
  obtain lock.
2016-06-11 12:11:40 -04:00
James Valleroy
7470f64d06
Clean up ldapscript workarounds
These were for issues that have now been fixed:
https://github.com/martymac/ldapscripts/issues/3
https://github.com/martymac/ldapscripts/issues/5
2016-06-06 19:04:13 -04:00
Sunil Mohan Adapa
580522125f
users: Fix checking username in retrieving SSH key
When using username containing malicious the following method should be
safe:

- pwd.getpwnam()
- shutil.chown()
- mkhomedir_helper()
2016-06-04 12:57:56 -04:00
James Valleroy
f6884a18fa
Set privoxy listen-address by debconf preseed before install. 2016-05-25 19:23:54 -04:00
Sunil Mohan Adapa
f68a757741
users: Reorganize and make idempotent ldap setup
- Break down setup process into methods.

- Make sure that LDAP entity setup is idempotent.

- Peform all entry updates while slapd is running instead of using
  slapadd.

- Start slapd only when necessary.  Shutdown (only) if we have started
  slapd.
2016-05-21 16:06:33 -04:00
James Valleroy
401d3870f6
Move ldapscript setup to users module setup. 2016-05-21 16:06:26 -04:00
James Valleroy
f01575e2ea
Move ldap setup from freedombox-setup to plinth. 2016-05-21 16:06:18 -04:00
fonfon
bc2cba0cbf
tor: remove circular import 2016-05-11 18:19:49 -04:00
fonfon
f419c28596
Services: Explicitly use ServiceForm and ServiceView
- adapted all modules to not use views.ConfigurationView anymore
- removed templates that are not needed anymore
- no more implicit 'enabled' and 'get_status' functions in __init__.py files
- (more coherent/explicit use of Django functionality)
2016-05-11 18:19:31 -04:00
fonfon
a9528c56d9
Service object to handle services on a system-level
The Service object now offers handling services on a system level,
and gathering information whether it's enabled or running.
New methods: enable, disable, is_enabled, is_running;

For this it needs the correct (system-level) service name.
All of the methods can be overridden/customized.

This changes all modules to the new Service object and deletes
action scripts that are not required anymore.
2016-05-11 18:19:27 -04:00
fonfon
9fe49f881f
Services-Action to handle and list services managed by plinth
- API: start, stop, enable, disable, reload, is-running, is-enabled, list
- only allows access to a service if the service name is listed in a
  'managed_services' variable of any plinth module.
2016-05-11 18:19:14 -04:00
James Valleroy
a6417c59a7
tor: Use augeas to modify configuration.
- Use json to get info from action script.
- Add SSH port to hidden service.
- Enable hidden service during setup.
2016-03-15 18:50:51 -04:00
Sunil Mohan Adapa
4c6d572e67
ttrss: Ensure database used is PostgreSQL
- Installing dbcommon-pgsql and not install dbcommon-mysql does not
  ensure that PostgreSQL is selected as the database for the
  application.  Set a debconf value to force selection of PostgreSQL.

- Minor styling fixes.
2016-03-12 17:17:50 +05:30
James Valleroy
368e64c5ca
ttrss: Use LDAP authentication 2016-03-12 11:38:28 +05:30
James Valleroy
47a54fadd1
ttrss: Add basic configuration 2016-03-12 11:38:22 +05:30
James Valleroy
15591b79ca
ttrss: Update to use ConfigurationView 2016-03-12 11:38:14 +05:30
Jallepalli Ashok Kumar
80bab090bf
ttrss: New module for Tiny Tiny RSS feed reader 2016-03-12 11:37:28 +05:30
Sunil Mohan Adapa
f4601e7b05
monkeysphere: Reorganize around keys instead
- Read Apache configuration to find the list of all available
  certificates and their associated domains.  Use this for setting UIDs
  properly.

- Solve the issue of re-importing renewed certficiate.  Use the SSH
  fingerprints as unique keys instead of domain names.  Compute SSH
  fingerprints for SSH keys and HTTPS certficates inorder accurately
  identify if they are currently imported into monkeysphere.

- Allow having more than one domains for a certficiate.  Add action to
  import new domains to an existing monkeysphere OpenPGP key.

- Import only once for a given certficiate and keep adding UIDs when
  domains get added.

- Merge services SSH and HTTPS giving us the ability to deals with many
  more services.  Remove special handling for different kinds of
  certificate sources.

- Supress monkeysphere prompts in case of reusing UIDs.
2016-03-08 23:32:29 +05:30
James Valleroy
5c810ed87f
monkeysphere: Add Let's Encrypt certificates
Filter letsencrypt domains from snakeoil list.
Rename views for snakeoil and letsencrypt.
2016-03-08 23:31:42 +05:30
James Valleroy
cc6f44d87e
monkeysphere: Clarify arguments for import actions 2016-03-08 23:30:27 +05:30
James Valleroy
79edbd6195
monkeysphere: Add self-signed certificate section 2016-03-08 23:29:41 +05:30
Sunil Mohan Adapa
aba2b03c52
transmission: Remove unused import 2016-02-26 22:42:05 +05:30
Sunil Mohan Adapa
7e87f0304a
radicale: Listen only on internal addresses
- Since we are trusting the remote user header, it is much safer not
  listen on external addresses.  We don't that since Apache connects on
  internal address.
2016-02-26 22:34:25 +05:30
James Valleroy
9d85084d8d
radicale: New module for a CalDAV/CardDAV server 2016-02-26 15:40:19 +05:30
James Valleroy
363e071bff
minetest: New module for minetest server 2016-02-26 15:20:36 +05:30
Saúl Ibarra Corretgé
b0b67db35e
letsencrypt: Force text mode
This avoids letsencrypt trying to launch a dialog interface in case of
certain errors.
2016-02-19 19:54:09 +05:30
Sunil Mohan Adapa
ccc7310bd5
monkeysphere: Fix error with no host keys 2016-02-16 08:45:50 +05:30
Sunil Mohan Adapa
83ec57414c
dynamicdns: Fix starting daemon for no NAT
Incase the machine is not behind NAT, fix the logic that decides to
start the daemon.
2016-02-01 11:03:54 +05:30
Sunil Mohan Adapa
51dd1bb000
dynamicdns: Fix an invalid syntax
'local' keyword can't be used outside a method.
2016-02-01 11:02:43 +05:30
Sunil Mohan Adapa
ea1e9b6e2a
dynamicdns: Fix writing configuration for no NAT
- When writing the configuration file for no NAT case, append then last
  part of the file instead of overwriting.

- Also 'echo' statements are missing leading to attempt to execute the
  config options instead of writing them to a file.
2016-02-01 11:00:46 +05:30
Sunil Mohan Adapa
aa5efd4984
dynamicdns: Fix computing update times
Currenly uptime is being taken as measure to decide whether update must
run.  Uptime is the number of seconds since machine has booted.  If a
machine has run for 30 hours, and rebooted, then update will not be done
until the machine has run for 30 hours + desinated time.  Using seconds
since epoch fixes this.
2016-02-01 10:57:33 +05:30
Sunil Mohan Adapa
2a030f91fe
dynamicdns: Fix reading configuration file
- The current code to parse the configuration file does not work proper
  if there is an '=' in the password.  Fix it.

- Also if predesignated keyword like 'server' occurs in the password,
  configuration can't be read properly.  Fix it.
2016-02-01 10:53:26 +05:30
Daniel Steglich
a90039889d
dynamicdns: Fix passing password via stdin
* Add an option to pass the password via cmdline (optional, not used by
  plinth) if called manually.

* Fix: If -p option was not the last given option, everything after -p
  was lost.  Closes #310.
2016-02-01 10:46:48 +05:30
Sunil Mohan Adapa
65a1985cc0
tor: Minor fixes and styling
- Add note about resetarting firewalld.

- Refactor checking for running configuration process.

- Fix error message being show as info message.

- Minor indentation fixes.
2016-01-30 19:41:13 +05:30
James Valleroy
1e67fcb61a
tor: After enabling hidden service, wait for info 2016-01-30 18:08:47 +05:30
James Valleroy
07130b6007
tor: Run configuration update as background task
- Closes: #294.
2016-01-30 18:08:40 +05:30
James Valleroy
a22595af77
tor: Avoid unneeded service restarts
- Fix an import error.
2016-01-30 18:08:33 +05:30
James Valleroy
0844151244
tor: Combine all configuration actions 2016-01-30 18:07:42 +05:30
James Valleroy
a3845e2b28
tor: Add service for bridge relay ports 2016-01-30 18:07:34 +05:30
Sunil Mohan Adapa
506bff5c7b
users: Multiple SSH keys and better home creation
- Allow setting multiple SSH keys one per line (which is already
  allowed, but advertise it better).

- Use mkhomedir_helper to create the user's home directory.  Avoid
  security and accuracy complexities of creating a home directory.

- Allow homes that don't exist in /home.
2016-01-30 15:30:52 +05:30
James Valleroy
ad7d6db968
users: Add field to set user's SSH key. 2016-01-30 15:30:32 +05:30
James Valleroy
b7e44eb429
Add repro SIP proxy module. 2016-01-27 17:49:20 +05:30